3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * SUBROUTINE ZGBT05( TRANS, N, KL, KU, NRHS, AB, LDAB, B, LDB, X,
12 * LDX, XACT, LDXACT, FERR, BERR, RESLTS )
14 * .. Scalar Arguments ..
16 * INTEGER KL, KU, LDAB, LDB, LDX, LDXACT, N, NRHS
18 * .. Array Arguments ..
19 * DOUBLE PRECISION BERR( * ), FERR( * ), RESLTS( * )
20 * COMPLEX*16 AB( LDAB, * ), B( LDB, * ), X( LDX, * ),
30 *> ZGBT05 tests the error bounds from iterative refinement for the
31 *> computed solution to a system of equations op(A)*X = B, where A is a
32 *> general band matrix of order n with kl subdiagonals and ku
33 *> superdiagonals and op(A) = A or A**T, depending on TRANS.
35 *> RESLTS(1) = test of the error bound
36 *> = norm(X - XACT) / ( norm(X) * FERR )
38 *> A large value is returned if this ratio is not less than one.
40 *> RESLTS(2) = residual from the iterative refinement routine
41 *> = the maximum of BERR / ( NZ*EPS + (*) ), where
42 *> (*) = NZ*UNFL / (min_i (abs(op(A))*abs(X) +abs(b))_i )
43 *> and NZ = max. number of nonzeros in any row of A, plus 1
51 *> TRANS is CHARACTER*1
52 *> Specifies the form of the system of equations.
53 *> = 'N': A * X = B (No transpose)
54 *> = 'T': A**T * X = B (Transpose)
55 *> = 'C': A**H * X = B (Conjugate transpose = Transpose)
61 *> The number of rows of the matrices X, B, and XACT, and the
62 *> order of the matrix A. N >= 0.
68 *> The number of subdiagonals within the band of A. KL >= 0.
74 *> The number of superdiagonals within the band of A. KU >= 0.
80 *> The number of columns of the matrices X, B, and XACT.
86 *> AB is COMPLEX*16 array, dimension (LDAB,N)
87 *> The original band matrix A, stored in rows 1 to KL+KU+1.
88 *> The j-th column of A is stored in the j-th column of the
89 *> array AB as follows:
90 *> AB(ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(n,j+kl).
96 *> The leading dimension of the array AB. LDAB >= KL+KU+1.
101 *> B is COMPLEX*16 array, dimension (LDB,NRHS)
102 *> The right hand side vectors for the system of linear
109 *> The leading dimension of the array B. LDB >= max(1,N).
114 *> X is COMPLEX*16 array, dimension (LDX,NRHS)
115 *> The computed solution vectors. Each vector is stored as a
116 *> column of the matrix X.
122 *> The leading dimension of the array X. LDX >= max(1,N).
127 *> XACT is COMPLEX*16 array, dimension (LDX,NRHS)
128 *> The exact solution vectors. Each vector is stored as a
129 *> column of the matrix XACT.
135 *> The leading dimension of the array XACT. LDXACT >= max(1,N).
140 *> FERR is DOUBLE PRECISION array, dimension (NRHS)
141 *> The estimated forward error bounds for each solution vector
142 *> X. If XTRUE is the true solution, FERR bounds the magnitude
143 *> of the largest entry in (X - XTRUE) divided by the magnitude
144 *> of the largest entry in X.
149 *> BERR is DOUBLE PRECISION array, dimension (NRHS)
150 *> The componentwise relative backward error of each solution
151 *> vector (i.e., the smallest relative change in any entry of A
152 *> or B that makes X an exact solution).
155 *> \param[out] RESLTS
157 *> RESLTS is DOUBLE PRECISION array, dimension (2)
158 *> The maximum over the NRHS solution vectors of the ratios:
159 *> RESLTS(1) = norm(X - XACT) / ( norm(X) * FERR )
160 *> RESLTS(2) = BERR / ( NZ*EPS + (*) )
166 *> \author Univ. of Tennessee
167 *> \author Univ. of California Berkeley
168 *> \author Univ. of Colorado Denver
171 *> \date November 2011
173 *> \ingroup complex16_lin
175 * =====================================================================
176 SUBROUTINE ZGBT05( TRANS, N, KL, KU, NRHS, AB, LDAB, B, LDB, X,
177 $ LDX, XACT, LDXACT, FERR, BERR, RESLTS )
179 * -- LAPACK test routine (version 3.4.0) --
180 * -- LAPACK is a software package provided by Univ. of Tennessee, --
181 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
184 * .. Scalar Arguments ..
186 INTEGER KL, KU, LDAB, LDB, LDX, LDXACT, N, NRHS
188 * .. Array Arguments ..
189 DOUBLE PRECISION BERR( * ), FERR( * ), RESLTS( * )
190 COMPLEX*16 AB( LDAB, * ), B( LDB, * ), X( LDX, * ),
194 * =====================================================================
197 DOUBLE PRECISION ZERO, ONE
198 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
200 * .. Local Scalars ..
202 INTEGER I, IMAX, J, K, NZ
203 DOUBLE PRECISION AXBI, DIFF, EPS, ERRBND, OVFL, TMP, UNFL, XNORM
206 * .. External Functions ..
209 DOUBLE PRECISION DLAMCH
210 EXTERNAL LSAME, IZAMAX, DLAMCH
212 * .. Intrinsic Functions ..
213 INTRINSIC ABS, DBLE, DIMAG, MAX, MIN
215 * .. Statement Functions ..
216 DOUBLE PRECISION CABS1
218 * .. Statement Function definitions ..
219 CABS1( ZDUM ) = ABS( DBLE( ZDUM ) ) + ABS( DIMAG( ZDUM ) )
221 * .. Executable Statements ..
223 * Quick exit if N = 0 or NRHS = 0.
225 IF( N.LE.0 .OR. NRHS.LE.0 ) THEN
231 EPS = DLAMCH( 'Epsilon' )
232 UNFL = DLAMCH( 'Safe minimum' )
234 NOTRAN = LSAME( TRANS, 'N' )
235 NZ = MIN( KL+KU+2, N+1 )
237 * Test 1: Compute the maximum of
238 * norm(X - XACT) / ( norm(X) * FERR )
239 * over all the vectors X and XACT using the infinity-norm.
243 IMAX = IZAMAX( N, X( 1, J ), 1 )
244 XNORM = MAX( CABS1( X( IMAX, J ) ), UNFL )
247 DIFF = MAX( DIFF, CABS1( X( I, J )-XACT( I, J ) ) )
250 IF( XNORM.GT.ONE ) THEN
252 ELSE IF( DIFF.LE.OVFL*XNORM ) THEN
260 IF( DIFF / XNORM.LE.FERR( J ) ) THEN
261 ERRBND = MAX( ERRBND, ( DIFF / XNORM ) / FERR( J ) )
268 * Test 2: Compute the maximum of BERR / ( NZ*EPS + (*) ), where
269 * (*) = NZ*UNFL / (min_i (abs(op(A))*abs(X) +abs(b))_i )
273 TMP = CABS1( B( I, K ) )
275 DO 40 J = MAX( I-KL, 1 ), MIN( I+KU, N )
276 TMP = TMP + CABS1( AB( KU+1+I-J, J ) )*
280 DO 50 J = MAX( I-KU, 1 ), MIN( I+KL, N )
281 TMP = TMP + CABS1( AB( KU+1+J-I, I ) )*
288 AXBI = MIN( AXBI, TMP )
291 TMP = BERR( K ) / ( NZ*EPS+NZ*UNFL / MAX( AXBI, NZ*UNFL ) )
295 RESLTS( 2 ) = MAX( RESLTS( 2 ), TMP )