LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ zpot01()

subroutine zpot01 ( character  uplo,
integer  n,
complex*16, dimension( lda, * )  a,
integer  lda,
complex*16, dimension( ldafac, * )  afac,
integer  ldafac,
double precision, dimension( * )  rwork,
double precision  resid 
)

ZPOT01

Purpose:
 ZPOT01 reconstructs a Hermitian positive definite matrix  A  from
 its L*L' or U'*U factorization and computes the residual
    norm( L*L' - A ) / ( N * norm(A) * EPS ) or
    norm( U'*U - A ) / ( N * norm(A) * EPS ),
 where EPS is the machine epsilon, L' is the conjugate transpose of L,
 and U' is the conjugate transpose of U.
Parameters
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the upper or lower triangular part of the
          Hermitian matrix A is stored:
          = 'U':  Upper triangular
          = 'L':  Lower triangular
[in]N
          N is INTEGER
          The number of rows and columns of the matrix A.  N >= 0.
[in]A
          A is COMPLEX*16 array, dimension (LDA,N)
          The original Hermitian matrix A.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N)
[in,out]AFAC
          AFAC is COMPLEX*16 array, dimension (LDAFAC,N)
          On entry, the factor L or U from the L * L**H or U**H * U
          factorization of A.
          Overwritten with the reconstructed matrix, and then with
          the difference L * L**H - A (or U**H * U - A).
[in]LDAFAC
          LDAFAC is INTEGER
          The leading dimension of the array AFAC.  LDAFAC >= max(1,N).
[out]RWORK
          RWORK is DOUBLE PRECISION array, dimension (N)
[out]RESID
          RESID is DOUBLE PRECISION
          If UPLO = 'L', norm(L * L**H - A) / ( N * norm(A) * EPS )
          If UPLO = 'U', norm(U**H * U - A) / ( N * norm(A) * EPS )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 105 of file zpot01.f.

106*
107* -- LAPACK test routine --
108* -- LAPACK is a software package provided by Univ. of Tennessee, --
109* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
110*
111* .. Scalar Arguments ..
112 CHARACTER UPLO
113 INTEGER LDA, LDAFAC, N
114 DOUBLE PRECISION RESID
115* ..
116* .. Array Arguments ..
117 DOUBLE PRECISION RWORK( * )
118 COMPLEX*16 A( LDA, * ), AFAC( LDAFAC, * )
119* ..
120*
121* =====================================================================
122*
123* .. Parameters ..
124 DOUBLE PRECISION ZERO, ONE
125 parameter( zero = 0.0d+0, one = 1.0d+0 )
126* ..
127* .. Local Scalars ..
128 INTEGER I, J, K
129 DOUBLE PRECISION ANORM, EPS, TR
130 COMPLEX*16 TC
131* ..
132* .. External Functions ..
133 LOGICAL LSAME
134 DOUBLE PRECISION DLAMCH, ZLANHE
135 COMPLEX*16 ZDOTC
136 EXTERNAL lsame, dlamch, zlanhe, zdotc
137* ..
138* .. External Subroutines ..
139 EXTERNAL zher, zscal, ztrmv
140* ..
141* .. Intrinsic Functions ..
142 INTRINSIC dble, dimag
143* ..
144* .. Executable Statements ..
145*
146* Quick exit if N = 0.
147*
148 IF( n.LE.0 ) THEN
149 resid = zero
150 RETURN
151 END IF
152*
153* Exit with RESID = 1/EPS if ANORM = 0.
154*
155 eps = dlamch( 'Epsilon' )
156 anorm = zlanhe( '1', uplo, n, a, lda, rwork )
157 IF( anorm.LE.zero ) THEN
158 resid = one / eps
159 RETURN
160 END IF
161*
162* Check the imaginary parts of the diagonal elements and return with
163* an error code if any are nonzero.
164*
165 DO 10 j = 1, n
166 IF( dimag( afac( j, j ) ).NE.zero ) THEN
167 resid = one / eps
168 RETURN
169 END IF
170 10 CONTINUE
171*
172* Compute the product U**H * U, overwriting U.
173*
174 IF( lsame( uplo, 'U' ) ) THEN
175 DO 20 k = n, 1, -1
176*
177* Compute the (K,K) element of the result.
178*
179 tr = dble( zdotc( k, afac( 1, k ), 1, afac( 1, k ), 1 ) )
180 afac( k, k ) = tr
181*
182* Compute the rest of column K.
183*
184 CALL ztrmv( 'Upper', 'Conjugate', 'Non-unit', k-1, afac,
185 $ ldafac, afac( 1, k ), 1 )
186*
187 20 CONTINUE
188*
189* Compute the product L * L**H, overwriting L.
190*
191 ELSE
192 DO 30 k = n, 1, -1
193*
194* Add a multiple of column K of the factor L to each of
195* columns K+1 through N.
196*
197 IF( k+1.LE.n )
198 $ CALL zher( 'Lower', n-k, one, afac( k+1, k ), 1,
199 $ afac( k+1, k+1 ), ldafac )
200*
201* Scale column K by the diagonal element.
202*
203 tc = afac( k, k )
204 CALL zscal( n-k+1, tc, afac( k, k ), 1 )
205*
206 30 CONTINUE
207 END IF
208*
209* Compute the difference L * L**H - A (or U**H * U - A).
210*
211 IF( lsame( uplo, 'U' ) ) THEN
212 DO 50 j = 1, n
213 DO 40 i = 1, j - 1
214 afac( i, j ) = afac( i, j ) - a( i, j )
215 40 CONTINUE
216 afac( j, j ) = afac( j, j ) - dble( a( j, j ) )
217 50 CONTINUE
218 ELSE
219 DO 70 j = 1, n
220 afac( j, j ) = afac( j, j ) - dble( a( j, j ) )
221 DO 60 i = j + 1, n
222 afac( i, j ) = afac( i, j ) - a( i, j )
223 60 CONTINUE
224 70 CONTINUE
225 END IF
226*
227* Compute norm(L*U - A) / ( N * norm(A) * EPS )
228*
229 resid = zlanhe( '1', uplo, n, afac, ldafac, rwork )
230*
231 resid = ( ( resid / dble( n ) ) / anorm ) / eps
232*
233 RETURN
234*
235* End of ZPOT01
236*
complex *16 function zdotc(n, zx, incx, zy, incy)
ZDOTC
Definition zdotc.f:83
subroutine zher(uplo, n, alpha, x, incx, a, lda)
ZHER
Definition zher.f:135
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69
double precision function zlanhe(norm, uplo, n, a, lda, work)
ZLANHE returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition zlanhe.f:124
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine zscal(n, za, zx, incx)
ZSCAL
Definition zscal.f:78
subroutine ztrmv(uplo, trans, diag, n, a, lda, x, incx)
ZTRMV
Definition ztrmv.f:147
Here is the call graph for this function:
Here is the caller graph for this function: