3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * SUBROUTINE DGET07( TRANS, N, NRHS, A, LDA, B, LDB, X, LDX, XACT,
12 * LDXACT, FERR, CHKFERR, BERR, RESLTS )
14 * .. Scalar Arguments ..
17 * INTEGER LDA, LDB, LDX, LDXACT, N, NRHS
19 * .. Array Arguments ..
20 * DOUBLE PRECISION A( LDA, * ), B( LDB, * ), BERR( * ), FERR( * ),
21 * $ RESLTS( * ), X( LDX, * ), XACT( LDXACT, * )
30 *> DGET07 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 n by n matrix and op(A) = A or A**T, depending on TRANS.
34 *> RESLTS(1) = test of the error bound
35 *> = norm(X - XACT) / ( norm(X) * FERR )
37 *> A large value is returned if this ratio is not less than one.
39 *> RESLTS(2) = residual from the iterative refinement routine
40 *> = the maximum of BERR / ( (n+1)*EPS + (*) ), where
41 *> (*) = (n+1)*UNFL / (min_i (abs(op(A))*abs(X) +abs(b))_i )
49 *> TRANS is CHARACTER*1
50 *> Specifies the form of the system of equations.
51 *> = 'N': A * X = B (No transpose)
52 *> = 'T': A**T * X = B (Transpose)
53 *> = 'C': A**H * X = B (Conjugate transpose = Transpose)
59 *> The number of rows of the matrices X and XACT. N >= 0.
65 *> The number of columns of the matrices X and XACT. NRHS >= 0.
70 *> A is DOUBLE PRECISION array, dimension (LDA,N)
71 *> The original n by n matrix A.
77 *> The leading dimension of the array A. LDA >= max(1,N).
82 *> B is DOUBLE PRECISION array, dimension (LDB,NRHS)
83 *> The right hand side vectors for the system of linear
90 *> The leading dimension of the array B. LDB >= max(1,N).
95 *> X is DOUBLE PRECISION array, dimension (LDX,NRHS)
96 *> The computed solution vectors. Each vector is stored as a
97 *> column of the matrix X.
103 *> The leading dimension of the array X. LDX >= max(1,N).
108 *> XACT is DOUBLE PRECISION array, dimension (LDX,NRHS)
109 *> The exact solution vectors. Each vector is stored as a
110 *> column of the matrix XACT.
116 *> The leading dimension of the array XACT. LDXACT >= max(1,N).
121 *> FERR is DOUBLE PRECISION array, dimension (NRHS)
122 *> The estimated forward error bounds for each solution vector
123 *> X. If XTRUE is the true solution, FERR bounds the magnitude
124 *> of the largest entry in (X - XTRUE) divided by the magnitude
125 *> of the largest entry in X.
128 *> \param[in] CHKFERR
130 *> CHKFERR is LOGICAL
131 *> Set to .TRUE. to check FERR, .FALSE. not to check FERR.
132 *> When the test system is ill-conditioned, the "true"
133 *> solution in XACT may be incorrect.
138 *> BERR is DOUBLE PRECISION array, dimension (NRHS)
139 *> The componentwise relative backward error of each solution
140 *> vector (i.e., the smallest relative change in any entry of A
141 *> or B that makes X an exact solution).
144 *> \param[out] RESLTS
146 *> RESLTS is DOUBLE PRECISION array, dimension (2)
147 *> The maximum over the NRHS solution vectors of the ratios:
148 *> RESLTS(1) = norm(X - XACT) / ( norm(X) * FERR )
149 *> RESLTS(2) = BERR / ( (n+1)*EPS + (*) )
155 *> \author Univ. of Tennessee
156 *> \author Univ. of California Berkeley
157 *> \author Univ. of Colorado Denver
160 *> \date November 2011
162 *> \ingroup double_lin
164 * =====================================================================
165 SUBROUTINE DGET07( TRANS, N, NRHS, A, LDA, B, LDB, X, LDX, XACT,
166 $ LDXACT, FERR, CHKFERR, BERR, RESLTS )
168 * -- LAPACK test routine (version 3.4.0) --
169 * -- LAPACK is a software package provided by Univ. of Tennessee, --
170 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
173 * .. Scalar Arguments ..
176 INTEGER LDA, LDB, LDX, LDXACT, N, NRHS
178 * .. Array Arguments ..
179 DOUBLE PRECISION A( LDA, * ), B( LDB, * ), BERR( * ), FERR( * ),
180 $ RESLTS( * ), X( LDX, * ), XACT( LDXACT, * )
183 * =====================================================================
186 DOUBLE PRECISION ZERO, ONE
187 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
189 * .. Local Scalars ..
191 INTEGER I, IMAX, J, K
192 DOUBLE PRECISION AXBI, DIFF, EPS, ERRBND, OVFL, TMP, UNFL, XNORM
194 * .. External Functions ..
197 DOUBLE PRECISION DLAMCH
198 EXTERNAL LSAME, IDAMAX, DLAMCH
200 * .. Intrinsic Functions ..
201 INTRINSIC ABS, MAX, MIN
203 * .. Executable Statements ..
205 * Quick exit if N = 0 or NRHS = 0.
207 IF( N.LE.0 .OR. NRHS.LE.0 ) THEN
213 EPS = DLAMCH( 'Epsilon' )
214 UNFL = DLAMCH( 'Safe minimum' )
216 NOTRAN = LSAME( TRANS, 'N' )
218 * Test 1: Compute the maximum of
219 * norm(X - XACT) / ( norm(X) * FERR )
220 * over all the vectors X and XACT using the infinity-norm.
225 IMAX = IDAMAX( N, X( 1, J ), 1 )
226 XNORM = MAX( ABS( X( IMAX, J ) ), UNFL )
229 DIFF = MAX( DIFF, ABS( X( I, J )-XACT( I, J ) ) )
232 IF( XNORM.GT.ONE ) THEN
234 ELSE IF( DIFF.LE.OVFL*XNORM ) THEN
242 IF( DIFF / XNORM.LE.FERR( J ) ) THEN
243 ERRBND = MAX( ERRBND, ( DIFF / XNORM ) / FERR( J ) )
251 * Test 2: Compute the maximum of BERR / ( (n+1)*EPS + (*) ), where
252 * (*) = (n+1)*UNFL / (min_i (abs(op(A))*abs(X) +abs(b))_i )
256 TMP = ABS( B( I, K ) )
259 TMP = TMP + ABS( A( I, J ) )*ABS( X( J, K ) )
263 TMP = TMP + ABS( A( J, I ) )*ABS( X( J, K ) )
269 AXBI = MIN( AXBI, TMP )
272 TMP = BERR( K ) / ( ( N+1 )*EPS+( N+1 )*UNFL /
273 $ MAX( AXBI, ( N+1 )*UNFL ) )
277 RESLTS( 2 ) = MAX( RESLTS( 2 ), TMP )