LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ dtrt03()

subroutine dtrt03 ( character  UPLO,
character  TRANS,
character  DIAG,
integer  N,
integer  NRHS,
double precision, dimension( lda, * )  A,
integer  LDA,
double precision  SCALE,
double precision, dimension( * )  CNORM,
double precision  TSCAL,
double precision, dimension( ldx, * )  X,
integer  LDX,
double precision, dimension( ldb, * )  B,
integer  LDB,
double precision, dimension( * )  WORK,
double precision  RESID 
)

DTRT03

Purpose:
 DTRT03 computes the residual for the solution to a scaled triangular
 system of equations A*x = s*b  or  A'*x = s*b.
 Here A is a triangular matrix, A' is the transpose of A, s is a
 scalar, and x and b are N by NRHS matrices.  The test ratio is the
 maximum over the number of right hand sides of
    norm(s*b - op(A)*x) / ( norm(op(A)) * norm(x) * EPS ),
 where op(A) denotes A or A' and EPS is the machine epsilon.
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 operation applied to A.
          = 'N':  A *x = s*b  (No transpose)
          = 'T':  A'*x = s*b  (Transpose)
          = 'C':  A'*x = s*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 order of the matrix A.  N >= 0.
[in]NRHS
          NRHS is INTEGER
          The number of right hand sides, i.e., the number of columns
          of the matrices X and B.  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]SCALE
          SCALE is DOUBLE PRECISION
          The scaling factor s used in solving the triangular system.
[in]CNORM
          CNORM is DOUBLE PRECISION array, dimension (N)
          The 1-norms of the columns of A, not counting the diagonal.
[in]TSCAL
          TSCAL is DOUBLE PRECISION
          The scaling factor used in computing the 1-norms in CNORM.
          CNORM actually contains the column norms of TSCAL*A.
[in]X
          X is DOUBLE PRECISION array, dimension (LDX,NRHS)
          The computed solution vectors for the system of linear
          equations.
[in]LDX
          LDX is INTEGER
          The leading dimension of the array X.  LDX >= 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).
[out]WORK
          WORK is DOUBLE PRECISION array, dimension (N)
[out]RESID
          RESID is DOUBLE PRECISION
          The maximum over the number of right hand sides of
          norm(op(A)*x - s*b) / ( norm(op(A)) * norm(x) * EPS ).
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
December 2016

Definition at line 171 of file dtrt03.f.

171 *
172 * -- LAPACK test routine (version 3.7.0) --
173 * -- LAPACK is a software package provided by Univ. of Tennessee, --
174 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
175 * December 2016
176 *
177 * .. Scalar Arguments ..
178  CHARACTER diag, trans, uplo
179  INTEGER lda, ldb, ldx, n, nrhs
180  DOUBLE PRECISION resid, scale, tscal
181 * ..
182 * .. Array Arguments ..
183  DOUBLE PRECISION a( lda, * ), b( ldb, * ), cnorm( * ),
184  $ work( * ), x( ldx, * )
185 * ..
186 *
187 * =====================================================================
188 *
189 * .. Parameters ..
190  DOUBLE PRECISION one, zero
191  parameter( one = 1.0d+0, zero = 0.0d+0 )
192 * ..
193 * .. Local Scalars ..
194  INTEGER ix, j
195  DOUBLE PRECISION bignum, eps, err, smlnum, tnorm, xnorm, xscal
196 * ..
197 * .. External Functions ..
198  LOGICAL lsame
199  INTEGER idamax
200  DOUBLE PRECISION dlamch
201  EXTERNAL lsame, idamax, dlamch
202 * ..
203 * .. External Subroutines ..
204  EXTERNAL daxpy, dcopy, dlabad, dscal, dtrmv
205 * ..
206 * .. Intrinsic Functions ..
207  INTRINSIC abs, dble, max
208 * ..
209 * .. Executable Statements ..
210 *
211 * Quick exit if N = 0
212 *
213  IF( n.LE.0 .OR. nrhs.LE.0 ) THEN
214  resid = zero
215  RETURN
216  END IF
217  eps = dlamch( 'Epsilon' )
218  smlnum = dlamch( 'Safe minimum' )
219  bignum = one / smlnum
220  CALL dlabad( smlnum, bignum )
221 *
222 * Compute the norm of the triangular matrix A using the column
223 * norms already computed by DLATRS.
224 *
225  tnorm = zero
226  IF( lsame( diag, 'N' ) ) THEN
227  DO 10 j = 1, n
228  tnorm = max( tnorm, tscal*abs( a( j, j ) )+cnorm( j ) )
229  10 CONTINUE
230  ELSE
231  DO 20 j = 1, n
232  tnorm = max( tnorm, tscal+cnorm( j ) )
233  20 CONTINUE
234  END IF
235 *
236 * Compute the maximum over the number of right hand sides of
237 * norm(op(A)*x - s*b) / ( norm(op(A)) * norm(x) * EPS ).
238 *
239  resid = zero
240  DO 30 j = 1, nrhs
241  CALL dcopy( n, x( 1, j ), 1, work, 1 )
242  ix = idamax( n, work, 1 )
243  xnorm = max( one, abs( x( ix, j ) ) )
244  xscal = ( one / xnorm ) / dble( n )
245  CALL dscal( n, xscal, work, 1 )
246  CALL dtrmv( uplo, trans, diag, n, a, lda, work, 1 )
247  CALL daxpy( n, -scale*xscal, b( 1, j ), 1, work, 1 )
248  ix = idamax( n, work, 1 )
249  err = tscal*abs( work( ix ) )
250  ix = idamax( n, x( 1, j ), 1 )
251  xnorm = abs( x( ix, j ) )
252  IF( err*smlnum.LE.xnorm ) THEN
253  IF( xnorm.GT.zero )
254  $ err = err / xnorm
255  ELSE
256  IF( err.GT.zero )
257  $ err = one / eps
258  END IF
259  IF( err*smlnum.LE.tnorm ) THEN
260  IF( tnorm.GT.zero )
261  $ err = err / tnorm
262  ELSE
263  IF( err.GT.zero )
264  $ err = one / eps
265  END IF
266  resid = max( resid, err )
267  30 CONTINUE
268 *
269  RETURN
270 *
271 * End of DTRT03
272 *
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
subroutine dcopy(N, DX, INCX, DY, INCY)
DCOPY
Definition: dcopy.f:84
integer function idamax(N, DX, INCX)
IDAMAX
Definition: idamax.f:73
subroutine daxpy(N, DA, DX, INCX, DY, INCY)
DAXPY
Definition: daxpy.f:91
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine dscal(N, DA, DX, INCX)
DSCAL
Definition: dscal.f:81
subroutine dlabad(SMALL, LARGE)
DLABAD
Definition: dlabad.f:76
subroutine dtrmv(UPLO, TRANS, DIAG, N, A, LDA, X, INCX)
DTRMV
Definition: dtrmv.f:149
Here is the call graph for this function:
Here is the caller graph for this function: