LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ cpot03()

subroutine cpot03 ( character  UPLO,
integer  N,
complex, dimension( lda, * )  A,
integer  LDA,
complex, dimension( ldainv, * )  AINV,
integer  LDAINV,
complex, dimension( ldwork, * )  WORK,
integer  LDWORK,
real, dimension( * )  RWORK,
real  RCOND,
real  RESID 
)

CPOT03

Purpose:
 CPOT03 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 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 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 array, dimension (LDWORK,N)
[in]LDWORK
          LDWORK is INTEGER
          The leading dimension of the array WORK.  LDWORK >= max(1,N).
[out]RWORK
          RWORK is REAL array, dimension (N)
[out]RCOND
          RCOND is REAL
          The reciprocal of the condition number of A, computed as
          ( 1/norm(A) ) / norm(AINV).
[out]RESID
          RESID is REAL
          norm(I - A*AINV) / ( N * norm(A) * norm(AINV) * EPS )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
December 2016

Definition at line 128 of file cpot03.f.

128 *
129 * -- LAPACK test routine (version 3.7.0) --
130 * -- LAPACK is a software package provided by Univ. of Tennessee, --
131 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
132 * December 2016
133 *
134 * .. Scalar Arguments ..
135  CHARACTER uplo
136  INTEGER lda, ldainv, ldwork, n
137  REAL rcond, resid
138 * ..
139 * .. Array Arguments ..
140  REAL rwork( * )
141  COMPLEX a( lda, * ), ainv( ldainv, * ),
142  $ work( ldwork, * )
143 * ..
144 *
145 * =====================================================================
146 *
147 * .. Parameters ..
148  REAL zero, one
149  parameter( zero = 0.0e+0, one = 1.0e+0 )
150  COMPLEX czero, cone
151  parameter( czero = ( 0.0e+0, 0.0e+0 ),
152  $ cone = ( 1.0e+0, 0.0e+0 ) )
153 * ..
154 * .. Local Scalars ..
155  INTEGER i, j
156  REAL ainvnm, anorm, eps
157 * ..
158 * .. External Functions ..
159  LOGICAL lsame
160  REAL clange, clanhe, slamch
161  EXTERNAL lsame, clange, clanhe, slamch
162 * ..
163 * .. External Subroutines ..
164  EXTERNAL chemm
165 * ..
166 * .. Intrinsic Functions ..
167  INTRINSIC conjg, real
168 * ..
169 * .. Executable Statements ..
170 *
171 * Quick exit if N = 0.
172 *
173  IF( n.LE.0 ) THEN
174  rcond = one
175  resid = zero
176  RETURN
177  END IF
178 *
179 * Exit with RESID = 1/EPS if ANORM = 0 or AINVNM = 0.
180 *
181  eps = slamch( 'Epsilon' )
182  anorm = clanhe( '1', uplo, n, a, lda, rwork )
183  ainvnm = clanhe( '1', uplo, n, ainv, ldainv, rwork )
184  IF( anorm.LE.zero .OR. ainvnm.LE.zero ) THEN
185  rcond = zero
186  resid = one / eps
187  RETURN
188  END IF
189  rcond = ( one/anorm ) / ainvnm
190 *
191 * Expand AINV into a full matrix and call CHEMM to multiply
192 * AINV on the left by A.
193 *
194  IF( lsame( uplo, 'U' ) ) THEN
195  DO 20 j = 1, n
196  DO 10 i = 1, j - 1
197  ainv( j, i ) = conjg( ainv( i, j ) )
198  10 CONTINUE
199  20 CONTINUE
200  ELSE
201  DO 40 j = 1, n
202  DO 30 i = j + 1, n
203  ainv( j, i ) = conjg( ainv( i, j ) )
204  30 CONTINUE
205  40 CONTINUE
206  END IF
207  CALL chemm( 'Left', uplo, n, n, -cone, a, lda, ainv, ldainv,
208  $ czero, work, ldwork )
209 *
210 * Add the identity matrix to WORK .
211 *
212  DO 50 i = 1, n
213  work( i, i ) = work( i, i ) + cone
214  50 CONTINUE
215 *
216 * Compute norm(I - A*AINV) / (N * norm(A) * norm(AINV) * EPS)
217 *
218  resid = clange( '1', n, n, work, ldwork, rwork )
219 *
220  resid = ( ( resid*rcond )/eps ) / REAL( n )
221 *
222  RETURN
223 *
224 * End of CPOT03
225 *
subroutine chemm(SIDE, UPLO, M, N, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
CHEMM
Definition: chemm.f:193
real function clange(NORM, M, N, A, LDA, WORK)
CLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: clange.f:117
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
real function clanhe(NORM, UPLO, N, A, LDA, WORK)
CLANHE 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: clanhe.f:126
Here is the call graph for this function:
Here is the caller graph for this function: