![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b DLA_GERFSX_EXTENDED 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 *> \htmlonly 00009 *> Download DLA_GERFSX_EXTENDED + dependencies 00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dla_gerfsx_extended.f"> 00011 *> [TGZ]</a> 00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dla_gerfsx_extended.f"> 00013 *> [ZIP]</a> 00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dla_gerfsx_extended.f"> 00015 *> [TXT]</a> 00016 *> \endhtmlonly 00017 * 00018 * Definition: 00019 * =========== 00020 * 00021 * SUBROUTINE DLA_GERFSX_EXTENDED( PREC_TYPE, TRANS_TYPE, N, NRHS, A, 00022 * LDA, AF, LDAF, IPIV, COLEQU, C, B, 00023 * LDB, Y, LDY, BERR_OUT, N_NORMS, 00024 * ERRS_N, ERRS_C, RES, AYB, DY, 00025 * Y_TAIL, RCOND, ITHRESH, RTHRESH, 00026 * DZ_UB, IGNORE_CWISE, INFO ) 00027 * 00028 * .. Scalar Arguments .. 00029 * INTEGER INFO, LDA, LDAF, LDB, LDY, N, NRHS, PREC_TYPE, 00030 * $ TRANS_TYPE, N_NORMS, ITHRESH 00031 * LOGICAL COLEQU, IGNORE_CWISE 00032 * DOUBLE PRECISION RTHRESH, DZ_UB 00033 * .. 00034 * .. Array Arguments .. 00035 * INTEGER IPIV( * ) 00036 * DOUBLE PRECISION A( LDA, * ), AF( LDAF, * ), B( LDB, * ), 00037 * $ Y( LDY, * ), RES( * ), DY( * ), Y_TAIL( * ) 00038 * DOUBLE PRECISION C( * ), AYB( * ), RCOND, BERR_OUT( * ), 00039 * $ ERRS_N( NRHS, * ), ERRS_C( NRHS, * ) 00040 * .. 00041 * 00042 * 00043 *> \par Purpose: 00044 * ============= 00045 *> 00046 *> \verbatim 00047 *> 00048 *> 00049 *> DLA_GERFSX_EXTENDED improves the computed solution to a system of 00050 *> linear equations by performing extra-precise iterative refinement 00051 *> and provides error bounds and backward error estimates for the solution. 00052 *> This subroutine is called by DGERFSX to perform iterative refinement. 00053 *> In addition to normwise error bound, the code provides maximum 00054 *> componentwise error bound if possible. See comments for ERRS_N 00055 *> and ERRS_C for details of the error bounds. Note that this 00056 *> subroutine is only resonsible for setting the second fields of 00057 *> ERRS_N and ERRS_C. 00058 *> \endverbatim 00059 * 00060 * Arguments: 00061 * ========== 00062 * 00063 *> \param[in] PREC_TYPE 00064 *> \verbatim 00065 *> PREC_TYPE is INTEGER 00066 *> Specifies the intermediate precision to be used in refinement. 00067 *> The value is defined by ILAPREC(P) where P is a CHARACTER and 00068 *> P = 'S': Single 00069 *> = 'D': Double 00070 *> = 'I': Indigenous 00071 *> = 'X', 'E': Extra 00072 *> \endverbatim 00073 *> 00074 *> \param[in] TRANS_TYPE 00075 *> \verbatim 00076 *> TRANS_TYPE is INTEGER 00077 *> Specifies the transposition operation on A. 00078 *> The value is defined by ILATRANS(T) where T is a CHARACTER and 00079 *> T = 'N': No transpose 00080 *> = 'T': Transpose 00081 *> = 'C': Conjugate transpose 00082 *> \endverbatim 00083 *> 00084 *> \param[in] N 00085 *> \verbatim 00086 *> N is INTEGER 00087 *> The number of linear equations, i.e., the order of the 00088 *> matrix A. N >= 0. 00089 *> \endverbatim 00090 *> 00091 *> \param[in] NRHS 00092 *> \verbatim 00093 *> NRHS is INTEGER 00094 *> The number of right-hand-sides, i.e., the number of columns of the 00095 *> matrix B. 00096 *> \endverbatim 00097 *> 00098 *> \param[in] A 00099 *> \verbatim 00100 *> A is DOUBLE PRECISION array, dimension (LDA,N) 00101 *> On entry, the N-by-N matrix A. 00102 *> \endverbatim 00103 *> 00104 *> \param[in] LDA 00105 *> \verbatim 00106 *> LDA is INTEGER 00107 *> The leading dimension of the array A. LDA >= max(1,N). 00108 *> \endverbatim 00109 *> 00110 *> \param[in] AF 00111 *> \verbatim 00112 *> AF is DOUBLE PRECISION array, dimension (LDAF,N) 00113 *> The factors L and U from the factorization 00114 *> A = P*L*U as computed by DGETRF. 00115 *> \endverbatim 00116 *> 00117 *> \param[in] LDAF 00118 *> \verbatim 00119 *> LDAF is INTEGER 00120 *> The leading dimension of the array AF. LDAF >= max(1,N). 00121 *> \endverbatim 00122 *> 00123 *> \param[in] IPIV 00124 *> \verbatim 00125 *> IPIV is INTEGER array, dimension (N) 00126 *> The pivot indices from the factorization A = P*L*U 00127 *> as computed by DGETRF; row i of the matrix was interchanged 00128 *> with row IPIV(i). 00129 *> \endverbatim 00130 *> 00131 *> \param[in] COLEQU 00132 *> \verbatim 00133 *> COLEQU is LOGICAL 00134 *> If .TRUE. then column equilibration was done to A before calling 00135 *> this routine. This is needed to compute the solution and error 00136 *> bounds correctly. 00137 *> \endverbatim 00138 *> 00139 *> \param[in] C 00140 *> \verbatim 00141 *> C is DOUBLE PRECISION array, dimension (N) 00142 *> The column scale factors for A. If COLEQU = .FALSE., C 00143 *> is not accessed. If C is input, each element of C should be a power 00144 *> of the radix to ensure a reliable solution and error estimates. 00145 *> Scaling by powers of the radix does not cause rounding errors unless 00146 *> the result underflows or overflows. Rounding errors during scaling 00147 *> lead to refining with a matrix that is not equivalent to the 00148 *> input matrix, producing error estimates that may not be 00149 *> reliable. 00150 *> \endverbatim 00151 *> 00152 *> \param[in] B 00153 *> \verbatim 00154 *> B is DOUBLE PRECISION array, dimension (LDB,NRHS) 00155 *> The right-hand-side matrix B. 00156 *> \endverbatim 00157 *> 00158 *> \param[in] LDB 00159 *> \verbatim 00160 *> LDB is INTEGER 00161 *> The leading dimension of the array B. LDB >= max(1,N). 00162 *> \endverbatim 00163 *> 00164 *> \param[in,out] Y 00165 *> \verbatim 00166 *> Y is DOUBLE PRECISION array, dimension 00167 *> (LDY,NRHS) 00168 *> On entry, the solution matrix X, as computed by DGETRS. 00169 *> On exit, the improved solution matrix Y. 00170 *> \endverbatim 00171 *> 00172 *> \param[in] LDY 00173 *> \verbatim 00174 *> LDY is INTEGER 00175 *> The leading dimension of the array Y. LDY >= max(1,N). 00176 *> \endverbatim 00177 *> 00178 *> \param[out] BERR_OUT 00179 *> \verbatim 00180 *> BERR_OUT is DOUBLE PRECISION array, dimension (NRHS) 00181 *> On exit, BERR_OUT(j) contains the componentwise relative backward 00182 *> error for right-hand-side j from the formula 00183 *> max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) ) 00184 *> where abs(Z) is the componentwise absolute value of the matrix 00185 *> or vector Z. This is computed by DLA_LIN_BERR. 00186 *> \endverbatim 00187 *> 00188 *> \param[in] N_NORMS 00189 *> \verbatim 00190 *> N_NORMS is INTEGER 00191 *> Determines which error bounds to return (see ERRS_N 00192 *> and ERRS_C). 00193 *> If N_NORMS >= 1 return normwise error bounds. 00194 *> If N_NORMS >= 2 return componentwise error bounds. 00195 *> \endverbatim 00196 *> 00197 *> \param[in,out] ERRS_N 00198 *> \verbatim 00199 *> ERRS_N is DOUBLE PRECISION array, dimension 00200 *> (NRHS, N_ERR_BNDS) 00201 *> For each right-hand side, this array contains information about 00202 *> various error bounds and condition numbers corresponding to the 00203 *> normwise relative error, which is defined as follows: 00204 *> 00205 *> Normwise relative error in the ith solution vector: 00206 *> max_j (abs(XTRUE(j,i) - X(j,i))) 00207 *> ------------------------------ 00208 *> max_j abs(X(j,i)) 00209 *> 00210 *> The array is indexed by the type of error information as described 00211 *> below. There currently are up to three pieces of information 00212 *> returned. 00213 *> 00214 *> The first index in ERRS_N(i,:) corresponds to the ith 00215 *> right-hand side. 00216 *> 00217 *> The second index in ERRS_N(:,err) contains the following 00218 *> three fields: 00219 *> err = 1 "Trust/don't trust" boolean. Trust the answer if the 00220 *> reciprocal condition number is less than the threshold 00221 *> sqrt(n) * slamch('Epsilon'). 00222 *> 00223 *> err = 2 "Guaranteed" error bound: The estimated forward error, 00224 *> almost certainly within a factor of 10 of the true error 00225 *> so long as the next entry is greater than the threshold 00226 *> sqrt(n) * slamch('Epsilon'). This error bound should only 00227 *> be trusted if the previous boolean is true. 00228 *> 00229 *> err = 3 Reciprocal condition number: Estimated normwise 00230 *> reciprocal condition number. Compared with the threshold 00231 *> sqrt(n) * slamch('Epsilon') to determine if the error 00232 *> estimate is "guaranteed". These reciprocal condition 00233 *> numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some 00234 *> appropriately scaled matrix Z. 00235 *> Let Z = S*A, where S scales each row by a power of the 00236 *> radix so all absolute row sums of Z are approximately 1. 00237 *> 00238 *> This subroutine is only responsible for setting the second field 00239 *> above. 00240 *> See Lapack Working Note 165 for further details and extra 00241 *> cautions. 00242 *> \endverbatim 00243 *> 00244 *> \param[in,out] ERRS_C 00245 *> \verbatim 00246 *> ERRS_C is DOUBLE PRECISION array, dimension 00247 *> (NRHS, N_ERR_BNDS) 00248 *> For each right-hand side, this array contains information about 00249 *> various error bounds and condition numbers corresponding to the 00250 *> componentwise relative error, which is defined as follows: 00251 *> 00252 *> Componentwise relative error in the ith solution vector: 00253 *> abs(XTRUE(j,i) - X(j,i)) 00254 *> max_j ---------------------- 00255 *> abs(X(j,i)) 00256 *> 00257 *> The array is indexed by the right-hand side i (on which the 00258 *> componentwise relative error depends), and the type of error 00259 *> information as described below. There currently are up to three 00260 *> pieces of information returned for each right-hand side. If 00261 *> componentwise accuracy is not requested (PARAMS(3) = 0.0), then 00262 *> ERRS_C is not accessed. If N_ERR_BNDS .LT. 3, then at most 00263 *> the first (:,N_ERR_BNDS) entries are returned. 00264 *> 00265 *> The first index in ERRS_C(i,:) corresponds to the ith 00266 *> right-hand side. 00267 *> 00268 *> The second index in ERRS_C(:,err) contains the following 00269 *> three fields: 00270 *> err = 1 "Trust/don't trust" boolean. Trust the answer if the 00271 *> reciprocal condition number is less than the threshold 00272 *> sqrt(n) * slamch('Epsilon'). 00273 *> 00274 *> err = 2 "Guaranteed" error bound: The estimated forward error, 00275 *> almost certainly within a factor of 10 of the true error 00276 *> so long as the next entry is greater than the threshold 00277 *> sqrt(n) * slamch('Epsilon'). This error bound should only 00278 *> be trusted if the previous boolean is true. 00279 *> 00280 *> err = 3 Reciprocal condition number: Estimated componentwise 00281 *> reciprocal condition number. Compared with the threshold 00282 *> sqrt(n) * slamch('Epsilon') to determine if the error 00283 *> estimate is "guaranteed". These reciprocal condition 00284 *> numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some 00285 *> appropriately scaled matrix Z. 00286 *> Let Z = S*(A*diag(x)), where x is the solution for the 00287 *> current right-hand side and S scales each row of 00288 *> A*diag(x) by a power of the radix so all absolute row 00289 *> sums of Z are approximately 1. 00290 *> 00291 *> This subroutine is only responsible for setting the second field 00292 *> above. 00293 *> See Lapack Working Note 165 for further details and extra 00294 *> cautions. 00295 *> \endverbatim 00296 *> 00297 *> \param[in] RES 00298 *> \verbatim 00299 *> RES is DOUBLE PRECISION array, dimension (N) 00300 *> Workspace to hold the intermediate residual. 00301 *> \endverbatim 00302 *> 00303 *> \param[in] AYB 00304 *> \verbatim 00305 *> AYB is DOUBLE PRECISION array, dimension (N) 00306 *> Workspace. This can be the same workspace passed for Y_TAIL. 00307 *> \endverbatim 00308 *> 00309 *> \param[in] DY 00310 *> \verbatim 00311 *> DY is DOUBLE PRECISION array, dimension (N) 00312 *> Workspace to hold the intermediate solution. 00313 *> \endverbatim 00314 *> 00315 *> \param[in] Y_TAIL 00316 *> \verbatim 00317 *> Y_TAIL is DOUBLE PRECISION array, dimension (N) 00318 *> Workspace to hold the trailing bits of the intermediate solution. 00319 *> \endverbatim 00320 *> 00321 *> \param[in] RCOND 00322 *> \verbatim 00323 *> RCOND is DOUBLE PRECISION 00324 *> Reciprocal scaled condition number. This is an estimate of the 00325 *> reciprocal Skeel condition number of the matrix A after 00326 *> equilibration (if done). If this is less than the machine 00327 *> precision (in particular, if it is zero), the matrix is singular 00328 *> to working precision. Note that the error may still be small even 00329 *> if this number is very small and the matrix appears ill- 00330 *> conditioned. 00331 *> \endverbatim 00332 *> 00333 *> \param[in] ITHRESH 00334 *> \verbatim 00335 *> ITHRESH is INTEGER 00336 *> The maximum number of residual computations allowed for 00337 *> refinement. The default is 10. For 'aggressive' set to 100 to 00338 *> permit convergence using approximate factorizations or 00339 *> factorizations other than LU. If the factorization uses a 00340 *> technique other than Gaussian elimination, the guarantees in 00341 *> ERRS_N and ERRS_C may no longer be trustworthy. 00342 *> \endverbatim 00343 *> 00344 *> \param[in] RTHRESH 00345 *> \verbatim 00346 *> RTHRESH is DOUBLE PRECISION 00347 *> Determines when to stop refinement if the error estimate stops 00348 *> decreasing. Refinement will stop when the next solution no longer 00349 *> satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is 00350 *> the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The 00351 *> default value is 0.5. For 'aggressive' set to 0.9 to permit 00352 *> convergence on extremely ill-conditioned matrices. See LAWN 165 00353 *> for more details. 00354 *> \endverbatim 00355 *> 00356 *> \param[in] DZ_UB 00357 *> \verbatim 00358 *> DZ_UB is DOUBLE PRECISION 00359 *> Determines when to start considering componentwise convergence. 00360 *> Componentwise convergence is only considered after each component 00361 *> of the solution Y is stable, which we definte as the relative 00362 *> change in each component being less than DZ_UB. The default value 00363 *> is 0.25, requiring the first bit to be stable. See LAWN 165 for 00364 *> more details. 00365 *> \endverbatim 00366 *> 00367 *> \param[in] IGNORE_CWISE 00368 *> \verbatim 00369 *> IGNORE_CWISE is LOGICAL 00370 *> If .TRUE. then ignore componentwise convergence. Default value 00371 *> is .FALSE.. 00372 *> \endverbatim 00373 *> 00374 *> \param[out] INFO 00375 *> \verbatim 00376 *> INFO is INTEGER 00377 *> = 0: Successful exit. 00378 *> < 0: if INFO = -i, the ith argument to DGETRS had an illegal 00379 *> value 00380 *> \endverbatim 00381 * 00382 * Authors: 00383 * ======== 00384 * 00385 *> \author Univ. of Tennessee 00386 *> \author Univ. of California Berkeley 00387 *> \author Univ. of Colorado Denver 00388 *> \author NAG Ltd. 00389 * 00390 *> \date November 2011 00391 * 00392 *> \ingroup doubleGEcomputational 00393 * 00394 * ===================================================================== 00395 SUBROUTINE DLA_GERFSX_EXTENDED( PREC_TYPE, TRANS_TYPE, N, NRHS, A, 00396 $ LDA, AF, LDAF, IPIV, COLEQU, C, B, 00397 $ LDB, Y, LDY, BERR_OUT, N_NORMS, 00398 $ ERRS_N, ERRS_C, RES, AYB, DY, 00399 $ Y_TAIL, RCOND, ITHRESH, RTHRESH, 00400 $ DZ_UB, IGNORE_CWISE, INFO ) 00401 * 00402 * -- LAPACK computational routine (version 3.4.0) -- 00403 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00404 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00405 * November 2011 00406 * 00407 * .. Scalar Arguments .. 00408 INTEGER INFO, LDA, LDAF, LDB, LDY, N, NRHS, PREC_TYPE, 00409 $ TRANS_TYPE, N_NORMS, ITHRESH 00410 LOGICAL COLEQU, IGNORE_CWISE 00411 DOUBLE PRECISION RTHRESH, DZ_UB 00412 * .. 00413 * .. Array Arguments .. 00414 INTEGER IPIV( * ) 00415 DOUBLE PRECISION A( LDA, * ), AF( LDAF, * ), B( LDB, * ), 00416 $ Y( LDY, * ), RES( * ), DY( * ), Y_TAIL( * ) 00417 DOUBLE PRECISION C( * ), AYB( * ), RCOND, BERR_OUT( * ), 00418 $ ERRS_N( NRHS, * ), ERRS_C( NRHS, * ) 00419 * .. 00420 * 00421 * ===================================================================== 00422 * 00423 * .. Local Scalars .. 00424 CHARACTER TRANS 00425 INTEGER CNT, I, J, X_STATE, Z_STATE, Y_PREC_STATE 00426 DOUBLE PRECISION YK, DYK, YMIN, NORMY, NORMX, NORMDX, DXRAT, 00427 $ DZRAT, PREVNORMDX, PREV_DZ_Z, DXRATMAX, 00428 $ DZRATMAX, DX_X, DZ_Z, FINAL_DX_X, FINAL_DZ_Z, 00429 $ EPS, HUGEVAL, INCR_THRESH 00430 LOGICAL INCR_PREC 00431 * .. 00432 * .. Parameters .. 00433 INTEGER UNSTABLE_STATE, WORKING_STATE, CONV_STATE, 00434 $ NOPROG_STATE, BASE_RESIDUAL, EXTRA_RESIDUAL, 00435 $ EXTRA_Y 00436 PARAMETER ( UNSTABLE_STATE = 0, WORKING_STATE = 1, 00437 $ CONV_STATE = 2, NOPROG_STATE = 3 ) 00438 PARAMETER ( BASE_RESIDUAL = 0, EXTRA_RESIDUAL = 1, 00439 $ EXTRA_Y = 2 ) 00440 INTEGER FINAL_NRM_ERR_I, FINAL_CMP_ERR_I, BERR_I 00441 INTEGER RCOND_I, NRM_RCOND_I, NRM_ERR_I, CMP_RCOND_I 00442 INTEGER CMP_ERR_I, PIV_GROWTH_I 00443 PARAMETER ( FINAL_NRM_ERR_I = 1, FINAL_CMP_ERR_I = 2, 00444 $ BERR_I = 3 ) 00445 PARAMETER ( RCOND_I = 4, NRM_RCOND_I = 5, NRM_ERR_I = 6 ) 00446 PARAMETER ( CMP_RCOND_I = 7, CMP_ERR_I = 8, 00447 $ PIV_GROWTH_I = 9 ) 00448 INTEGER LA_LINRX_ITREF_I, LA_LINRX_ITHRESH_I, 00449 $ LA_LINRX_CWISE_I 00450 PARAMETER ( LA_LINRX_ITREF_I = 1, 00451 $ LA_LINRX_ITHRESH_I = 2 ) 00452 PARAMETER ( LA_LINRX_CWISE_I = 3 ) 00453 INTEGER LA_LINRX_TRUST_I, LA_LINRX_ERR_I, 00454 $ LA_LINRX_RCOND_I 00455 PARAMETER ( LA_LINRX_TRUST_I = 1, LA_LINRX_ERR_I = 2 ) 00456 PARAMETER ( LA_LINRX_RCOND_I = 3 ) 00457 * .. 00458 * .. External Subroutines .. 00459 EXTERNAL DAXPY, DCOPY, DGETRS, DGEMV, BLAS_DGEMV_X, 00460 $ BLAS_DGEMV2_X, DLA_GEAMV, DLA_WWADDW, DLAMCH, 00461 $ CHLA_TRANSTYPE, DLA_LIN_BERR 00462 DOUBLE PRECISION DLAMCH 00463 CHARACTER CHLA_TRANSTYPE 00464 * .. 00465 * .. Intrinsic Functions .. 00466 INTRINSIC ABS, MAX, MIN 00467 * .. 00468 * .. Executable Statements .. 00469 * 00470 IF ( INFO.NE.0 ) RETURN 00471 TRANS = CHLA_TRANSTYPE(TRANS_TYPE) 00472 EPS = DLAMCH( 'Epsilon' ) 00473 HUGEVAL = DLAMCH( 'Overflow' ) 00474 * Force HUGEVAL to Inf 00475 HUGEVAL = HUGEVAL * HUGEVAL 00476 * Using HUGEVAL may lead to spurious underflows. 00477 INCR_THRESH = DBLE( N ) * EPS 00478 * 00479 DO J = 1, NRHS 00480 Y_PREC_STATE = EXTRA_RESIDUAL 00481 IF ( Y_PREC_STATE .EQ. EXTRA_Y ) THEN 00482 DO I = 1, N 00483 Y_TAIL( I ) = 0.0D+0 00484 END DO 00485 END IF 00486 00487 DXRAT = 0.0D+0 00488 DXRATMAX = 0.0D+0 00489 DZRAT = 0.0D+0 00490 DZRATMAX = 0.0D+0 00491 FINAL_DX_X = HUGEVAL 00492 FINAL_DZ_Z = HUGEVAL 00493 PREVNORMDX = HUGEVAL 00494 PREV_DZ_Z = HUGEVAL 00495 DZ_Z = HUGEVAL 00496 DX_X = HUGEVAL 00497 00498 X_STATE = WORKING_STATE 00499 Z_STATE = UNSTABLE_STATE 00500 INCR_PREC = .FALSE. 00501 00502 DO CNT = 1, ITHRESH 00503 * 00504 * Compute residual RES = B_s - op(A_s) * Y, 00505 * op(A) = A, A**T, or A**H depending on TRANS (and type). 00506 * 00507 CALL DCOPY( N, B( 1, J ), 1, RES, 1 ) 00508 IF ( Y_PREC_STATE .EQ. BASE_RESIDUAL ) THEN 00509 CALL DGEMV( TRANS, N, N, -1.0D+0, A, LDA, Y( 1, J ), 1, 00510 $ 1.0D+0, RES, 1 ) 00511 ELSE IF ( Y_PREC_STATE .EQ. EXTRA_RESIDUAL ) THEN 00512 CALL BLAS_DGEMV_X( TRANS_TYPE, N, N, -1.0D+0, A, LDA, 00513 $ Y( 1, J ), 1, 1.0D+0, RES, 1, PREC_TYPE ) 00514 ELSE 00515 CALL BLAS_DGEMV2_X( TRANS_TYPE, N, N, -1.0D+0, A, LDA, 00516 $ Y( 1, J ), Y_TAIL, 1, 1.0D+0, RES, 1, PREC_TYPE ) 00517 END IF 00518 00519 ! XXX: RES is no longer needed. 00520 CALL DCOPY( N, RES, 1, DY, 1 ) 00521 CALL DGETRS( TRANS, N, 1, AF, LDAF, IPIV, DY, N, INFO ) 00522 * 00523 * Calculate relative changes DX_X, DZ_Z and ratios DXRAT, DZRAT. 00524 * 00525 NORMX = 0.0D+0 00526 NORMY = 0.0D+0 00527 NORMDX = 0.0D+0 00528 DZ_Z = 0.0D+0 00529 YMIN = HUGEVAL 00530 * 00531 DO I = 1, N 00532 YK = ABS( Y( I, J ) ) 00533 DYK = ABS( DY( I ) ) 00534 00535 IF ( YK .NE. 0.0D+0 ) THEN 00536 DZ_Z = MAX( DZ_Z, DYK / YK ) 00537 ELSE IF ( DYK .NE. 0.0D+0 ) THEN 00538 DZ_Z = HUGEVAL 00539 END IF 00540 00541 YMIN = MIN( YMIN, YK ) 00542 00543 NORMY = MAX( NORMY, YK ) 00544 00545 IF ( COLEQU ) THEN 00546 NORMX = MAX( NORMX, YK * C( I ) ) 00547 NORMDX = MAX( NORMDX, DYK * C( I ) ) 00548 ELSE 00549 NORMX = NORMY 00550 NORMDX = MAX( NORMDX, DYK ) 00551 END IF 00552 END DO 00553 00554 IF ( NORMX .NE. 0.0D+0 ) THEN 00555 DX_X = NORMDX / NORMX 00556 ELSE IF ( NORMDX .EQ. 0.0D+0 ) THEN 00557 DX_X = 0.0D+0 00558 ELSE 00559 DX_X = HUGEVAL 00560 END IF 00561 00562 DXRAT = NORMDX / PREVNORMDX 00563 DZRAT = DZ_Z / PREV_DZ_Z 00564 * 00565 * Check termination criteria 00566 * 00567 IF (.NOT.IGNORE_CWISE 00568 $ .AND. YMIN*RCOND .LT. INCR_THRESH*NORMY 00569 $ .AND. Y_PREC_STATE .LT. EXTRA_Y) 00570 $ INCR_PREC = .TRUE. 00571 00572 IF ( X_STATE .EQ. NOPROG_STATE .AND. DXRAT .LE. RTHRESH ) 00573 $ X_STATE = WORKING_STATE 00574 IF ( X_STATE .EQ. WORKING_STATE ) THEN 00575 IF ( DX_X .LE. EPS ) THEN 00576 X_STATE = CONV_STATE 00577 ELSE IF ( DXRAT .GT. RTHRESH ) THEN 00578 IF ( Y_PREC_STATE .NE. EXTRA_Y ) THEN 00579 INCR_PREC = .TRUE. 00580 ELSE 00581 X_STATE = NOPROG_STATE 00582 END IF 00583 ELSE 00584 IF ( DXRAT .GT. DXRATMAX ) DXRATMAX = DXRAT 00585 END IF 00586 IF ( X_STATE .GT. WORKING_STATE ) FINAL_DX_X = DX_X 00587 END IF 00588 00589 IF ( Z_STATE .EQ. UNSTABLE_STATE .AND. DZ_Z .LE. DZ_UB ) 00590 $ Z_STATE = WORKING_STATE 00591 IF ( Z_STATE .EQ. NOPROG_STATE .AND. DZRAT .LE. RTHRESH ) 00592 $ Z_STATE = WORKING_STATE 00593 IF ( Z_STATE .EQ. WORKING_STATE ) THEN 00594 IF ( DZ_Z .LE. EPS ) THEN 00595 Z_STATE = CONV_STATE 00596 ELSE IF ( DZ_Z .GT. DZ_UB ) THEN 00597 Z_STATE = UNSTABLE_STATE 00598 DZRATMAX = 0.0D+0 00599 FINAL_DZ_Z = HUGEVAL 00600 ELSE IF ( DZRAT .GT. RTHRESH ) THEN 00601 IF ( Y_PREC_STATE .NE. EXTRA_Y ) THEN 00602 INCR_PREC = .TRUE. 00603 ELSE 00604 Z_STATE = NOPROG_STATE 00605 END IF 00606 ELSE 00607 IF ( DZRAT .GT. DZRATMAX ) DZRATMAX = DZRAT 00608 END IF 00609 IF ( Z_STATE .GT. WORKING_STATE ) FINAL_DZ_Z = DZ_Z 00610 END IF 00611 * 00612 * Exit if both normwise and componentwise stopped working, 00613 * but if componentwise is unstable, let it go at least two 00614 * iterations. 00615 * 00616 IF ( X_STATE.NE.WORKING_STATE ) THEN 00617 IF ( IGNORE_CWISE) GOTO 666 00618 IF ( Z_STATE.EQ.NOPROG_STATE .OR. Z_STATE.EQ.CONV_STATE ) 00619 $ GOTO 666 00620 IF ( Z_STATE.EQ.UNSTABLE_STATE .AND. CNT.GT.1 ) GOTO 666 00621 END IF 00622 00623 IF ( INCR_PREC ) THEN 00624 INCR_PREC = .FALSE. 00625 Y_PREC_STATE = Y_PREC_STATE + 1 00626 DO I = 1, N 00627 Y_TAIL( I ) = 0.0D+0 00628 END DO 00629 END IF 00630 00631 PREVNORMDX = NORMDX 00632 PREV_DZ_Z = DZ_Z 00633 * 00634 * Update soluton. 00635 * 00636 IF ( Y_PREC_STATE .LT. EXTRA_Y ) THEN 00637 CALL DAXPY( N, 1.0D+0, DY, 1, Y( 1, J ), 1 ) 00638 ELSE 00639 CALL DLA_WWADDW( N, Y( 1, J ), Y_TAIL, DY ) 00640 END IF 00641 00642 END DO 00643 * Target of "IF (Z_STOP .AND. X_STOP)". Sun's f77 won't EXIT. 00644 666 CONTINUE 00645 * 00646 * Set final_* when cnt hits ithresh. 00647 * 00648 IF ( X_STATE .EQ. WORKING_STATE ) FINAL_DX_X = DX_X 00649 IF ( Z_STATE .EQ. WORKING_STATE ) FINAL_DZ_Z = DZ_Z 00650 * 00651 * Compute error bounds 00652 * 00653 IF (N_NORMS .GE. 1) THEN 00654 ERRS_N( J, LA_LINRX_ERR_I ) = FINAL_DX_X / (1 - DXRATMAX) 00655 END IF 00656 IF ( N_NORMS .GE. 2 ) THEN 00657 ERRS_C( J, LA_LINRX_ERR_I ) = FINAL_DZ_Z / (1 - DZRATMAX) 00658 END IF 00659 * 00660 * Compute componentwise relative backward error from formula 00661 * max(i) ( abs(R(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) ) 00662 * where abs(Z) is the componentwise absolute value of the matrix 00663 * or vector Z. 00664 * 00665 * Compute residual RES = B_s - op(A_s) * Y, 00666 * op(A) = A, A**T, or A**H depending on TRANS (and type). 00667 * 00668 CALL DCOPY( N, B( 1, J ), 1, RES, 1 ) 00669 CALL DGEMV( TRANS, N, N, -1.0D+0, A, LDA, Y(1,J), 1, 1.0D+0, 00670 $ RES, 1 ) 00671 00672 DO I = 1, N 00673 AYB( I ) = ABS( B( I, J ) ) 00674 END DO 00675 * 00676 * Compute abs(op(A_s))*abs(Y) + abs(B_s). 00677 * 00678 CALL DLA_GEAMV ( TRANS_TYPE, N, N, 1.0D+0, 00679 $ A, LDA, Y(1, J), 1, 1.0D+0, AYB, 1 ) 00680 00681 CALL DLA_LIN_BERR ( N, N, 1, RES, AYB, BERR_OUT( J ) ) 00682 * 00683 * End of loop for each RHS. 00684 * 00685 END DO 00686 * 00687 RETURN 00688 END