LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine cget04 ( integer  N,
integer  NRHS,
complex, dimension( ldx, * )  X,
integer  LDX,
complex, dimension( ldxact, * )  XACT,
integer  LDXACT,
real  RCOND,
real  RESID 
)

CGET04

Purpose:
 CGET04 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 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 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 REAL
          The reciprocal of the condition number of the coefficient
          matrix in the system of equations.
[out]RESID
          RESID is REAL
          The maximum over the NRHS solution vectors of
          ( norm(X-XACT) * RCOND ) / ( norm(XACT) * EPS )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011

Definition at line 104 of file cget04.f.

104 *
105 * -- LAPACK test routine (version 3.4.0) --
106 * -- LAPACK is a software package provided by Univ. of Tennessee, --
107 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
108 * November 2011
109 *
110 * .. Scalar Arguments ..
111  INTEGER ldx, ldxact, n, nrhs
112  REAL rcond, resid
113 * ..
114 * .. Array Arguments ..
115  COMPLEX x( ldx, * ), xact( ldxact, * )
116 * ..
117 *
118 * =====================================================================
119 *
120 * .. Parameters ..
121  REAL zero
122  parameter ( zero = 0.0e+0 )
123 * ..
124 * .. Local Scalars ..
125  INTEGER i, ix, j
126  REAL diffnm, eps, xnorm
127  COMPLEX zdum
128 * ..
129 * .. External Functions ..
130  INTEGER icamax
131  REAL slamch
132  EXTERNAL icamax, slamch
133 * ..
134 * .. Intrinsic Functions ..
135  INTRINSIC abs, aimag, max, real
136 * ..
137 * .. Statement Functions ..
138  REAL cabs1
139 * ..
140 * .. Statement Function definitions ..
141  cabs1( zdum ) = abs( REAL( ZDUM ) ) + abs( aimag( zdum ) )
142 * ..
143 * .. Executable Statements ..
144 *
145 * Quick exit if N = 0 or NRHS = 0.
146 *
147  IF( n.LE.0 .OR. nrhs.LE.0 ) THEN
148  resid = zero
149  RETURN
150  END IF
151 *
152 * Exit with RESID = 1/EPS if RCOND is invalid.
153 *
154  eps = slamch( 'Epsilon' )
155  IF( rcond.LT.zero ) THEN
156  resid = 1.0 / eps
157  RETURN
158  END IF
159 *
160 * Compute the maximum of
161 * norm(X - XACT) / ( norm(XACT) * EPS )
162 * over all the vectors X and XACT .
163 *
164  resid = zero
165  DO 20 j = 1, nrhs
166  ix = icamax( n, xact( 1, j ), 1 )
167  xnorm = cabs1( xact( ix, j ) )
168  diffnm = zero
169  DO 10 i = 1, n
170  diffnm = max( diffnm, cabs1( x( i, j )-xact( i, j ) ) )
171  10 CONTINUE
172  IF( xnorm.LE.zero ) THEN
173  IF( diffnm.GT.zero )
174  $ resid = 1.0 / eps
175  ELSE
176  resid = max( resid, ( diffnm / xnorm )*rcond )
177  END IF
178  20 CONTINUE
179  IF( resid*eps.LT.1.0 )
180  $ resid = resid / eps
181 *
182  RETURN
183 *
184 * End of CGET04
185 *
integer function icamax(N, CX, INCX)
ICAMAX
Definition: icamax.f:53
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69

Here is the caller graph for this function: