LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine sget07 ( character  TRANS,
integer  N,
integer  NRHS,
real, dimension( lda, * )  A,
integer  LDA,
real, dimension( ldb, * )  B,
integer  LDB,
real, dimension( ldx, * )  X,
integer  LDX,
real, dimension( ldxact, * )  XACT,
integer  LDXACT,
real, dimension( * )  FERR,
logical  CHKFERR,
real, dimension( * )  BERR,
real, dimension( * )  RESLTS 
)

SGET07

Purpose:
 SGET07 tests the error bounds from iterative refinement for the
 computed solution to a system of equations op(A)*X = B, where A is a
 general n by n matrix and op(A) = A or A**T, depending on TRANS.

 RESLTS(1) = test of the error bound
           = norm(X - XACT) / ( norm(X) * FERR )

 A large value is returned if this ratio is not less than one.

 RESLTS(2) = residual from the iterative refinement routine
           = the maximum of BERR / ( (n+1)*EPS + (*) ), where
             (*) = (n+1)*UNFL / (min_i (abs(op(A))*abs(X) +abs(b))_i )
Parameters
[in]TRANS
          TRANS is CHARACTER*1
          Specifies the form of the system of equations.
          = 'N':  A * X = B     (No transpose)
          = 'T':  A**T * X = B  (Transpose)
          = 'C':  A**H * X = B  (Conjugate transpose = Transpose)
[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]A
          A is REAL array, dimension (LDA,N)
          The original n by n matrix A.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N).
[in]B
          B is REAL array, dimension (LDB,NRHS)
          The right hand side vectors for the system of linear
          equations.
[in]LDB
          LDB is INTEGER
          The leading dimension of the array B.  LDB >= max(1,N).
[in]X
          X is REAL 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 REAL 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]FERR
          FERR is REAL array, dimension (NRHS)
          The estimated forward error bounds for each solution vector
          X.  If XTRUE is the true solution, FERR bounds the magnitude
          of the largest entry in (X - XTRUE) divided by the magnitude
          of the largest entry in X.
[in]CHKFERR
          CHKFERR is LOGICAL
          Set to .TRUE. to check FERR, .FALSE. not to check FERR.
          When the test system is ill-conditioned, the "true"
          solution in XACT may be incorrect.
[in]BERR
          BERR is REAL array, dimension (NRHS)
          The componentwise relative backward error of each solution
          vector (i.e., the smallest relative change in any entry of A
          or B that makes X an exact solution).
[out]RESLTS
          RESLTS is REAL array, dimension (2)
          The maximum over the NRHS solution vectors of the ratios:
          RESLTS(1) = norm(X - XACT) / ( norm(X) * FERR )
          RESLTS(2) = BERR / ( (n+1)*EPS + (*) )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011

Definition at line 167 of file sget07.f.

167 *
168 * -- LAPACK test routine (version 3.4.0) --
169 * -- LAPACK is a software package provided by Univ. of Tennessee, --
170 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
171 * November 2011
172 *
173 * .. Scalar Arguments ..
174  CHARACTER trans
175  LOGICAL chkferr
176  INTEGER lda, ldb, ldx, ldxact, n, nrhs
177 * ..
178 * .. Array Arguments ..
179  REAL a( lda, * ), b( ldb, * ), berr( * ), ferr( * ),
180  $ reslts( * ), x( ldx, * ), xact( ldxact, * )
181 * ..
182 *
183 * =====================================================================
184 *
185 * .. Parameters ..
186  REAL zero, one
187  parameter ( zero = 0.0e+0, one = 1.0e+0 )
188 * ..
189 * .. Local Scalars ..
190  LOGICAL notran
191  INTEGER i, imax, j, k
192  REAL axbi, diff, eps, errbnd, ovfl, tmp, unfl, xnorm
193 * ..
194 * .. External Functions ..
195  LOGICAL lsame
196  INTEGER isamax
197  REAL slamch
198  EXTERNAL lsame, isamax, slamch
199 * ..
200 * .. Intrinsic Functions ..
201  INTRINSIC abs, max, min
202 * ..
203 * .. Executable Statements ..
204 *
205 * Quick exit if N = 0 or NRHS = 0.
206 *
207  IF( n.LE.0 .OR. nrhs.LE.0 ) THEN
208  reslts( 1 ) = zero
209  reslts( 2 ) = zero
210  RETURN
211  END IF
212 *
213  eps = slamch( 'Epsilon' )
214  unfl = slamch( 'Safe minimum' )
215  ovfl = one / unfl
216  notran = lsame( trans, 'N' )
217 *
218 * Test 1: Compute the maximum of
219 * norm(X - XACT) / ( norm(X) * FERR )
220 * over all the vectors X and XACT using the infinity-norm.
221 *
222  errbnd = zero
223  IF( chkferr ) THEN
224  DO 30 j = 1, nrhs
225  imax = isamax( n, x( 1, j ), 1 )
226  xnorm = max( abs( x( imax, j ) ), unfl )
227  diff = zero
228  DO 10 i = 1, n
229  diff = max( diff, abs( x( i, j )-xact( i, j ) ) )
230  10 CONTINUE
231 *
232  IF( xnorm.GT.one ) THEN
233  GO TO 20
234  ELSE IF( diff.LE.ovfl*xnorm ) THEN
235  GO TO 20
236  ELSE
237  errbnd = one / eps
238  GO TO 30
239  END IF
240 *
241  20 CONTINUE
242  IF( diff / xnorm.LE.ferr( j ) ) THEN
243  errbnd = max( errbnd, ( diff / xnorm ) / ferr( j ) )
244  ELSE
245  errbnd = one / eps
246  END IF
247  30 CONTINUE
248  END IF
249  reslts( 1 ) = errbnd
250 *
251 * Test 2: Compute the maximum of BERR / ( (n+1)*EPS + (*) ), where
252 * (*) = (n+1)*UNFL / (min_i (abs(op(A))*abs(X) +abs(b))_i )
253 *
254  DO 70 k = 1, nrhs
255  DO 60 i = 1, n
256  tmp = abs( b( i, k ) )
257  IF( notran ) THEN
258  DO 40 j = 1, n
259  tmp = tmp + abs( a( i, j ) )*abs( x( j, k ) )
260  40 CONTINUE
261  ELSE
262  DO 50 j = 1, n
263  tmp = tmp + abs( a( j, i ) )*abs( x( j, k ) )
264  50 CONTINUE
265  END IF
266  IF( i.EQ.1 ) THEN
267  axbi = tmp
268  ELSE
269  axbi = min( axbi, tmp )
270  END IF
271  60 CONTINUE
272  tmp = berr( k ) / ( ( n+1 )*eps+( n+1 )*unfl /
273  $ max( axbi, ( n+1 )*unfl ) )
274  IF( k.EQ.1 ) THEN
275  reslts( 2 ) = tmp
276  ELSE
277  reslts( 2 ) = max( reslts( 2 ), tmp )
278  END IF
279  70 CONTINUE
280 *
281  RETURN
282 *
283 * End of SGET07
284 *
integer function isamax(N, SX, INCX)
ISAMAX
Definition: isamax.f:53
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55

Here is the caller graph for this function: