LAPACK 3.3.0
|
00001 SUBROUTINE ZPPT05( UPLO, N, NRHS, AP, B, LDB, X, LDX, XACT, 00002 $ LDXACT, FERR, 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 UPLO 00010 INTEGER LDB, LDX, LDXACT, N, NRHS 00011 * .. 00012 * .. Array Arguments .. 00013 DOUBLE PRECISION BERR( * ), FERR( * ), RESLTS( * ) 00014 COMPLEX*16 AP( * ), B( LDB, * ), X( LDX, * ), 00015 $ XACT( LDXACT, * ) 00016 * .. 00017 * 00018 * Purpose 00019 * ======= 00020 * 00021 * ZPPT05 tests the error bounds from iterative refinement for the 00022 * computed solution to a system of equations A*X = B, where A is a 00023 * Hermitian matrix in packed storage format. 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(A)*abs(X) +abs(b))_i ) 00033 * 00034 * Arguments 00035 * ========= 00036 * 00037 * UPLO (input) CHARACTER*1 00038 * Specifies whether the upper or lower triangular part of the 00039 * Hermitian matrix A is stored. 00040 * = 'U': Upper triangular 00041 * = 'L': Lower triangular 00042 * 00043 * N (input) INTEGER 00044 * The number of rows of the matrices X, B, and XACT, and the 00045 * order of the matrix A. N >= 0. 00046 * 00047 * NRHS (input) INTEGER 00048 * The number of columns of the matrices X, B, and XACT. 00049 * NRHS >= 0. 00050 * 00051 * AP (input) COMPLEX*16 array, dimension (N*(N+1)/2) 00052 * The upper or lower triangle of the Hermitian matrix A, packed 00053 * columnwise in a linear array. The j-th column of A is stored 00054 * in the array AP as follows: 00055 * if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j; 00056 * if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n. 00057 * 00058 * B (input) COMPLEX*16 array, dimension (LDB,NRHS) 00059 * The right hand side vectors for the system of linear 00060 * equations. 00061 * 00062 * LDB (input) INTEGER 00063 * The leading dimension of the array B. LDB >= max(1,N). 00064 * 00065 * X (input) COMPLEX*16 array, dimension (LDX,NRHS) 00066 * The computed solution vectors. Each vector is stored as a 00067 * column of the matrix X. 00068 * 00069 * LDX (input) INTEGER 00070 * The leading dimension of the array X. LDX >= max(1,N). 00071 * 00072 * XACT (input) COMPLEX*16 array, dimension (LDX,NRHS) 00073 * The exact solution vectors. Each vector is stored as a 00074 * column of the matrix XACT. 00075 * 00076 * LDXACT (input) INTEGER 00077 * The leading dimension of the array XACT. LDXACT >= max(1,N). 00078 * 00079 * FERR (input) DOUBLE PRECISION array, dimension (NRHS) 00080 * The estimated forward error bounds for each solution vector 00081 * X. If XTRUE is the true solution, FERR bounds the magnitude 00082 * of the largest entry in (X - XTRUE) divided by the magnitude 00083 * of the largest entry in X. 00084 * 00085 * BERR (input) DOUBLE PRECISION array, dimension (NRHS) 00086 * The componentwise relative backward error of each solution 00087 * vector (i.e., the smallest relative change in any entry of A 00088 * or B that makes X an exact solution). 00089 * 00090 * RESLTS (output) DOUBLE PRECISION array, dimension (2) 00091 * The maximum over the NRHS solution vectors of the ratios: 00092 * RESLTS(1) = norm(X - XACT) / ( norm(X) * FERR ) 00093 * RESLTS(2) = BERR / ( (n+1)*EPS + (*) ) 00094 * 00095 * ===================================================================== 00096 * 00097 * .. Parameters .. 00098 DOUBLE PRECISION ZERO, ONE 00099 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 ) 00100 * .. 00101 * .. Local Scalars .. 00102 LOGICAL UPPER 00103 INTEGER I, IMAX, J, JC, K 00104 DOUBLE PRECISION AXBI, DIFF, EPS, ERRBND, OVFL, TMP, UNFL, XNORM 00105 COMPLEX*16 ZDUM 00106 * .. 00107 * .. External Functions .. 00108 LOGICAL LSAME 00109 INTEGER IZAMAX 00110 DOUBLE PRECISION DLAMCH 00111 EXTERNAL LSAME, IZAMAX, DLAMCH 00112 * .. 00113 * .. Intrinsic Functions .. 00114 INTRINSIC ABS, DBLE, DIMAG, MAX, MIN 00115 * .. 00116 * .. Statement Functions .. 00117 DOUBLE PRECISION CABS1 00118 * .. 00119 * .. Statement Function definitions .. 00120 CABS1( ZDUM ) = ABS( DBLE( ZDUM ) ) + ABS( DIMAG( ZDUM ) ) 00121 * .. 00122 * .. Executable Statements .. 00123 * 00124 * Quick exit if N = 0 or NRHS = 0. 00125 * 00126 IF( N.LE.0 .OR. NRHS.LE.0 ) THEN 00127 RESLTS( 1 ) = ZERO 00128 RESLTS( 2 ) = ZERO 00129 RETURN 00130 END IF 00131 * 00132 EPS = DLAMCH( 'Epsilon' ) 00133 UNFL = DLAMCH( 'Safe minimum' ) 00134 OVFL = ONE / UNFL 00135 UPPER = LSAME( UPLO, 'U' ) 00136 * 00137 * Test 1: Compute the maximum of 00138 * norm(X - XACT) / ( norm(X) * FERR ) 00139 * over all the vectors X and XACT using the infinity-norm. 00140 * 00141 ERRBND = ZERO 00142 DO 30 J = 1, NRHS 00143 IMAX = IZAMAX( N, X( 1, J ), 1 ) 00144 XNORM = MAX( CABS1( X( IMAX, J ) ), UNFL ) 00145 DIFF = ZERO 00146 DO 10 I = 1, N 00147 DIFF = MAX( DIFF, CABS1( X( I, J )-XACT( I, J ) ) ) 00148 10 CONTINUE 00149 * 00150 IF( XNORM.GT.ONE ) THEN 00151 GO TO 20 00152 ELSE IF( DIFF.LE.OVFL*XNORM ) THEN 00153 GO TO 20 00154 ELSE 00155 ERRBND = ONE / EPS 00156 GO TO 30 00157 END IF 00158 * 00159 20 CONTINUE 00160 IF( DIFF / XNORM.LE.FERR( J ) ) THEN 00161 ERRBND = MAX( ERRBND, ( DIFF / XNORM ) / FERR( J ) ) 00162 ELSE 00163 ERRBND = ONE / EPS 00164 END IF 00165 30 CONTINUE 00166 RESLTS( 1 ) = ERRBND 00167 * 00168 * Test 2: Compute the maximum of BERR / ( (n+1)*EPS + (*) ), where 00169 * (*) = (n+1)*UNFL / (min_i (abs(A)*abs(X) +abs(b))_i ) 00170 * 00171 DO 90 K = 1, NRHS 00172 DO 80 I = 1, N 00173 TMP = CABS1( B( I, K ) ) 00174 IF( UPPER ) THEN 00175 JC = ( ( I-1 )*I ) / 2 00176 DO 40 J = 1, I - 1 00177 TMP = TMP + CABS1( AP( JC+J ) )*CABS1( X( J, K ) ) 00178 40 CONTINUE 00179 TMP = TMP + ABS( DBLE( AP( JC+I ) ) )*CABS1( X( I, K ) ) 00180 JC = JC + I + I 00181 DO 50 J = I + 1, N 00182 TMP = TMP + CABS1( AP( JC ) )*CABS1( X( J, K ) ) 00183 JC = JC + J 00184 50 CONTINUE 00185 ELSE 00186 JC = I 00187 DO 60 J = 1, I - 1 00188 TMP = TMP + CABS1( AP( JC ) )*CABS1( X( J, K ) ) 00189 JC = JC + N - J 00190 60 CONTINUE 00191 TMP = TMP + ABS( DBLE( AP( JC ) ) )*CABS1( X( I, K ) ) 00192 DO 70 J = I + 1, N 00193 TMP = TMP + CABS1( AP( JC+J-I ) )*CABS1( X( J, K ) ) 00194 70 CONTINUE 00195 END IF 00196 IF( I.EQ.1 ) THEN 00197 AXBI = TMP 00198 ELSE 00199 AXBI = MIN( AXBI, TMP ) 00200 END IF 00201 80 CONTINUE 00202 TMP = BERR( K ) / ( ( N+1 )*EPS+( N+1 )*UNFL / 00203 $ MAX( AXBI, ( N+1 )*UNFL ) ) 00204 IF( K.EQ.1 ) THEN 00205 RESLTS( 2 ) = TMP 00206 ELSE 00207 RESLTS( 2 ) = MAX( RESLTS( 2 ), TMP ) 00208 END IF 00209 90 CONTINUE 00210 * 00211 RETURN 00212 * 00213 * End of ZPPT05 00214 * 00215 END