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

◆ zhet01()

subroutine zhet01 ( 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

Purpose:
 ZHET01 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, 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]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 DOUBLE PRECISION array, dimension (N)
[out]RESID
          RESID is DOUBLE PRECISION
          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 124 of file zhet01.f.

126*
127* -- LAPACK test routine --
128* -- LAPACK is a software package provided by Univ. of Tennessee, --
129* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
130*
131* .. Scalar Arguments ..
132 CHARACTER UPLO
133 INTEGER LDA, LDAFAC, LDC, N
134 DOUBLE PRECISION RESID
135* ..
136* .. Array Arguments ..
137 INTEGER IPIV( * )
138 DOUBLE PRECISION RWORK( * )
139 COMPLEX*16 A( LDA, * ), AFAC( LDAFAC, * ), C( LDC, * )
140* ..
141*
142* =====================================================================
143*
144* .. Parameters ..
145 DOUBLE PRECISION ZERO, ONE
146 parameter( zero = 0.0d+0, one = 1.0d+0 )
147 COMPLEX*16 CZERO, CONE
148 parameter( czero = ( 0.0d+0, 0.0d+0 ),
149 $ cone = ( 1.0d+0, 0.0d+0 ) )
150* ..
151* .. Local Scalars ..
152 INTEGER I, INFO, J
153 DOUBLE PRECISION ANORM, EPS
154* ..
155* .. External Functions ..
156 LOGICAL LSAME
157 DOUBLE PRECISION DLAMCH, ZLANHE
158 EXTERNAL lsame, dlamch, zlanhe
159* ..
160* .. External Subroutines ..
161 EXTERNAL zlaset, zlavhe
162* ..
163* .. Intrinsic Functions ..
164 INTRINSIC dble, dimag
165* ..
166* .. Executable Statements ..
167*
168* Quick exit if N = 0.
169*
170 IF( n.LE.0 ) THEN
171 resid = zero
172 RETURN
173 END IF
174*
175* Determine EPS and the norm of A.
176*
177 eps = dlamch( 'Epsilon' )
178 anorm = zlanhe( '1', uplo, n, a, lda, rwork )
179*
180* Check the imaginary parts of the diagonal elements and return with
181* an error code if any are nonzero.
182*
183 DO 10 j = 1, n
184 IF( dimag( afac( j, j ) ).NE.zero ) THEN
185 resid = one / eps
186 RETURN
187 END IF
188 10 CONTINUE
189*
190* Initialize C to the identity matrix.
191*
192 CALL zlaset( 'Full', n, n, czero, cone, c, ldc )
193*
194* Call ZLAVHE to form the product D * U' (or D * L' ).
195*
196 CALL zlavhe( uplo, 'Conjugate', 'Non-unit', n, n, afac, ldafac,
197 $ ipiv, c, ldc, info )
198*
199* Call ZLAVHE again to multiply by U (or L ).
200*
201 CALL zlavhe( uplo, 'No transpose', 'Unit', n, n, afac, ldafac,
202 $ ipiv, c, ldc, info )
203*
204* Compute the difference C - A .
205*
206 IF( lsame( uplo, 'U' ) ) THEN
207 DO 30 j = 1, n
208 DO 20 i = 1, j - 1
209 c( i, j ) = c( i, j ) - a( i, j )
210 20 CONTINUE
211 c( j, j ) = c( j, j ) - dble( a( j, j ) )
212 30 CONTINUE
213 ELSE
214 DO 50 j = 1, n
215 c( j, j ) = c( j, j ) - dble( a( j, j ) )
216 DO 40 i = j + 1, n
217 c( i, j ) = c( i, j ) - a( i, j )
218 40 CONTINUE
219 50 CONTINUE
220 END IF
221*
222* Compute norm( C - A ) / ( N * norm(A) * EPS )
223*
224 resid = zlanhe( '1', uplo, n, c, ldc, rwork )
225*
226 IF( anorm.LE.zero ) THEN
227 IF( resid.NE.zero )
228 $ resid = one / eps
229 ELSE
230 resid = ( ( resid / dble( n ) ) / anorm ) / eps
231 END IF
232*
233 RETURN
234*
235* End of ZHET01
236*
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 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: