LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine strt05 ( character  UPLO,
character  TRANS,
character  DIAG,
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,
real, dimension( * )  BERR,
real, dimension( * )  RESLTS 
)

STRT05

Purpose:
 STRT05 tests the error bounds from iterative refinement for the
 computed solution to a system of equations A*X = B, where A is a
 triangular n by n matrix.

 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(A)*abs(X) +abs(b))_i )
Parameters
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the matrix A is upper or lower triangular.
          = 'U':  Upper triangular
          = 'L':  Lower triangular
[in]TRANS
          TRANS is CHARACTER*1
          Specifies the form of the system of equations.
          = 'N':  A * X = B  (No transpose)
          = 'T':  A'* X = B  (Transpose)
          = 'C':  A'* X = B  (Conjugate transpose = Transpose)
[in]DIAG
          DIAG is CHARACTER*1
          Specifies whether or not the matrix A is unit triangular.
          = 'N':  Non-unit triangular
          = 'U':  Unit triangular
[in]N
          N is INTEGER
          The number of rows of the matrices X, B, and XACT, and the
          order of the matrix A.  N >= 0.
[in]NRHS
          NRHS is INTEGER
          The number of columns of the matrices X, B, and XACT.
          NRHS >= 0.
[in]A
          A is REAL array, dimension (LDA,N)
          The triangular matrix A.  If UPLO = 'U', the leading n by n
          upper triangular part of the array A contains the upper
          triangular matrix, and the strictly lower triangular part of
          A is not referenced.  If UPLO = 'L', the leading n by n lower
          triangular part of the array A contains the lower triangular
          matrix, and the strictly upper triangular part of A is not
          referenced.  If DIAG = 'U', the diagonal elements of A are
          also not referenced and are assumed to be 1.
[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]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 183 of file strt05.f.

183 *
184 * -- LAPACK test routine (version 3.4.0) --
185 * -- LAPACK is a software package provided by Univ. of Tennessee, --
186 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
187 * November 2011
188 *
189 * .. Scalar Arguments ..
190  CHARACTER diag, trans, uplo
191  INTEGER lda, ldb, ldx, ldxact, n, nrhs
192 * ..
193 * .. Array Arguments ..
194  REAL a( lda, * ), b( ldb, * ), berr( * ), ferr( * ),
195  $ reslts( * ), x( ldx, * ), xact( ldxact, * )
196 * ..
197 *
198 * =====================================================================
199 *
200 * .. Parameters ..
201  REAL zero, one
202  parameter ( zero = 0.0e+0, one = 1.0e+0 )
203 * ..
204 * .. Local Scalars ..
205  LOGICAL notran, unit, upper
206  INTEGER i, ifu, imax, j, k
207  REAL axbi, diff, eps, errbnd, ovfl, tmp, unfl, xnorm
208 * ..
209 * .. External Functions ..
210  LOGICAL lsame
211  INTEGER isamax
212  REAL slamch
213  EXTERNAL lsame, isamax, slamch
214 * ..
215 * .. Intrinsic Functions ..
216  INTRINSIC abs, max, min
217 * ..
218 * .. Executable Statements ..
219 *
220 * Quick exit if N = 0 or NRHS = 0.
221 *
222  IF( n.LE.0 .OR. nrhs.LE.0 ) THEN
223  reslts( 1 ) = zero
224  reslts( 2 ) = zero
225  RETURN
226  END IF
227 *
228  eps = slamch( 'Epsilon' )
229  unfl = slamch( 'Safe minimum' )
230  ovfl = one / unfl
231  upper = lsame( uplo, 'U' )
232  notran = lsame( trans, 'N' )
233  unit = lsame( diag, 'U' )
234 *
235 * Test 1: Compute the maximum of
236 * norm(X - XACT) / ( norm(X) * FERR )
237 * over all the vectors X and XACT using the infinity-norm.
238 *
239  errbnd = zero
240  DO 30 j = 1, nrhs
241  imax = isamax( n, x( 1, j ), 1 )
242  xnorm = max( abs( x( imax, j ) ), unfl )
243  diff = zero
244  DO 10 i = 1, n
245  diff = max( diff, abs( x( i, j )-xact( i, j ) ) )
246  10 CONTINUE
247 *
248  IF( xnorm.GT.one ) THEN
249  GO TO 20
250  ELSE IF( diff.LE.ovfl*xnorm ) THEN
251  GO TO 20
252  ELSE
253  errbnd = one / eps
254  GO TO 30
255  END IF
256 *
257  20 CONTINUE
258  IF( diff / xnorm.LE.ferr( j ) ) THEN
259  errbnd = max( errbnd, ( diff / xnorm ) / ferr( j ) )
260  ELSE
261  errbnd = one / eps
262  END IF
263  30 CONTINUE
264  reslts( 1 ) = errbnd
265 *
266 * Test 2: Compute the maximum of BERR / ( (n+1)*EPS + (*) ), where
267 * (*) = (n+1)*UNFL / (min_i (abs(A)*abs(X) +abs(b))_i )
268 *
269  ifu = 0
270  IF( unit )
271  $ ifu = 1
272  DO 90 k = 1, nrhs
273  DO 80 i = 1, n
274  tmp = abs( b( i, k ) )
275  IF( upper ) THEN
276  IF( .NOT.notran ) THEN
277  DO 40 j = 1, i - ifu
278  tmp = tmp + abs( a( j, i ) )*abs( x( j, k ) )
279  40 CONTINUE
280  IF( unit )
281  $ tmp = tmp + abs( x( i, k ) )
282  ELSE
283  IF( unit )
284  $ tmp = tmp + abs( x( i, k ) )
285  DO 50 j = i + ifu, n
286  tmp = tmp + abs( a( i, j ) )*abs( x( j, k ) )
287  50 CONTINUE
288  END IF
289  ELSE
290  IF( notran ) THEN
291  DO 60 j = 1, i - ifu
292  tmp = tmp + abs( a( i, j ) )*abs( x( j, k ) )
293  60 CONTINUE
294  IF( unit )
295  $ tmp = tmp + abs( x( i, k ) )
296  ELSE
297  IF( unit )
298  $ tmp = tmp + abs( x( i, k ) )
299  DO 70 j = i + ifu, n
300  tmp = tmp + abs( a( j, i ) )*abs( x( j, k ) )
301  70 CONTINUE
302  END IF
303  END IF
304  IF( i.EQ.1 ) THEN
305  axbi = tmp
306  ELSE
307  axbi = min( axbi, tmp )
308  END IF
309  80 CONTINUE
310  tmp = berr( k ) / ( ( n+1 )*eps+( n+1 )*unfl /
311  $ max( axbi, ( n+1 )*unfl ) )
312  IF( k.EQ.1 ) THEN
313  reslts( 2 ) = tmp
314  ELSE
315  reslts( 2 ) = max( reslts( 2 ), tmp )
316  END IF
317  90 CONTINUE
318 *
319  RETURN
320 *
321 * End of STRT05
322 *
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: