 LAPACK 3.11.0 LAPACK: Linear Algebra PACKage
Searching...
No Matches

## ◆ cget02()

 subroutine cget02 ( character TRANS, integer M, 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 )

CGET02

Purpose:
``` CGET02 computes the residual for a solution of a system of linear
equations op(A)*X = B:
RESID = norm(B - op(A)*X) / ( norm(op(A)) * norm(X) * EPS ),
where op(A) = A, A**T, or A**H, depending on TRANS, and EPS is the
machine epsilon.```
Parameters
 [in] TRANS ``` TRANS is CHARACTER*1 Specifies the form of the system of equations: = 'N': A * X = B (No transpose) = 'T': A**T * X = B (Transpose) = 'C': A**H * X = B (Conjugate transpose)``` [in] M ``` M is INTEGER The number of rows of the matrix A. M >= 0.``` [in] N ``` N is INTEGER The number of 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 M x N matrix A.``` [in] LDA ``` LDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).``` [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. If TRANS = 'N', LDX >= max(1,N); if TRANS = 'T' or 'C', LDX >= max(1,M).``` [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 - op(A)*X.``` [in] LDB ``` LDB is INTEGER The leading dimension of the array B. IF TRANS = 'N', LDB >= max(1,M); if TRANS = 'T' or 'C', LDB >= max(1,N).``` [out] RWORK ` RWORK is REAL array, dimension (M)` [out] RESID ``` RESID is REAL The maximum over the number of right hand sides of norm(B - op(A)*X) / ( norm(op(A)) * norm(X) * EPS ).```

Definition at line 132 of file cget02.f.

134*
135* -- LAPACK test routine --
136* -- LAPACK is a software package provided by Univ. of Tennessee, --
137* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
138*
139* .. Scalar Arguments ..
140 CHARACTER TRANS
141 INTEGER LDA, LDB, LDX, M, N, NRHS
142 REAL RESID
143* ..
144* .. Array Arguments ..
145 REAL RWORK( * )
146 COMPLEX A( LDA, * ), B( LDB, * ), X( LDX, * )
147* ..
148*
149* =====================================================================
150*
151* .. Parameters ..
152 REAL ZERO, ONE
153 parameter( zero = 0.0e+0, one = 1.0e+0 )
154 COMPLEX CONE
155 parameter( cone = ( 1.0e+0, 0.0e+0 ) )
156* ..
157* .. Local Scalars ..
158 INTEGER J, N1, N2
159 REAL ANORM, BNORM, EPS, XNORM
160* ..
161* .. External Functions ..
162 LOGICAL LSAME
163 REAL CLANGE, SCASUM, SLAMCH
164 EXTERNAL lsame, clange, scasum, slamch
165* ..
166* .. External Subroutines ..
167 EXTERNAL cgemm
168* ..
169* .. Intrinsic Functions ..
170 INTRINSIC max
171* ..
172* .. Executable Statements ..
173*
174* Quick exit if M = 0 or N = 0 or NRHS = 0
175*
176 IF( m.LE.0 .OR. n.LE.0 .OR. nrhs.EQ.0 ) THEN
177 resid = zero
178 RETURN
179 END IF
180*
181 IF( lsame( trans, 'T' ) .OR. lsame( trans, 'C' ) ) THEN
182 n1 = n
183 n2 = m
184 ELSE
185 n1 = m
186 n2 = n
187 END IF
188*
189* Exit with RESID = 1/EPS if ANORM = 0.
190*
191 eps = slamch( 'Epsilon' )
192 IF( lsame( trans, 'N' ) ) THEN
193 anorm = clange( '1', m, n, a, lda, rwork )
194 ELSE
195 anorm = clange( 'I', m, n, a, lda, rwork )
196 END IF
197 IF( anorm.LE.zero ) THEN
198 resid = one / eps
199 RETURN
200 END IF
201*
202* Compute B - op(A)*X and store in B.
203*
204 CALL cgemm( trans, 'No transpose', n1, nrhs, n2, -cone, a, lda, x,
205 \$ ldx, cone, b, ldb )
206*
207* Compute the maximum over the number of right hand sides of
208* norm(B - op(A)*X) / ( norm(op(A)) * norm(X) * EPS ) .
209*
210 resid = zero
211 DO 10 j = 1, nrhs
212 bnorm = scasum( n1, b( 1, j ), 1 )
213 xnorm = scasum( n2, x( 1, j ), 1 )
214 IF( xnorm.LE.zero ) THEN
215 resid = one / eps
216 ELSE
217 resid = max( resid, ( ( bnorm/anorm )/xnorm )/eps )
218 END IF
219 10 CONTINUE
220*
221 RETURN
222*
223* End of CGET02
224*
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
subroutine cgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
CGEMM
Definition: cgemm.f:187
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:115
real function scasum(N, CX, INCX)
SCASUM
Definition: scasum.f:72
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:68
Here is the call graph for this function: