3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * SUBROUTINE ZGTT02( TRANS, N, NRHS, DL, D, DU, X, LDX, B, LDB,
14 * .. Scalar Arguments ..
16 * INTEGER LDB, LDX, N, NRHS
17 * DOUBLE PRECISION RESID
19 * .. Array Arguments ..
20 * COMPLEX*16 B( LDB, * ), D( * ), DL( * ), DU( * ),
30 *> ZGTT02 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**T * X (Transpose)
45 *> = 'C': B - A**H * X (Conjugate 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 COMPLEX*16 array, dimension (N-1)
64 *> The (n-1) sub-diagonal elements of A.
69 *> D is COMPLEX*16 array, dimension (N)
70 *> The diagonal elements of A.
75 *> DU is COMPLEX*16 array, dimension (N-1)
76 *> The (n-1) super-diagonal elements of A.
81 *> X is COMPLEX*16 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 COMPLEX*16 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).
107 *> RESID is DOUBLE PRECISION
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 complex16_lin
123 * =====================================================================
124 SUBROUTINE ZGTT02( 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
135 DOUBLE PRECISION RESID
137 * .. Array Arguments ..
138 COMPLEX*16 B( LDB, * ), D( * ), DL( * ), DU( * ),
142 * =====================================================================
145 DOUBLE PRECISION ONE, ZERO
146 PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
148 * .. Local Scalars ..
150 DOUBLE PRECISION ANORM, BNORM, EPS, XNORM
152 * .. External Functions ..
154 DOUBLE PRECISION DLAMCH, DZASUM, ZLANGT
155 EXTERNAL LSAME, DLAMCH, DZASUM, ZLANGT
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 = ZLANGT( '1', N, DL, D, DU )
177 ANORM = ZLANGT( 'I', N, DL, D, DU )
180 * Exit with RESID = 1/EPS if ANORM = 0.
182 EPS = DLAMCH( 'Epsilon' )
183 IF( ANORM.LE.ZERO ) THEN
188 * Compute B - op(A)*X.
190 CALL ZLAGTM( TRANS, N, NRHS, -ONE, DL, D, DU, X, LDX, ONE, B,
194 BNORM = DZASUM( N, B( 1, J ), 1 )
195 XNORM = DZASUM( N, X( 1, J ), 1 )
196 IF( XNORM.LE.ZERO ) THEN
199 RESID = MAX( RESID, ( ( BNORM / ANORM ) / XNORM ) / EPS )