LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine dget04 ( integer  N,
integer  NRHS,
double precision, dimension( ldx, * )  X,
integer  LDX,
double precision, dimension( ldxact, * )  XACT,
integer  LDXACT,
double precision  RCOND,
double precision  RESID 
)

DGET04

Purpose:
 DGET04 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 DOUBLE PRECISION 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 DOUBLE PRECISION 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
November 2011

Definition at line 104 of file dget04.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  DOUBLE PRECISION rcond, resid
113 * ..
114 * .. Array Arguments ..
115  DOUBLE PRECISION 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 * ..
128 * .. External Functions ..
129  INTEGER idamax
130  DOUBLE PRECISION dlamch
131  EXTERNAL idamax, dlamch
132 * ..
133 * .. Intrinsic Functions ..
134  INTRINSIC abs, max
135 * ..
136 * .. Executable Statements ..
137 *
138 * Quick exit if N = 0 or NRHS = 0.
139 *
140  IF( n.LE.0 .OR. nrhs.LE.0 ) THEN
141  resid = zero
142  RETURN
143  END IF
144 *
145 * Exit with RESID = 1/EPS if RCOND is invalid.
146 *
147  eps = dlamch( 'Epsilon' )
148  IF( rcond.LT.zero ) THEN
149  resid = 1.0d0 / eps
150  RETURN
151  END IF
152 *
153 * Compute the maximum of
154 * norm(X - XACT) / ( norm(XACT) * EPS )
155 * over all the vectors X and XACT .
156 *
157  resid = zero
158  DO 20 j = 1, nrhs
159  ix = idamax( n, xact( 1, j ), 1 )
160  xnorm = abs( xact( ix, j ) )
161  diffnm = zero
162  DO 10 i = 1, n
163  diffnm = max( diffnm, abs( x( i, j )-xact( i, j ) ) )
164  10 CONTINUE
165  IF( xnorm.LE.zero ) THEN
166  IF( diffnm.GT.zero )
167  $ resid = 1.0d0 / eps
168  ELSE
169  resid = max( resid, ( diffnm / xnorm )*rcond )
170  END IF
171  20 CONTINUE
172  IF( resid*eps.LT.1.0d0 )
173  $ resid = resid / eps
174 *
175  RETURN
176 *
177 * End of DGET04
178 *
integer function idamax(N, DX, INCX)
IDAMAX
Definition: idamax.f:53
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65

Here is the caller graph for this function: