LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ cpot02()

subroutine cpot02 ( character  uplo,
integer  n,
integer  nrhs,
complex, dimension( lda, * )  a,
integer  lda,
complex, dimension( ldx, * )  x,
integer  ldx,
complex, dimension( ldb, * )  b,
integer  ldb,
real, dimension( * )  rwork,
real  resid 
)

CPOT02

Purpose:
 CPOT02 computes the residual for the solution of a Hermitian system
 of linear equations  A*x = b:

    RESID = norm(B - A*X) / ( norm(A) * norm(X) * 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]NRHS
          NRHS is INTEGER
          The number of columns of B, the matrix of right hand sides.
          NRHS >= 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]X
          X is COMPLEX array, dimension (LDX,NRHS)
          The computed solution vectors for the system of linear
          equations.
[in]LDX
          LDX is INTEGER
          The leading dimension of the array X.   LDX >= max(1,N).
[in,out]B
          B is COMPLEX array, dimension (LDB,NRHS)
          On entry, the right hand side vectors for the system of
          linear equations.
          On exit, B is overwritten with the difference B - A*X.
[in]LDB
          LDB is INTEGER
          The leading dimension of the array B.  LDB >= max(1,N).
[out]RWORK
          RWORK is REAL array, dimension (N)
[out]RESID
          RESID is REAL
          The maximum over the number of right hand sides of
          norm(B - A*X) / ( norm(A) * norm(X) * EPS ).
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 125 of file cpot02.f.

127*
128* -- LAPACK test routine --
129* -- LAPACK is a software package provided by Univ. of Tennessee, --
130* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
131*
132* .. Scalar Arguments ..
133 CHARACTER UPLO
134 INTEGER LDA, LDB, LDX, N, NRHS
135 REAL RESID
136* ..
137* .. Array Arguments ..
138 REAL RWORK( * )
139 COMPLEX A( LDA, * ), B( LDB, * ), X( LDX, * )
140* ..
141*
142* =====================================================================
143*
144* .. Parameters ..
145 REAL ZERO, ONE
146 parameter( zero = 0.0e+0, one = 1.0e+0 )
147 COMPLEX CONE
148 parameter( cone = ( 1.0e+0, 0.0e+0 ) )
149* ..
150* .. Local Scalars ..
151 INTEGER J
152 REAL ANORM, BNORM, EPS, XNORM
153* ..
154* .. External Functions ..
155 REAL CLANHE, SCASUM, SLAMCH
156 EXTERNAL clanhe, scasum, slamch
157* ..
158* .. External Subroutines ..
159 EXTERNAL chemm
160* ..
161* .. Intrinsic Functions ..
162 INTRINSIC max
163* ..
164* .. Executable Statements ..
165*
166* Quick exit if N = 0 or NRHS = 0.
167*
168 IF( n.LE.0 .OR. nrhs.LE.0 ) THEN
169 resid = zero
170 RETURN
171 END IF
172*
173* Exit with RESID = 1/EPS if ANORM = 0.
174*
175 eps = slamch( 'Epsilon' )
176 anorm = clanhe( '1', uplo, n, a, lda, rwork )
177 IF( anorm.LE.zero ) THEN
178 resid = one / eps
179 RETURN
180 END IF
181*
182* Compute B - A*X
183*
184 CALL chemm( 'Left', uplo, n, nrhs, -cone, a, lda, x, ldx, cone, b,
185 $ ldb )
186*
187* Compute the maximum over the number of right hand sides of
188* norm( B - A*X ) / ( norm(A) * norm(X) * EPS ) .
189*
190 resid = zero
191 DO 10 j = 1, nrhs
192 bnorm = scasum( n, b( 1, j ), 1 )
193 xnorm = scasum( n, x( 1, j ), 1 )
194 IF( xnorm.LE.zero ) THEN
195 resid = one / eps
196 ELSE
197 resid = max( resid, ( ( bnorm/anorm )/xnorm )/eps )
198 END IF
199 10 CONTINUE
200*
201 RETURN
202*
203* End of CPOT02
204*
real function scasum(n, cx, incx)
SCASUM
Definition scasum.f:72
subroutine chemm(side, uplo, m, n, alpha, a, lda, b, ldb, beta, c, ldc)
CHEMM
Definition chemm.f:191
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
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,...
Definition clanhe.f:124
Here is the call graph for this function:
Here is the caller graph for this function: