LAPACK  3.10.1
LAPACK: Linear Algebra PACKage

◆ zpot03()

subroutine zpot03 ( character  UPLO,
integer  N,
complex*16, dimension( lda, * )  A,
integer  LDA,
complex*16, dimension( ldainv, * )  AINV,
integer  LDAINV,
complex*16, dimension( ldwork, * )  WORK,
integer  LDWORK,
double precision, dimension( * )  RWORK,
double precision  RCOND,
double precision  RESID 
)

ZPOT03

Purpose:
 ZPOT03 computes the residual for a Hermitian matrix times its
 inverse:
    norm( I - A*AINV ) / ( N * norm(A) * norm(AINV) * EPS ),
 where 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,out]AINV
          AINV is COMPLEX*16 array, dimension (LDAINV,N)
          On entry, the inverse of the matrix A, stored as a Hermitian
          matrix in the same format as A.
          In this version, AINV is expanded into a full matrix and
          multiplied by A, so the opposing triangle of AINV will be
          changed; i.e., if the upper triangular part of AINV is
          stored, the lower triangular part will be used as work space.
[in]LDAINV
          LDAINV is INTEGER
          The leading dimension of the array AINV.  LDAINV >= max(1,N).
[out]WORK
          WORK is COMPLEX*16 array, dimension (LDWORK,N)
[in]LDWORK
          LDWORK is INTEGER
          The leading dimension of the array WORK.  LDWORK >= max(1,N).
[out]RWORK
          RWORK is DOUBLE PRECISION array, dimension (N)
[out]RCOND
          RCOND is DOUBLE PRECISION
          The reciprocal of the condition number of A, computed as
          ( 1/norm(A) ) / norm(AINV).
[out]RESID
          RESID is DOUBLE PRECISION
          norm(I - A*AINV) / ( N * norm(A) * norm(AINV) * EPS )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 124 of file zpot03.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, LDAINV, LDWORK, N
134  DOUBLE PRECISION RCOND, RESID
135 * ..
136 * .. Array Arguments ..
137  DOUBLE PRECISION RWORK( * )
138  COMPLEX*16 A( LDA, * ), AINV( LDAINV, * ),
139  $ WORK( LDWORK, * )
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, J
153  DOUBLE PRECISION AINVNM, ANORM, EPS
154 * ..
155 * .. External Functions ..
156  LOGICAL LSAME
157  DOUBLE PRECISION DLAMCH, ZLANGE, ZLANHE
158  EXTERNAL lsame, dlamch, zlange, zlanhe
159 * ..
160 * .. External Subroutines ..
161  EXTERNAL zhemm
162 * ..
163 * .. Intrinsic Functions ..
164  INTRINSIC dble, dconjg
165 * ..
166 * .. Executable Statements ..
167 *
168 * Quick exit if N = 0.
169 *
170  IF( n.LE.0 ) THEN
171  rcond = one
172  resid = zero
173  RETURN
174  END IF
175 *
176 * Exit with RESID = 1/EPS if ANORM = 0 or AINVNM = 0.
177 *
178  eps = dlamch( 'Epsilon' )
179  anorm = zlanhe( '1', uplo, n, a, lda, rwork )
180  ainvnm = zlanhe( '1', uplo, n, ainv, ldainv, rwork )
181  IF( anorm.LE.zero .OR. ainvnm.LE.zero ) THEN
182  rcond = zero
183  resid = one / eps
184  RETURN
185  END IF
186  rcond = ( one / anorm ) / ainvnm
187 *
188 * Expand AINV into a full matrix and call ZHEMM to multiply
189 * AINV on the left by A.
190 *
191  IF( lsame( uplo, 'U' ) ) THEN
192  DO 20 j = 1, n
193  DO 10 i = 1, j - 1
194  ainv( j, i ) = dconjg( ainv( i, j ) )
195  10 CONTINUE
196  20 CONTINUE
197  ELSE
198  DO 40 j = 1, n
199  DO 30 i = j + 1, n
200  ainv( j, i ) = dconjg( ainv( i, j ) )
201  30 CONTINUE
202  40 CONTINUE
203  END IF
204  CALL zhemm( 'Left', uplo, n, n, -cone, a, lda, ainv, ldainv,
205  $ czero, work, ldwork )
206 *
207 * Add the identity matrix to WORK .
208 *
209  DO 50 i = 1, n
210  work( i, i ) = work( i, i ) + cone
211  50 CONTINUE
212 *
213 * Compute norm(I - A*AINV) / (N * norm(A) * norm(AINV) * EPS)
214 *
215  resid = zlange( '1', n, n, work, ldwork, rwork )
216 *
217  resid = ( ( resid*rcond ) / eps ) / dble( n )
218 *
219  RETURN
220 *
221 * End of ZPOT03
222 *
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:69
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
subroutine zhemm(SIDE, UPLO, M, N, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
ZHEMM
Definition: zhemm.f:191
double precision function zlange(NORM, M, N, A, LDA, WORK)
ZLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: zlange.f:115
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
Here is the call graph for this function:
Here is the caller graph for this function: