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

◆ zget08()

subroutine zget08 ( character trans,
integer m,
integer n,
integer nrhs,
complex*16, dimension( lda, * ) a,
integer lda,
complex*16, dimension( ldx, * ) x,
integer ldx,
complex*16, dimension( ldb, * ) b,
integer ldb,
double precision, dimension( * ) rwork,
double precision resid )

ZGET08

Purpose:
!>
!> ZGET08 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*16 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*16 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*16 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 DOUBLE PRECISION array, dimension (M)
!> 
[out]RESID
!>          RESID is DOUBLE PRECISION
!>          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 131 of file zget08.f.

133*
134* -- LAPACK test routine --
135* -- LAPACK is a software package provided by Univ. of Tennessee, --
136* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
137*
138* .. Scalar Arguments ..
139 CHARACTER TRANS
140 INTEGER LDA, LDB, LDX, M, N, NRHS
141 DOUBLE PRECISION RESID
142* ..
143* .. Array Arguments ..
144 DOUBLE PRECISION RWORK( * )
145 COMPLEX*16 A( LDA, * ), B( LDB, * ), X( LDX, * )
146* ..
147*
148* =====================================================================
149*
150* .. Parameters ..
151 DOUBLE PRECISION ZERO, ONE
152 parameter( zero = 0.0d+0, one = 1.0d+0 )
153 COMPLEX*16 CONE
154 parameter( cone = ( 1.0d+0, 0.0d+0 ) )
155* ..
156* .. Local Scalars ..
157 INTEGER J, N1, N2
158 DOUBLE PRECISION ANORM, BNORM, EPS, XNORM
159 COMPLEX*16 ZDUM
160* ..
161* .. External Functions ..
162 LOGICAL LSAME
163 INTEGER IZAMAX
164 DOUBLE PRECISION DLAMCH, ZLANGE
165 EXTERNAL lsame, izamax, dlamch, zlange
166* ..
167* .. External Subroutines ..
168 EXTERNAL zgemm
169* ..
170* .. Intrinsic Functions ..
171 INTRINSIC abs, dble, dimag, max
172* ..
173* .. Statement Functions ..
174 DOUBLE PRECISION CABS1
175* ..
176* .. Statement Function definitions ..
177 cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( zdum ) )
178* ..
179* .. Executable Statements ..
180*
181* Quick exit if M = 0 or N = 0 or NRHS = 0
182*
183 IF( m.LE.0 .OR. n.LE.0 .OR. nrhs.EQ.0 ) THEN
184 resid = zero
185 RETURN
186 END IF
187*
188 IF( lsame( trans, 'T' ) .OR. lsame( trans, 'C' ) ) THEN
189 n1 = n
190 n2 = m
191 ELSE
192 n1 = m
193 n2 = n
194 END IF
195*
196* Exit with RESID = 1/EPS if ANORM = 0.
197*
198 eps = dlamch( 'Epsilon' )
199 anorm = zlange( 'I', n1, n2, a, lda, rwork )
200 IF( anorm.LE.zero ) THEN
201 resid = one / eps
202 RETURN
203 END IF
204*
205* Compute B - A*X (or B - A'*X ) and store in B.
206*
207 CALL zgemm( trans, 'No transpose', n1, nrhs, n2, -cone, a, lda, x,
208 $ ldx, cone, b, ldb )
209*
210* Compute the maximum over the number of right hand sides of
211* norm(B - A*X) / ( norm(A) * norm(X) * EPS ) .
212*
213 resid = zero
214 DO 10 j = 1, nrhs
215 bnorm = cabs1( b( izamax( n1, b( 1, j ), 1 ), j ) )
216 xnorm = cabs1( x( izamax( n2, x( 1, j ), 1 ), j ) )
217 IF( xnorm.LE.zero ) THEN
218 resid = one / eps
219 ELSE
220 resid = max( resid, ( ( bnorm / anorm ) / xnorm ) / eps )
221 END IF
222 10 CONTINUE
223*
224 RETURN
225*
226* End of ZGET08
227*
subroutine zgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
ZGEMM
Definition zgemm.f:188
integer function izamax(n, zx, incx)
IZAMAX
Definition izamax.f:71
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69
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:113
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
Here is the call graph for this function:
Here is the caller graph for this function: