 LAPACK  3.8.0 LAPACK: Linear Algebra PACKage

## ◆ 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  A*x = b  or  A'*x = b:
RESID = norm(B - A*X) / ( norm(A) * norm(X) * EPS ),
where EPS is the machine epsilon.```
Parameters
 [in] TRANS ``` TRANS is CHARACTER*1 Specifies the form of the system of equations: = 'N': A *x = b = 'T': A^T*x = b, where A^T is the transpose of A = 'C': A^H*x = b, where A^H is the conjugate transpose of A``` [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 - 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 - A*X) / ( norm(A) * norm(X) * EPS ).```
Date
June 2017

Definition at line 135 of file cget02.f.

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