LAPACK 3.11.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ dgtt05()

subroutine dgtt05 ( character  TRANS,
integer  N,
integer  NRHS,
double precision, dimension( * )  DL,
double precision, dimension( * )  D,
double precision, dimension( * )  DU,
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 
)

DGTT05

Purpose:
 DGTT05 tests the error bounds from iterative refinement for the
 computed solution to a system of equations A*X = B, where A is a
 general tridiagonal matrix of order n 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 / ( NZ*EPS + (*) ), where
             (*) = NZ*UNFL / (min_i (abs(op(A))*abs(X) +abs(b))_i )
             and NZ = max. number of nonzeros in any row of A, plus 1
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]DL
          DL is DOUBLE PRECISION array, dimension (N-1)
          The (n-1) sub-diagonal elements of A.
[in]D
          D is DOUBLE PRECISION array, dimension (N)
          The diagonal elements of A.
[in]DU
          DU is DOUBLE PRECISION array, dimension (N-1)
          The (n-1) super-diagonal elements of A.
[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 / ( NZ*EPS + (*) )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 163 of file dgtt05.f.

165*
166* -- LAPACK test routine --
167* -- LAPACK is a software package provided by Univ. of Tennessee, --
168* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
169*
170* .. Scalar Arguments ..
171 CHARACTER TRANS
172 INTEGER LDB, LDX, LDXACT, N, NRHS
173* ..
174* .. Array Arguments ..
175 DOUBLE PRECISION B( LDB, * ), BERR( * ), D( * ), DL( * ),
176 $ DU( * ), FERR( * ), RESLTS( * ), X( LDX, * ),
177 $ XACT( LDXACT, * )
178* ..
179*
180* =====================================================================
181*
182* .. Parameters ..
183 DOUBLE PRECISION ZERO, ONE
184 parameter( zero = 0.0d+0, one = 1.0d+0 )
185* ..
186* .. Local Scalars ..
187 LOGICAL NOTRAN
188 INTEGER I, IMAX, J, K, NZ
189 DOUBLE PRECISION AXBI, DIFF, EPS, ERRBND, OVFL, TMP, UNFL, XNORM
190* ..
191* .. External Functions ..
192 LOGICAL LSAME
193 INTEGER IDAMAX
194 DOUBLE PRECISION DLAMCH
195 EXTERNAL lsame, idamax, dlamch
196* ..
197* .. Intrinsic Functions ..
198 INTRINSIC abs, max, min
199* ..
200* .. Executable Statements ..
201*
202* Quick exit if N = 0 or NRHS = 0.
203*
204 IF( n.LE.0 .OR. nrhs.LE.0 ) THEN
205 reslts( 1 ) = zero
206 reslts( 2 ) = zero
207 RETURN
208 END IF
209*
210 eps = dlamch( 'Epsilon' )
211 unfl = dlamch( 'Safe minimum' )
212 ovfl = one / unfl
213 notran = lsame( trans, 'N' )
214 nz = 4
215*
216* Test 1: Compute the maximum of
217* norm(X - XACT) / ( norm(X) * FERR )
218* over all the vectors X and XACT using the infinity-norm.
219*
220 errbnd = zero
221 DO 30 j = 1, nrhs
222 imax = idamax( n, x( 1, j ), 1 )
223 xnorm = max( abs( x( imax, j ) ), unfl )
224 diff = zero
225 DO 10 i = 1, n
226 diff = max( diff, abs( x( i, j )-xact( i, j ) ) )
227 10 CONTINUE
228*
229 IF( xnorm.GT.one ) THEN
230 GO TO 20
231 ELSE IF( diff.LE.ovfl*xnorm ) THEN
232 GO TO 20
233 ELSE
234 errbnd = one / eps
235 GO TO 30
236 END IF
237*
238 20 CONTINUE
239 IF( diff / xnorm.LE.ferr( j ) ) THEN
240 errbnd = max( errbnd, ( diff / xnorm ) / ferr( j ) )
241 ELSE
242 errbnd = one / eps
243 END IF
244 30 CONTINUE
245 reslts( 1 ) = errbnd
246*
247* Test 2: Compute the maximum of BERR / ( NZ*EPS + (*) ), where
248* (*) = NZ*UNFL / (min_i (abs(op(A))*abs(X) +abs(b))_i )
249*
250 DO 60 k = 1, nrhs
251 IF( notran ) THEN
252 IF( n.EQ.1 ) THEN
253 axbi = abs( b( 1, k ) ) + abs( d( 1 )*x( 1, k ) )
254 ELSE
255 axbi = abs( b( 1, k ) ) + abs( d( 1 )*x( 1, k ) ) +
256 $ abs( du( 1 )*x( 2, k ) )
257 DO 40 i = 2, n - 1
258 tmp = abs( b( i, k ) ) + abs( dl( i-1 )*x( i-1, k ) )
259 $ + abs( d( i )*x( i, k ) ) +
260 $ abs( du( i )*x( i+1, k ) )
261 axbi = min( axbi, tmp )
262 40 CONTINUE
263 tmp = abs( b( n, k ) ) + abs( dl( n-1 )*x( n-1, k ) ) +
264 $ abs( d( n )*x( n, k ) )
265 axbi = min( axbi, tmp )
266 END IF
267 ELSE
268 IF( n.EQ.1 ) THEN
269 axbi = abs( b( 1, k ) ) + abs( d( 1 )*x( 1, k ) )
270 ELSE
271 axbi = abs( b( 1, k ) ) + abs( d( 1 )*x( 1, k ) ) +
272 $ abs( dl( 1 )*x( 2, k ) )
273 DO 50 i = 2, n - 1
274 tmp = abs( b( i, k ) ) + abs( du( i-1 )*x( i-1, k ) )
275 $ + abs( d( i )*x( i, k ) ) +
276 $ abs( dl( i )*x( i+1, k ) )
277 axbi = min( axbi, tmp )
278 50 CONTINUE
279 tmp = abs( b( n, k ) ) + abs( du( n-1 )*x( n-1, k ) ) +
280 $ abs( d( n )*x( n, k ) )
281 axbi = min( axbi, tmp )
282 END IF
283 END IF
284 tmp = berr( k ) / ( nz*eps+nz*unfl / max( axbi, nz*unfl ) )
285 IF( k.EQ.1 ) THEN
286 reslts( 2 ) = tmp
287 ELSE
288 reslts( 2 ) = max( reslts( 2 ), tmp )
289 END IF
290 60 CONTINUE
291*
292 RETURN
293*
294* End of DGTT05
295*
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:69
integer function idamax(N, DX, INCX)
IDAMAX
Definition: idamax.f:71
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
Here is the caller graph for this function: