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

◆ zhet01_aa()

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

ZHET01_AA

Purpose:
 ZHET01_AA reconstructs a hermitian indefinite matrix A from its
 block L*D*L' or U*D*U' factorization and computes the residual
    norm( C - A ) / ( N * norm(A) * EPS ),
 where C is the reconstructed matrix and EPS is the machine epsilon.
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]AFAC
          AFAC is COMPLEX*16 array, dimension (LDAFAC,N)
          The factored form of the matrix A.  AFAC contains the block
          diagonal matrix D and the multipliers used to obtain the
          factor L or U from the block L*D*L' or U*D*U' factorization
          as computed by ZHETRF.
[in]LDAFAC
          LDAFAC is INTEGER
          The leading dimension of the array AFAC.  LDAFAC >= max(1,N).
[in]IPIV
          IPIV is INTEGER array, dimension (N)
          The pivot indices from ZHETRF.
[out]C
          C is COMPLEX*16 array, dimension (LDC,N)
[in]LDC
          LDC is INTEGER
          The leading dimension of the array C.  LDC >= max(1,N).
[out]RWORK
          RWORK is COMPLEX*16 array, dimension (N)
[out]RESID
          RESID is COMPLEX*16
          If UPLO = 'L', norm(L*D*L' - A) / ( N * norm(A) * EPS )
          If UPLO = 'U', norm(U*D*U' - A) / ( N * norm(A) * EPS )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 122 of file zhet01_aa.f.

124*
125* -- LAPACK test routine --
126* -- LAPACK is a software package provided by Univ. of Tennessee, --
127* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
128*
129* .. Scalar Arguments ..
130 CHARACTER UPLO
131 INTEGER LDA, LDAFAC, LDC, N
132 DOUBLE PRECISION RESID
133* ..
134* .. Array Arguments ..
135 INTEGER IPIV( * )
136 DOUBLE PRECISION RWORK( * )
137 COMPLEX*16 A( LDA, * ), AFAC( LDAFAC, * ), C( LDC, * )
138* ..
139*
140* =====================================================================
141*
142* .. Parameters ..
143 COMPLEX*16 CZERO, CONE
144 parameter( czero = ( 0.0d+0, 0.0d+0 ),
145 $ cone = ( 1.0d+0, 0.0d+0 ) )
146 DOUBLE PRECISION ZERO, ONE
147 parameter( zero = 0.0d+0, one = 1.0d+0 )
148* ..
149* .. Local Scalars ..
150 INTEGER I, J
151 DOUBLE PRECISION ANORM, EPS
152* ..
153* .. External Functions ..
154 LOGICAL LSAME
155 DOUBLE PRECISION DLAMCH, ZLANHE
156 EXTERNAL lsame, dlamch, zlanhe
157* ..
158* .. External Subroutines ..
159 EXTERNAL zlaset, zlavhe
160* ..
161* .. Intrinsic Functions ..
162 INTRINSIC dble
163* ..
164* .. Executable Statements ..
165*
166* Quick exit if N = 0.
167*
168 IF( n.LE.0 ) THEN
169 resid = zero
170 RETURN
171 END IF
172*
173* Determine EPS and the norm of A.
174*
175 eps = dlamch( 'Epsilon' )
176 anorm = zlanhe( '1', uplo, n, a, lda, rwork )
177*
178* Initialize C to the tridiagonal matrix T.
179*
180 CALL zlaset( 'Full', n, n, czero, czero, c, ldc )
181 CALL zlacpy( 'F', 1, n, afac( 1, 1 ), ldafac+1, c( 1, 1 ), ldc+1 )
182 IF( n.GT.1 ) THEN
183 IF( lsame( uplo, 'U' ) ) THEN
184 CALL zlacpy( 'F', 1, n-1, afac( 1, 2 ), ldafac+1, c( 1, 2 ),
185 $ ldc+1 )
186 CALL zlacpy( 'F', 1, n-1, afac( 1, 2 ), ldafac+1, c( 2, 1 ),
187 $ ldc+1 )
188 CALL zlacgv( n-1, c( 2, 1 ), ldc+1 )
189 ELSE
190 CALL zlacpy( 'F', 1, n-1, afac( 2, 1 ), ldafac+1, c( 1, 2 ),
191 $ ldc+1 )
192 CALL zlacpy( 'F', 1, n-1, afac( 2, 1 ), ldafac+1, c( 2, 1 ),
193 $ ldc+1 )
194 CALL zlacgv( n-1, c( 1, 2 ), ldc+1 )
195 ENDIF
196*
197* Call ZTRMM to form the product U' * D (or L * D ).
198*
199 IF( lsame( uplo, 'U' ) ) THEN
200 CALL ztrmm( 'Left', uplo, 'Conjugate transpose', 'Unit',
201 $ n-1, n, cone, afac( 1, 2 ), ldafac, c( 2, 1 ),
202 $ ldc )
203 ELSE
204 CALL ztrmm( 'Left', uplo, 'No transpose', 'Unit', n-1, n,
205 $ cone, afac( 2, 1 ), ldafac, c( 2, 1 ), ldc )
206 END IF
207*
208* Call ZTRMM again to multiply by U (or L ).
209*
210 IF( lsame( uplo, 'U' ) ) THEN
211 CALL ztrmm( 'Right', uplo, 'No transpose', 'Unit', n, n-1,
212 $ cone, afac( 1, 2 ), ldafac, c( 1, 2 ), ldc )
213 ELSE
214 CALL ztrmm( 'Right', uplo, 'Conjugate transpose', 'Unit', n,
215 $ n-1, cone, afac( 2, 1 ), ldafac, c( 1, 2 ),
216 $ ldc )
217 END IF
218*
219* Apply hermitian pivots
220*
221 DO j = n, 1, -1
222 i = ipiv( j )
223 IF( i.NE.j )
224 $ CALL zswap( n, c( j, 1 ), ldc, c( i, 1 ), ldc )
225 END DO
226 DO j = n, 1, -1
227 i = ipiv( j )
228 IF( i.NE.j )
229 $ CALL zswap( n, c( 1, j ), 1, c( 1, i ), 1 )
230 END DO
231 ENDIF
232*
233*
234* Compute the difference C - A .
235*
236 IF( lsame( uplo, 'U' ) ) THEN
237 DO j = 1, n
238 DO i = 1, j
239 c( i, j ) = c( i, j ) - a( i, j )
240 END DO
241 END DO
242 ELSE
243 DO j = 1, n
244 DO i = j, n
245 c( i, j ) = c( i, j ) - a( i, j )
246 END DO
247 END DO
248 END IF
249*
250* Compute norm( C - A ) / ( N * norm(A) * EPS )
251*
252 resid = zlanhe( '1', uplo, n, c, ldc, rwork )
253*
254 IF( anorm.LE.zero ) THEN
255 IF( resid.NE.zero )
256 $ resid = one / eps
257 ELSE
258 resid = ( ( resid / dble( n ) ) / anorm ) / eps
259 END IF
260*
261 RETURN
262*
263* End of ZHET01_AA
264*
subroutine zlacgv(n, x, incx)
ZLACGV conjugates a complex vector.
Definition zlacgv.f:74
subroutine zlacpy(uplo, m, n, a, lda, b, ldb)
ZLACPY copies all or part of one two-dimensional array to another.
Definition zlacpy.f:103
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
subroutine zlaset(uplo, m, n, alpha, beta, a, lda)
ZLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
Definition zlaset.f:106
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine zswap(n, zx, incx, zy, incy)
ZSWAP
Definition zswap.f:81
subroutine ztrmm(side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb)
ZTRMM
Definition ztrmm.f:177
subroutine zlavhe(uplo, trans, diag, n, nrhs, a, lda, ipiv, b, ldb, info)
ZLAVHE
Definition zlavhe.f:153
Here is the call graph for this function:
Here is the caller graph for this function: