LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages

◆ zhet01_3()

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 referenced; !> 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.

Definition at line 139 of file zhet01_3.f.

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