3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * SUBROUTINE SGTT02( TRANS, N, NRHS, DL, D, DU, X, LDX, B, LDB,
14 * .. Scalar Arguments ..
16 * INTEGER LDB, LDX, N, NRHS
19 * .. Array Arguments ..
20 * REAL B( LDB, * ), D( * ), DL( * ), DU( * ),
30 *> SGTT02 computes the residual for the solution to a tridiagonal
31 *> system of equations:
32 *> RESID = norm(B - op(A)*X) / (norm(A) * norm(X) * EPS),
33 *> where EPS is the machine epsilon.
42 *> Specifies the form of the residual.
43 *> = 'N': B - A * X (No transpose)
44 *> = 'T': B - A'* X (Transpose)
45 *> = 'C': B - A'* X (Conjugate transpose = Transpose)
51 *> The order of the matrix A. N >= 0.
57 *> The number of right hand sides, i.e., the number of columns
58 *> of the matrices B and X. NRHS >= 0.
63 *> DL is REAL array, dimension (N-1)
64 *> The (n-1) sub-diagonal elements of A.
69 *> D is REAL array, dimension (N)
70 *> The diagonal elements of A.
75 *> DU is REAL array, dimension (N-1)
76 *> The (n-1) super-diagonal elements of A.
81 *> X is REAL array, dimension (LDX,NRHS)
82 *> The computed solution vectors X.
88 *> The leading dimension of the array X. LDX >= max(1,N).
93 *> B is REAL array, dimension (LDB,NRHS)
94 *> On entry, the right hand side vectors for the system of
96 *> On exit, B is overwritten with the difference B - op(A)*X.
102 *> The leading dimension of the array B. LDB >= max(1,N).
108 *> norm(B - op(A)*X) / (norm(A) * norm(X) * EPS)
114 *> \author Univ. of Tennessee
115 *> \author Univ. of California Berkeley
116 *> \author Univ. of Colorado Denver
119 *> \date November 2011
121 *> \ingroup single_lin
123 * =====================================================================
124 SUBROUTINE SGTT02( TRANS, N, NRHS, DL, D, DU, X, LDX, B, LDB,
127 * -- LAPACK test routine (version 3.4.0) --
128 * -- LAPACK is a software package provided by Univ. of Tennessee, --
129 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
132 * .. Scalar Arguments ..
134 INTEGER LDB, LDX, N, NRHS
137 * .. Array Arguments ..
138 REAL B( LDB, * ), D( * ), DL( * ), DU( * ),
142 * =====================================================================
146 PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
148 * .. Local Scalars ..
150 REAL ANORM, BNORM, EPS, XNORM
152 * .. External Functions ..
154 REAL SASUM, SLAMCH, SLANGT
155 EXTERNAL LSAME, SASUM, SLAMCH, SLANGT
157 * .. External Subroutines ..
160 * .. Intrinsic Functions ..
163 * .. Executable Statements ..
165 * Quick exit if N = 0 or NRHS = 0
168 IF( N.LE.0 .OR. NRHS.EQ.0 )
171 * Compute the maximum over the number of right hand sides of
172 * norm(B - op(A)*X) / ( norm(A) * norm(X) * EPS ).
174 IF( LSAME( TRANS, 'N' ) ) THEN
175 ANORM = SLANGT( '1', N, DL, D, DU )
177 ANORM = SLANGT( 'I', N, DL, D, DU )
180 * Exit with RESID = 1/EPS if ANORM = 0.
182 EPS = SLAMCH( 'Epsilon' )
183 IF( ANORM.LE.ZERO ) THEN
188 * Compute B - op(A)*X.
190 CALL SLAGTM( TRANS, N, NRHS, -ONE, DL, D, DU, X, LDX, ONE, B,
194 BNORM = SASUM( N, B( 1, J ), 1 )
195 XNORM = SASUM( N, X( 1, J ), 1 )
196 IF( XNORM.LE.ZERO ) THEN
199 RESID = MAX( RESID, ( ( BNORM / ANORM ) / XNORM ) / EPS )