3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * SUBROUTINE ZHPT01( UPLO, N, A, AFAC, IPIV, C, LDC, RWORK, RESID )
13 * .. Scalar Arguments ..
16 * DOUBLE PRECISION RESID
18 * .. Array Arguments ..
20 * DOUBLE PRECISION RWORK( * )
21 * COMPLEX*16 A( * ), AFAC( * ), C( LDC, * )
30 *> ZHPT01 reconstructs a Hermitian indefinite packed matrix A from its
31 *> block L*D*L' or U*D*U' factorization and computes the residual
32 *> norm( C - A ) / ( N * norm(A) * EPS ),
33 *> where C is the reconstructed matrix, EPS is the machine epsilon,
34 *> L' is the conjugate transpose of L, and U' is the conjugate transpose
43 *> UPLO is CHARACTER*1
44 *> Specifies whether the upper or lower triangular part of the
45 *> Hermitian matrix A is stored:
46 *> = 'U': Upper triangular
47 *> = 'L': Lower triangular
53 *> The number of rows and columns of the matrix A. N >= 0.
58 *> A is COMPLEX*16 array, dimension (N*(N+1)/2)
59 *> The original Hermitian matrix A, stored as a packed
65 *> AFAC is COMPLEX*16 array, dimension (N*(N+1)/2)
66 *> The factored form of the matrix A, stored as a packed
67 *> triangular matrix. AFAC contains the block diagonal matrix D
68 *> and the multipliers used to obtain the factor L or U from the
69 *> block L*D*L' or U*D*U' factorization as computed by ZHPTRF.
74 *> IPIV is INTEGER array, dimension (N)
75 *> The pivot indices from ZHPTRF.
80 *> C is COMPLEX*16 array, dimension (LDC,N)
86 *> The leading dimension of the array C. LDC >= max(1,N).
91 *> RWORK is DOUBLE PRECISION array, dimension (N)
96 *> RESID is DOUBLE PRECISION
97 *> If UPLO = 'L', norm(L*D*L' - A) / ( N * norm(A) * EPS )
98 *> If UPLO = 'U', norm(U*D*U' - A) / ( N * norm(A) * EPS )
104 *> \author Univ. of Tennessee
105 *> \author Univ. of California Berkeley
106 *> \author Univ. of Colorado Denver
109 *> \date November 2011
111 *> \ingroup complex16_lin
113 * =====================================================================
114 SUBROUTINE ZHPT01( UPLO, N, A, AFAC, IPIV, C, LDC, RWORK, RESID )
116 * -- LAPACK test routine (version 3.4.0) --
117 * -- LAPACK is a software package provided by Univ. of Tennessee, --
118 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
121 * .. Scalar Arguments ..
124 DOUBLE PRECISION RESID
126 * .. Array Arguments ..
128 DOUBLE PRECISION RWORK( * )
129 COMPLEX*16 A( * ), AFAC( * ), C( LDC, * )
132 * =====================================================================
135 DOUBLE PRECISION ZERO, ONE
136 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
137 COMPLEX*16 CZERO, CONE
138 PARAMETER ( CZERO = ( 0.0D+0, 0.0D+0 ),
139 $ CONE = ( 1.0D+0, 0.0D+0 ) )
141 * .. Local Scalars ..
142 INTEGER I, INFO, J, JC
143 DOUBLE PRECISION ANORM, EPS
145 * .. External Functions ..
147 DOUBLE PRECISION DLAMCH, ZLANHE, ZLANHP
148 EXTERNAL LSAME, DLAMCH, ZLANHE, ZLANHP
150 * .. External Subroutines ..
151 EXTERNAL ZLASET, ZLAVHP
153 * .. Intrinsic Functions ..
154 INTRINSIC DBLE, DIMAG
156 * .. Executable Statements ..
158 * Quick exit if N = 0.
165 * Determine EPS and the norm of A.
167 EPS = DLAMCH( 'Epsilon' )
168 ANORM = ZLANHP( '1', UPLO, N, A, RWORK )
170 * Check the imaginary parts of the diagonal elements and return with
171 * an error code if any are nonzero.
174 IF( LSAME( UPLO, 'U' ) ) THEN
176 IF( DIMAG( AFAC( JC ) ).NE.ZERO ) THEN
184 IF( DIMAG( AFAC( JC ) ).NE.ZERO ) THEN
192 * Initialize C to the identity matrix.
194 CALL ZLASET( 'Full', N, N, CZERO, CONE, C, LDC )
196 * Call ZLAVHP to form the product D * U' (or D * L' ).
198 CALL ZLAVHP( UPLO, 'Conjugate', 'Non-unit', N, N, AFAC, IPIV, C,
201 * Call ZLAVHP again to multiply by U ( or L ).
203 CALL ZLAVHP( UPLO, 'No transpose', 'Unit', N, N, AFAC, IPIV, C,
206 * Compute the difference C - A .
208 IF( LSAME( UPLO, 'U' ) ) THEN
212 C( I, J ) = C( I, J ) - A( JC+I )
214 C( J, J ) = C( J, J ) - DBLE( A( JC+J ) )
220 C( J, J ) = C( J, J ) - DBLE( A( JC ) )
222 C( I, J ) = C( I, J ) - A( JC+I-J )
228 * Compute norm( C - A ) / ( N * norm(A) * EPS )
230 RESID = ZLANHE( '1', UPLO, N, C, LDC, RWORK )
232 IF( ANORM.LE.ZERO ) THEN
236 RESID = ( ( RESID / DBLE( N ) ) / ANORM ) / EPS