3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * SUBROUTINE DGBT02( TRANS, M, N, KL, KU, NRHS, A, LDA, X, LDX, B,
14 * .. Scalar Arguments ..
16 * INTEGER KL, KU, LDA, LDB, LDX, M, N, NRHS
17 * DOUBLE PRECISION RESID
19 * .. Array Arguments ..
20 * DOUBLE PRECISION A( LDA, * ), B( LDB, * ), X( LDX, * )
29 *> DGBT02 computes the residual for a solution of a banded system of
30 *> equations A*x = b or A'*x = b:
31 *> RESID = norm( B - A*X ) / ( norm(A) * norm(X) * EPS).
32 *> where EPS is the machine precision.
40 *> TRANS is CHARACTER*1
41 *> Specifies the form of the system of equations:
43 *> = 'T': A'*x = b, where A' is the transpose of A
44 *> = 'C': A'*x = b, where A' is the transpose of A
50 *> The number of rows of the matrix A. M >= 0.
56 *> The number of columns of the matrix A. N >= 0.
62 *> The number of subdiagonals within the band of A. KL >= 0.
68 *> The number of superdiagonals within the band of A. KU >= 0.
74 *> The number of columns of B. NRHS >= 0.
79 *> A is DOUBLE PRECISION array, dimension (LDA,N)
80 *> The original matrix A in band storage, stored in rows 1 to
87 *> The leading dimension of the array A. LDA >= max(1,KL+KU+1).
92 *> X is DOUBLE PRECISION array, dimension (LDX,NRHS)
93 *> The computed solution vectors for the system of linear
100 *> The leading dimension of the array X. If TRANS = 'N',
101 *> LDX >= max(1,N); if TRANS = 'T' or 'C', LDX >= max(1,M).
106 *> B is DOUBLE PRECISION array, dimension (LDB,NRHS)
107 *> On entry, the right hand side vectors for the system of
109 *> On exit, B is overwritten with the difference B - A*X.
115 *> The leading dimension of the array B. IF TRANS = 'N',
116 *> LDB >= max(1,M); if TRANS = 'T' or 'C', LDB >= max(1,N).
121 *> RESID is DOUBLE PRECISION
122 *> The maximum over the number of right hand sides of
123 *> norm(B - A*X) / ( norm(A) * norm(X) * EPS ).
129 *> \author Univ. of Tennessee
130 *> \author Univ. of California Berkeley
131 *> \author Univ. of Colorado Denver
134 *> \date November 2011
136 *> \ingroup double_lin
138 * =====================================================================
139 SUBROUTINE DGBT02( TRANS, M, N, KL, KU, NRHS, A, LDA, X, LDX, B,
142 * -- LAPACK test routine (version 3.4.0) --
143 * -- LAPACK is a software package provided by Univ. of Tennessee, --
144 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
147 * .. Scalar Arguments ..
149 INTEGER KL, KU, LDA, LDB, LDX, M, N, NRHS
150 DOUBLE PRECISION RESID
152 * .. Array Arguments ..
153 DOUBLE PRECISION A( LDA, * ), B( LDB, * ), X( LDX, * )
156 * =====================================================================
159 DOUBLE PRECISION ZERO, ONE
160 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
162 * .. Local Scalars ..
163 INTEGER I1, I2, J, KD, N1
164 DOUBLE PRECISION ANORM, BNORM, EPS, XNORM
166 * .. External Functions ..
168 DOUBLE PRECISION DASUM, DLAMCH
169 EXTERNAL LSAME, DASUM, DLAMCH
171 * .. External Subroutines ..
174 * .. Intrinsic Functions ..
177 * .. Executable Statements ..
179 * Quick return if N = 0 pr NRHS = 0
181 IF( M.LE.0 .OR. N.LE.0 .OR. NRHS.LE.0 ) THEN
186 * Exit with RESID = 1/EPS if ANORM = 0.
188 EPS = DLAMCH( 'Epsilon' )
192 I1 = MAX( KD+1-J, 1 )
193 I2 = MIN( KD+M-J, KL+KD )
194 ANORM = MAX( ANORM, DASUM( I2-I1+1, A( I1, J ), 1 ) )
196 IF( ANORM.LE.ZERO ) THEN
201 IF( LSAME( TRANS, 'T' ) .OR. LSAME( TRANS, 'C' ) ) THEN
207 * Compute B - A*X (or B - A'*X )
210 CALL DGBMV( TRANS, M, N, KL, KU, -ONE, A, LDA, X( 1, J ), 1,
211 $ ONE, B( 1, J ), 1 )
214 * Compute the maximum over the number of right hand sides of
215 * norm(B - A*X) / ( norm(A) * norm(X) * EPS ).
219 BNORM = DASUM( N1, B( 1, J ), 1 )
220 XNORM = DASUM( N1, X( 1, J ), 1 )
221 IF( XNORM.LE.ZERO ) THEN
224 RESID = MAX( RESID, ( ( BNORM / ANORM ) / XNORM ) / EPS )