3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * SUBROUTINE ZPOT03( UPLO, N, A, LDA, AINV, LDAINV, WORK, LDWORK,
12 * RWORK, RCOND, RESID )
14 * .. Scalar Arguments ..
16 * INTEGER LDA, LDAINV, LDWORK, N
17 * DOUBLE PRECISION RCOND, RESID
19 * .. Array Arguments ..
20 * DOUBLE PRECISION RWORK( * )
21 * COMPLEX*16 A( LDA, * ), AINV( LDAINV, * ),
31 *> ZPOT03 computes the residual for a Hermitian matrix times its
33 *> norm( I - A*AINV ) / ( N * norm(A) * norm(AINV) * EPS ),
34 *> where EPS is the machine epsilon.
42 *> UPLO is CHARACTER*1
43 *> Specifies whether the upper or lower triangular part of the
44 *> Hermitian matrix A is stored:
45 *> = 'U': Upper triangular
46 *> = 'L': Lower triangular
52 *> The number of rows and columns of the matrix A. N >= 0.
57 *> A is COMPLEX*16 array, dimension (LDA,N)
58 *> The original Hermitian matrix A.
64 *> The leading dimension of the array A. LDA >= max(1,N)
67 *> \param[in,out] AINV
69 *> AINV is COMPLEX*16 array, dimension (LDAINV,N)
70 *> On entry, the inverse of the matrix A, stored as a Hermitian
71 *> matrix in the same format as A.
72 *> In this version, AINV is expanded into a full matrix and
73 *> multiplied by A, so the opposing triangle of AINV will be
74 *> changed; i.e., if the upper triangular part of AINV is
75 *> stored, the lower triangular part will be used as work space.
81 *> The leading dimension of the array AINV. LDAINV >= max(1,N).
86 *> WORK is COMPLEX*16 array, dimension (LDWORK,N)
92 *> The leading dimension of the array WORK. LDWORK >= max(1,N).
97 *> RWORK is DOUBLE PRECISION array, dimension (N)
102 *> RCOND is DOUBLE PRECISION
103 *> The reciprocal of the condition number of A, computed as
104 *> ( 1/norm(A) ) / norm(AINV).
109 *> RESID is DOUBLE PRECISION
110 *> norm(I - A*AINV) / ( N * norm(A) * norm(AINV) * EPS )
116 *> \author Univ. of Tennessee
117 *> \author Univ. of California Berkeley
118 *> \author Univ. of Colorado Denver
121 *> \date November 2011
123 *> \ingroup complex16_lin
125 * =====================================================================
126 SUBROUTINE ZPOT03( UPLO, N, A, LDA, AINV, LDAINV, WORK, LDWORK,
127 $ RWORK, RCOND, RESID )
129 * -- LAPACK test routine (version 3.4.0) --
130 * -- LAPACK is a software package provided by Univ. of Tennessee, --
131 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
134 * .. Scalar Arguments ..
136 INTEGER LDA, LDAINV, LDWORK, N
137 DOUBLE PRECISION RCOND, RESID
139 * .. Array Arguments ..
140 DOUBLE PRECISION RWORK( * )
141 COMPLEX*16 A( LDA, * ), AINV( LDAINV, * ),
145 * =====================================================================
148 DOUBLE PRECISION ZERO, ONE
149 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
150 COMPLEX*16 CZERO, CONE
151 PARAMETER ( CZERO = ( 0.0D+0, 0.0D+0 ),
152 $ CONE = ( 1.0D+0, 0.0D+0 ) )
154 * .. Local Scalars ..
156 DOUBLE PRECISION AINVNM, ANORM, EPS
158 * .. External Functions ..
160 DOUBLE PRECISION DLAMCH, ZLANGE, ZLANHE
161 EXTERNAL LSAME, DLAMCH, ZLANGE, ZLANHE
163 * .. External Subroutines ..
166 * .. Intrinsic Functions ..
167 INTRINSIC DBLE, DCONJG
169 * .. Executable Statements ..
171 * Quick exit if N = 0.
179 * Exit with RESID = 1/EPS if ANORM = 0 or AINVNM = 0.
181 EPS = DLAMCH( 'Epsilon' )
182 ANORM = ZLANHE( '1', UPLO, N, A, LDA, RWORK )
183 AINVNM = ZLANHE( '1', UPLO, N, AINV, LDAINV, RWORK )
184 IF( ANORM.LE.ZERO .OR. AINVNM.LE.ZERO ) THEN
189 RCOND = ( ONE / ANORM ) / AINVNM
191 * Expand AINV into a full matrix and call ZHEMM to multiply
192 * AINV on the left by A.
194 IF( LSAME( UPLO, 'U' ) ) THEN
197 AINV( J, I ) = DCONJG( AINV( I, J ) )
203 AINV( J, I ) = DCONJG( AINV( I, J ) )
207 CALL ZHEMM( 'Left', UPLO, N, N, -CONE, A, LDA, AINV, LDAINV,
208 $ CZERO, WORK, LDWORK )
210 * Add the identity matrix to WORK .
213 WORK( I, I ) = WORK( I, I ) + CONE
216 * Compute norm(I - A*AINV) / (N * norm(A) * norm(AINV) * EPS)
218 RESID = ZLANGE( '1', N, N, WORK, LDWORK, RWORK )
220 RESID = ( ( RESID*RCOND ) / EPS ) / DBLE( N )