 LAPACK  3.10.1 LAPACK: Linear Algebra PACKage

## ◆ zget04()

 subroutine zget04 ( integer N, integer NRHS, complex*16, dimension( ldx, * ) X, integer LDX, complex*16, dimension( ldxact, * ) XACT, integer LDXACT, double precision RCOND, double precision RESID )

ZGET04

Purpose:
``` ZGET04 computes the difference between a computed solution and the
true solution to a system of linear equations.

RESID =  ( norm(X-XACT) * RCOND ) / ( norm(XACT) * EPS ),
where RCOND is the reciprocal of the condition number and EPS is the
machine epsilon.```
Parameters
 [in] N ``` N is INTEGER The number of rows of the matrices X and XACT. N >= 0.``` [in] NRHS ``` NRHS is INTEGER The number of columns of the matrices X and XACT. NRHS >= 0.``` [in] X ``` X is COMPLEX*16 array, dimension (LDX,NRHS) The computed solution vectors. Each vector is stored as a column of the matrix X.``` [in] LDX ``` LDX is INTEGER The leading dimension of the array X. LDX >= max(1,N).``` [in] XACT ``` XACT is COMPLEX*16 array, dimension (LDX,NRHS) The exact solution vectors. Each vector is stored as a column of the matrix XACT.``` [in] LDXACT ``` LDXACT is INTEGER The leading dimension of the array XACT. LDXACT >= max(1,N).``` [in] RCOND ``` RCOND is DOUBLE PRECISION The reciprocal of the condition number of the coefficient matrix in the system of equations.``` [out] RESID ``` RESID is DOUBLE PRECISION The maximum over the NRHS solution vectors of ( norm(X-XACT) * RCOND ) / ( norm(XACT) * EPS )```

Definition at line 101 of file zget04.f.

102 *
103 * -- LAPACK test routine --
104 * -- LAPACK is a software package provided by Univ. of Tennessee, --
105 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
106 *
107 * .. Scalar Arguments ..
108  INTEGER LDX, LDXACT, N, NRHS
109  DOUBLE PRECISION RCOND, RESID
110 * ..
111 * .. Array Arguments ..
112  COMPLEX*16 X( LDX, * ), XACT( LDXACT, * )
113 * ..
114 *
115 * =====================================================================
116 *
117 * .. Parameters ..
118  DOUBLE PRECISION ZERO
119  parameter( zero = 0.0d+0 )
120 * ..
121 * .. Local Scalars ..
122  INTEGER I, IX, J
123  DOUBLE PRECISION DIFFNM, EPS, XNORM
124  COMPLEX*16 ZDUM
125 * ..
126 * .. External Functions ..
127  INTEGER IZAMAX
128  DOUBLE PRECISION DLAMCH
129  EXTERNAL izamax, dlamch
130 * ..
131 * .. Intrinsic Functions ..
132  INTRINSIC abs, dble, dimag, max
133 * ..
134 * .. Statement Functions ..
135  DOUBLE PRECISION CABS1
136 * ..
137 * .. Statement Function definitions ..
138  cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( zdum ) )
139 * ..
140 * .. Executable Statements ..
141 *
142 * Quick exit if N = 0 or NRHS = 0.
143 *
144  IF( n.LE.0 .OR. nrhs.LE.0 ) THEN
145  resid = zero
146  RETURN
147  END IF
148 *
149 * Exit with RESID = 1/EPS if RCOND is invalid.
150 *
151  eps = dlamch( 'Epsilon' )
152  IF( rcond.LT.zero ) THEN
153  resid = 1.0d0 / eps
154  RETURN
155  END IF
156 *
157 * Compute the maximum of
158 * norm(X - XACT) / ( norm(XACT) * EPS )
159 * over all the vectors X and XACT .
160 *
161  resid = zero
162  DO 20 j = 1, nrhs
163  ix = izamax( n, xact( 1, j ), 1 )
164  xnorm = cabs1( xact( ix, j ) )
165  diffnm = zero
166  DO 10 i = 1, n
167  diffnm = max( diffnm, cabs1( x( i, j )-xact( i, j ) ) )
168  10 CONTINUE
169  IF( xnorm.LE.zero ) THEN
170  IF( diffnm.GT.zero )
171  \$ resid = 1.0d0 / eps
172  ELSE
173  resid = max( resid, ( diffnm / xnorm )*rcond )
174  END IF
175  20 CONTINUE
176  IF( resid*eps.LT.1.0d0 )
177  \$ resid = resid / eps
178 *
179  RETURN
180 *
181 * End of ZGET04
182 *
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:69
integer function izamax(N, ZX, INCX)
IZAMAX
Definition: izamax.f:71
Here is the caller graph for this function: