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