LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ dtrt05()

subroutine dtrt05 ( character  UPLO,
character  TRANS,
character  DIAG,
integer  N,
integer  NRHS,
double precision, dimension( lda, * )  A,
integer  LDA,
double precision, dimension( ldb, * )  B,
integer  LDB,
double precision, dimension( ldx, * )  X,
integer  LDX,
double precision, dimension( ldxact, * )  XACT,
integer  LDXACT,
double precision, dimension( * )  FERR,
double precision, dimension( * )  BERR,
double precision, dimension( * )  RESLTS 
)

DTRT05

Purpose:
 DTRT05 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 DOUBLE PRECISION 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 DOUBLE PRECISION 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 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]FERR
          FERR is DOUBLE PRECISION 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 DOUBLE PRECISION 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 DOUBLE PRECISION 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
December 2016

Definition at line 183 of file dtrt05.f.

183 *
184 * -- LAPACK test routine (version 3.7.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 * December 2016
188 *
189 * .. Scalar Arguments ..
190  CHARACTER diag, trans, uplo
191  INTEGER lda, ldb, ldx, ldxact, n, nrhs
192 * ..
193 * .. Array Arguments ..
194  DOUBLE PRECISION a( lda, * ), b( ldb, * ), berr( * ), ferr( * ),
195  $ reslts( * ), x( ldx, * ), xact( ldxact, * )
196 * ..
197 *
198 * =====================================================================
199 *
200 * .. Parameters ..
201  DOUBLE PRECISION zero, one
202  parameter( zero = 0.0d+0, one = 1.0d+0 )
203 * ..
204 * .. Local Scalars ..
205  LOGICAL notran, unit, upper
206  INTEGER i, ifu, imax, j, k
207  DOUBLE PRECISION axbi, diff, eps, errbnd, ovfl, tmp, unfl, xnorm
208 * ..
209 * .. External Functions ..
210  LOGICAL lsame
211  INTEGER idamax
212  DOUBLE PRECISION dlamch
213  EXTERNAL lsame, idamax, dlamch
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 = dlamch( 'Epsilon' )
229  unfl = dlamch( '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 = idamax( 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 DTRT05
322 *
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
integer function idamax(N, DX, INCX)
IDAMAX
Definition: idamax.f:73
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
Here is the caller graph for this function: