LAPACK 3.3.0
|
00001 SUBROUTINE DGET07( TRANS, N, NRHS, A, LDA, B, LDB, X, LDX, XACT, 00002 $ LDXACT, FERR, CHKFERR, BERR, RESLTS ) 00003 * 00004 * -- LAPACK test routine (version 3.1) -- 00005 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. 00006 * November 2006 00007 * 00008 * .. Scalar Arguments .. 00009 CHARACTER TRANS 00010 LOGICAL CHKFERR 00011 INTEGER LDA, LDB, LDX, LDXACT, N, NRHS 00012 * .. 00013 * .. Array Arguments .. 00014 DOUBLE PRECISION A( LDA, * ), B( LDB, * ), BERR( * ), FERR( * ), 00015 $ RESLTS( * ), X( LDX, * ), XACT( LDXACT, * ) 00016 * .. 00017 * 00018 * Purpose 00019 * ======= 00020 * 00021 * DGET07 tests the error bounds from iterative refinement for the 00022 * computed solution to a system of equations op(A)*X = B, where A is a 00023 * general n by n matrix and op(A) = A or A**T, depending on TRANS. 00024 * 00025 * RESLTS(1) = test of the error bound 00026 * = norm(X - XACT) / ( norm(X) * FERR ) 00027 * 00028 * A large value is returned if this ratio is not less than one. 00029 * 00030 * RESLTS(2) = residual from the iterative refinement routine 00031 * = the maximum of BERR / ( (n+1)*EPS + (*) ), where 00032 * (*) = (n+1)*UNFL / (min_i (abs(op(A))*abs(X) +abs(b))_i ) 00033 * 00034 * Arguments 00035 * ========= 00036 * 00037 * TRANS (input) CHARACTER*1 00038 * Specifies the form of the system of equations. 00039 * = 'N': A * X = B (No transpose) 00040 * = 'T': A**T * X = B (Transpose) 00041 * = 'C': A**H * X = B (Conjugate transpose = Transpose) 00042 * 00043 * N (input) INTEGER 00044 * The number of rows of the matrices X and XACT. N >= 0. 00045 * 00046 * NRHS (input) INTEGER 00047 * The number of columns of the matrices X and XACT. NRHS >= 0. 00048 * 00049 * A (input) DOUBLE PRECISION array, dimension (LDA,N) 00050 * The original n by n matrix A. 00051 * 00052 * LDA (input) INTEGER 00053 * The leading dimension of the array A. LDA >= max(1,N). 00054 * 00055 * B (input) DOUBLE PRECISION array, dimension (LDB,NRHS) 00056 * The right hand side vectors for the system of linear 00057 * equations. 00058 * 00059 * LDB (input) INTEGER 00060 * The leading dimension of the array B. LDB >= max(1,N). 00061 * 00062 * X (input) DOUBLE PRECISION array, dimension (LDX,NRHS) 00063 * The computed solution vectors. Each vector is stored as a 00064 * column of the matrix X. 00065 * 00066 * LDX (input) INTEGER 00067 * The leading dimension of the array X. LDX >= max(1,N). 00068 * 00069 * XACT (input) DOUBLE PRECISION array, dimension (LDX,NRHS) 00070 * The exact solution vectors. Each vector is stored as a 00071 * column of the matrix XACT. 00072 * 00073 * LDXACT (input) INTEGER 00074 * The leading dimension of the array XACT. LDXACT >= max(1,N). 00075 * 00076 * FERR (input) DOUBLE PRECISION array, dimension (NRHS) 00077 * The estimated forward error bounds for each solution vector 00078 * X. If XTRUE is the true solution, FERR bounds the magnitude 00079 * of the largest entry in (X - XTRUE) divided by the magnitude 00080 * of the largest entry in X. 00081 * 00082 * CHKFERR (input) LOGICAL 00083 * Set to .TRUE. to check FERR, .FALSE. not to check FERR. 00084 * When the test system is ill-conditioned, the "true" 00085 * solution in XACT may be incorrect. 00086 * 00087 * BERR (input) DOUBLE PRECISION array, dimension (NRHS) 00088 * The componentwise relative backward error of each solution 00089 * vector (i.e., the smallest relative change in any entry of A 00090 * or B that makes X an exact solution). 00091 * 00092 * RESLTS (output) DOUBLE PRECISION array, dimension (2) 00093 * The maximum over the NRHS solution vectors of the ratios: 00094 * RESLTS(1) = norm(X - XACT) / ( norm(X) * FERR ) 00095 * RESLTS(2) = BERR / ( (n+1)*EPS + (*) ) 00096 * 00097 * ===================================================================== 00098 * 00099 * .. Parameters .. 00100 DOUBLE PRECISION ZERO, ONE 00101 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 ) 00102 * .. 00103 * .. Local Scalars .. 00104 LOGICAL NOTRAN 00105 INTEGER I, IMAX, J, K 00106 DOUBLE PRECISION AXBI, DIFF, EPS, ERRBND, OVFL, TMP, UNFL, XNORM 00107 * .. 00108 * .. External Functions .. 00109 LOGICAL LSAME 00110 INTEGER IDAMAX 00111 DOUBLE PRECISION DLAMCH 00112 EXTERNAL LSAME, IDAMAX, DLAMCH 00113 * .. 00114 * .. Intrinsic Functions .. 00115 INTRINSIC ABS, MAX, MIN 00116 * .. 00117 * .. Executable Statements .. 00118 * 00119 * Quick exit if N = 0 or NRHS = 0. 00120 * 00121 IF( N.LE.0 .OR. NRHS.LE.0 ) THEN 00122 RESLTS( 1 ) = ZERO 00123 RESLTS( 2 ) = ZERO 00124 RETURN 00125 END IF 00126 * 00127 EPS = DLAMCH( 'Epsilon' ) 00128 UNFL = DLAMCH( 'Safe minimum' ) 00129 OVFL = ONE / UNFL 00130 NOTRAN = LSAME( TRANS, 'N' ) 00131 * 00132 * Test 1: Compute the maximum of 00133 * norm(X - XACT) / ( norm(X) * FERR ) 00134 * over all the vectors X and XACT using the infinity-norm. 00135 * 00136 ERRBND = ZERO 00137 IF( CHKFERR ) THEN 00138 DO 30 J = 1, NRHS 00139 IMAX = IDAMAX( N, X( 1, J ), 1 ) 00140 XNORM = MAX( ABS( X( IMAX, J ) ), UNFL ) 00141 DIFF = ZERO 00142 DO 10 I = 1, N 00143 DIFF = MAX( DIFF, ABS( X( I, J )-XACT( I, J ) ) ) 00144 10 CONTINUE 00145 * 00146 IF( XNORM.GT.ONE ) THEN 00147 GO TO 20 00148 ELSE IF( DIFF.LE.OVFL*XNORM ) THEN 00149 GO TO 20 00150 ELSE 00151 ERRBND = ONE / EPS 00152 GO TO 30 00153 END IF 00154 * 00155 20 CONTINUE 00156 IF( DIFF / XNORM.LE.FERR( J ) ) THEN 00157 ERRBND = MAX( ERRBND, ( DIFF / XNORM ) / FERR( J ) ) 00158 ELSE 00159 ERRBND = ONE / EPS 00160 END IF 00161 30 CONTINUE 00162 END IF 00163 RESLTS( 1 ) = ERRBND 00164 * 00165 * Test 2: Compute the maximum of BERR / ( (n+1)*EPS + (*) ), where 00166 * (*) = (n+1)*UNFL / (min_i (abs(op(A))*abs(X) +abs(b))_i ) 00167 * 00168 DO 70 K = 1, NRHS 00169 DO 60 I = 1, N 00170 TMP = ABS( B( I, K ) ) 00171 IF( NOTRAN ) THEN 00172 DO 40 J = 1, N 00173 TMP = TMP + ABS( A( I, J ) )*ABS( X( J, K ) ) 00174 40 CONTINUE 00175 ELSE 00176 DO 50 J = 1, N 00177 TMP = TMP + ABS( A( J, I ) )*ABS( X( J, K ) ) 00178 50 CONTINUE 00179 END IF 00180 IF( I.EQ.1 ) THEN 00181 AXBI = TMP 00182 ELSE 00183 AXBI = MIN( AXBI, TMP ) 00184 END IF 00185 60 CONTINUE 00186 TMP = BERR( K ) / ( ( N+1 )*EPS+( N+1 )*UNFL / 00187 $ MAX( AXBI, ( N+1 )*UNFL ) ) 00188 IF( K.EQ.1 ) THEN 00189 RESLTS( 2 ) = TMP 00190 ELSE 00191 RESLTS( 2 ) = MAX( RESLTS( 2 ), TMP ) 00192 END IF 00193 70 CONTINUE 00194 * 00195 RETURN 00196 * 00197 * End of DGET07 00198 * 00199 END