LAPACK  3.8.0
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 )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
December 2016

Definition at line 104 of file zget04.f.

104 *
105 * -- LAPACK test routine (version 3.7.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 * December 2016
109 *
110 * .. Scalar Arguments ..
111  INTEGER ldx, ldxact, n, nrhs
112  DOUBLE PRECISION rcond, resid
113 * ..
114 * .. Array Arguments ..
115  COMPLEX*16 x( ldx, * ), xact( ldxact, * )
116 * ..
117 *
118 * =====================================================================
119 *
120 * .. Parameters ..
121  DOUBLE PRECISION zero
122  parameter( zero = 0.0d+0 )
123 * ..
124 * .. Local Scalars ..
125  INTEGER i, ix, j
126  DOUBLE PRECISION diffnm, eps, xnorm
127  COMPLEX*16 zdum
128 * ..
129 * .. External Functions ..
130  INTEGER izamax
131  DOUBLE PRECISION dlamch
132  EXTERNAL izamax, dlamch
133 * ..
134 * .. Intrinsic Functions ..
135  INTRINSIC abs, dble, dimag, max
136 * ..
137 * .. Statement Functions ..
138  DOUBLE PRECISION cabs1
139 * ..
140 * .. Statement Function definitions ..
141  cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( 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 = dlamch( 'Epsilon' )
155  IF( rcond.LT.zero ) THEN
156  resid = 1.0d0 / 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 = izamax( 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.0d0 / eps
175  ELSE
176  resid = max( resid, ( diffnm / xnorm )*rcond )
177  END IF
178  20 CONTINUE
179  IF( resid*eps.LT.1.0d0 )
180  $ resid = resid / eps
181 *
182  RETURN
183 *
184 * End of ZGET04
185 *
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
integer function izamax(N, ZX, INCX)
IZAMAX
Definition: izamax.f:73
Here is the caller graph for this function: