LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ 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.
Date
December 2016

Definition at line 135 of file zget08.f.

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