LAPACK  3.7.0
LAPACK: Linear Algebra PACKage
subroutine zhet01_3 ( character  UPLO,
integer  N,
complex*16, dimension( lda, * )  A,
integer  LDA,
complex*16, dimension( ldafac, * )  AFAC,
integer  LDAFAC,
complex*16, dimension( * )  E,
integer, dimension( * )  IPIV,
complex*16, dimension( ldc, * )  C,
integer  LDC,
double precision, dimension( * )  RWORK,
double precision  RESID 
)

ZHET01_3

Purpose:
 ZHET01_3 reconstructs a Hermitian indefinite matrix A from its
 block L*D*L' or U*D*U' factorization computed by ZHETRF_RK
 (or ZHETRF_BK) 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)
          Diagonal of the block diagonal matrix D and factors U or L
          as computed by ZHETRF_RK and ZHETRF_BK:
            a) ONLY diagonal elements of the Hermitian block diagonal
               matrix D on the diagonal of A, i.e. D(k,k) = A(k,k);
               (superdiagonal (or subdiagonal) elements of D
                should be provided on entry in array E), and
            b) If UPLO = 'U': factor U in the superdiagonal part of A.
               If UPLO = 'L': factor L in the subdiagonal part of A.
[in]LDAFAC
          LDAFAC is INTEGER
          The leading dimension of the array AFAC.
          LDAFAC >= max(1,N).
[in]E
          E is COMPLEX*16 array, dimension (N)
          On entry, contains the superdiagonal (or subdiagonal)
          elements of the Hermitian block diagonal matrix D
          with 1-by-1 or 2-by-2 diagonal blocks, where
          If UPLO = 'U': E(i) = D(i-1,i),i=2:N, E(1) not refernced;
          If UPLO = 'L': E(i) = D(i+1,i),i=1:N-1, E(N) not referenced.
[in]IPIV
          IPIV is INTEGER array, dimension (N)
          The pivot indices from ZHETRF_RK (or ZHETRF_BK).
[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.
Date
December 2016

Definition at line 143 of file zhet01_3.f.

143 *
144 * -- LAPACK test routine (version 3.7.0) --
145 * -- LAPACK is a software package provided by Univ. of Tennessee, --
146 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
147 * December 2016
148 *
149 * .. Scalar Arguments ..
150  CHARACTER uplo
151  INTEGER lda, ldafac, ldc, n
152  DOUBLE PRECISION resid
153 * ..
154 * .. Array Arguments ..
155  INTEGER ipiv( * )
156  DOUBLE PRECISION rwork( * )
157  COMPLEX*16 a( lda, * ), afac( ldafac, * ), c( ldc, * ),
158  $ e( * )
159 * ..
160 *
161 * =====================================================================
162 *
163 * .. Parameters ..
164  DOUBLE PRECISION zero, one
165  parameter ( zero = 0.0d+0, one = 1.0d+0 )
166  COMPLEX*16 czero, cone
167  parameter ( czero = ( 0.0d+0, 0.0d+0 ),
168  $ cone = ( 1.0d+0, 0.0d+0 ) )
169 * ..
170 * .. Local Scalars ..
171  INTEGER i, info, j
172  DOUBLE PRECISION anorm, eps
173 * ..
174 * .. External Functions ..
175  LOGICAL lsame
176  DOUBLE PRECISION zlanhe, dlamch
177  EXTERNAL lsame, zlanhe, dlamch
178 * ..
179 * .. External Subroutines ..
180  EXTERNAL zlaset, zlavhe_rook, zsyconvf_rook
181 * ..
182 * .. Intrinsic Functions ..
183  INTRINSIC dimag, dble
184 * ..
185 * .. Executable Statements ..
186 *
187 * Quick exit if N = 0.
188 *
189  IF( n.LE.0 ) THEN
190  resid = zero
191  RETURN
192  END IF
193 *
194 * a) Revert to multiplyers of L
195 *
196  CALL zsyconvf_rook( uplo, 'R', n, afac, ldafac, e, ipiv, info )
197 *
198 * 1) Determine EPS and the norm of A.
199 *
200  eps = dlamch( 'Epsilon' )
201  anorm = zlanhe( '1', uplo, n, a, lda, rwork )
202 *
203 * Check the imaginary parts of the diagonal elements and return with
204 * an error code if any are nonzero.
205 *
206  DO j = 1, n
207  IF( dimag( afac( j, j ) ).NE.zero ) THEN
208  resid = one / eps
209  RETURN
210  END IF
211  END DO
212 *
213 * 2) Initialize C to the identity matrix.
214 *
215  CALL zlaset( 'Full', n, n, czero, cone, c, ldc )
216 *
217 * 3) Call ZLAVHE_ROOK to form the product D * U' (or D * L' ).
218 *
219  CALL zlavhe_rook( uplo, 'Conjugate', 'Non-unit', n, n, afac,
220  $ ldafac, ipiv, c, ldc, info )
221 *
222 * 4) Call ZLAVHE_RK again to multiply by U (or L ).
223 *
224  CALL zlavhe_rook( uplo, 'No transpose', 'Unit', n, n, afac,
225  $ ldafac, ipiv, c, ldc, info )
226 *
227 * 5) Compute the difference C - A .
228 *
229  IF( lsame( uplo, 'U' ) ) THEN
230  DO j = 1, n
231  DO i = 1, j - 1
232  c( i, j ) = c( i, j ) - a( i, j )
233  END DO
234  c( j, j ) = c( j, j ) - dble( a( j, j ) )
235  END DO
236  ELSE
237  DO j = 1, n
238  c( j, j ) = c( j, j ) - dble( a( j, j ) )
239  DO i = j + 1, n
240  c( i, j ) = c( i, j ) - a( i, j )
241  END DO
242  END DO
243  END IF
244 *
245 * 6) Compute norm( C - A ) / ( N * norm(A) * EPS )
246 *
247  resid = zlanhe( '1', uplo, n, c, ldc, rwork )
248 *
249  IF( anorm.LE.zero ) THEN
250  IF( resid.NE.zero )
251  $ resid = one / eps
252  ELSE
253  resid = ( ( resid/dble( n ) )/anorm ) / eps
254  END IF
255 *
256 * b) Convert to factor of L (or U)
257 *
258  CALL zsyconvf_rook( uplo, 'C', n, afac, ldafac, e, ipiv, info )
259 *
260  RETURN
261 *
262 * End of ZHET01_3
263 *
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
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, or the element of largest absolute value of a complex Hermitian matrix.
Definition: zlanhe.f:126
subroutine zsyconvf_rook(UPLO, WAY, N, A, LDA, E, IPIV, INFO)
ZSYCONVF_ROOK
subroutine zlavhe_rook(UPLO, TRANS, DIAG, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
ZLAVHE_ROOK
Definition: zlavhe_rook.f:155
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:108
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55

Here is the call graph for this function:

Here is the caller graph for this function: