![]() |
LAPACK
3.4.0
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 SSYTRS 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 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 IF ( INFO.NE.0 ) RETURN 00473 EPS = SLAMCH( 'Epsilon' ) 00474 HUGEVAL = SLAMCH( 'Overflow' ) 00475 * Force HUGEVAL to Inf 00476 HUGEVAL = HUGEVAL * HUGEVAL 00477 * Using HUGEVAL may lead to spurious underflows. 00478 INCR_THRESH = REAL( N )*EPS 00479 00480 IF ( LSAME ( UPLO, 'L' ) ) THEN 00481 UPLO2 = ILAUPLO( 'L' ) 00482 ELSE 00483 UPLO2 = ILAUPLO( 'U' ) 00484 ENDIF 00485 00486 DO J = 1, NRHS 00487 Y_PREC_STATE = EXTRA_RESIDUAL 00488 IF ( Y_PREC_STATE .EQ. EXTRA_Y ) THEN 00489 DO I = 1, N 00490 Y_TAIL( I ) = 0.0 00491 END DO 00492 END IF 00493 00494 DXRAT = 0.0 00495 DXRATMAX = 0.0 00496 DZRAT = 0.0 00497 DZRATMAX = 0.0 00498 FINAL_DX_X = HUGEVAL 00499 FINAL_DZ_Z = HUGEVAL 00500 PREVNORMDX = HUGEVAL 00501 PREV_DZ_Z = HUGEVAL 00502 DZ_Z = HUGEVAL 00503 DX_X = HUGEVAL 00504 00505 X_STATE = WORKING_STATE 00506 Z_STATE = UNSTABLE_STATE 00507 INCR_PREC = .FALSE. 00508 00509 DO CNT = 1, ITHRESH 00510 * 00511 * Compute residual RES = B_s - op(A_s) * Y, 00512 * op(A) = A, A**T, or A**H depending on TRANS (and type). 00513 * 00514 CALL SCOPY( N, B( 1, J ), 1, RES, 1 ) 00515 IF (Y_PREC_STATE .EQ. BASE_RESIDUAL) THEN 00516 CALL SSYMV( UPLO, N, -1.0, A, LDA, Y(1,J), 1, 00517 $ 1.0, RES, 1 ) 00518 ELSE IF (Y_PREC_STATE .EQ. EXTRA_RESIDUAL) THEN 00519 CALL BLAS_SSYMV_X( UPLO2, N, -1.0, A, LDA, 00520 $ Y( 1, J ), 1, 1.0, RES, 1, PREC_TYPE ) 00521 ELSE 00522 CALL BLAS_SSYMV2_X(UPLO2, N, -1.0, A, LDA, 00523 $ Y(1, J), Y_TAIL, 1, 1.0, RES, 1, PREC_TYPE) 00524 END IF 00525 00526 ! XXX: RES is no longer needed. 00527 CALL SCOPY( N, RES, 1, DY, 1 ) 00528 CALL SSYTRS( UPLO, N, 1, AF, LDAF, IPIV, DY, N, INFO ) 00529 * 00530 * Calculate relative changes DX_X, DZ_Z and ratios DXRAT, DZRAT. 00531 * 00532 NORMX = 0.0 00533 NORMY = 0.0 00534 NORMDX = 0.0 00535 DZ_Z = 0.0 00536 YMIN = HUGEVAL 00537 00538 DO I = 1, N 00539 YK = ABS( Y( I, J ) ) 00540 DYK = ABS( DY( I ) ) 00541 00542 IF ( YK .NE. 0.0 ) THEN 00543 DZ_Z = MAX( DZ_Z, DYK / YK ) 00544 ELSE IF ( DYK .NE. 0.0 ) THEN 00545 DZ_Z = HUGEVAL 00546 END IF 00547 00548 YMIN = MIN( YMIN, YK ) 00549 00550 NORMY = MAX( NORMY, YK ) 00551 00552 IF ( COLEQU ) THEN 00553 NORMX = MAX( NORMX, YK * C( I ) ) 00554 NORMDX = MAX( NORMDX, DYK * C( I ) ) 00555 ELSE 00556 NORMX = NORMY 00557 NORMDX = MAX(NORMDX, DYK) 00558 END IF 00559 END DO 00560 00561 IF ( NORMX .NE. 0.0 ) THEN 00562 DX_X = NORMDX / NORMX 00563 ELSE IF ( NORMDX .EQ. 0.0 ) THEN 00564 DX_X = 0.0 00565 ELSE 00566 DX_X = HUGEVAL 00567 END IF 00568 00569 DXRAT = NORMDX / PREVNORMDX 00570 DZRAT = DZ_Z / PREV_DZ_Z 00571 * 00572 * Check termination criteria. 00573 * 00574 IF ( YMIN*RCOND .LT. INCR_THRESH*NORMY 00575 $ .AND. Y_PREC_STATE .LT. EXTRA_Y ) 00576 $ INCR_PREC = .TRUE. 00577 00578 IF ( X_STATE .EQ. NOPROG_STATE .AND. DXRAT .LE. RTHRESH ) 00579 $ X_STATE = WORKING_STATE 00580 IF ( X_STATE .EQ. WORKING_STATE ) THEN 00581 IF ( DX_X .LE. EPS ) THEN 00582 X_STATE = CONV_STATE 00583 ELSE IF ( DXRAT .GT. RTHRESH ) THEN 00584 IF ( Y_PREC_STATE .NE. EXTRA_Y ) THEN 00585 INCR_PREC = .TRUE. 00586 ELSE 00587 X_STATE = NOPROG_STATE 00588 END IF 00589 ELSE 00590 IF ( DXRAT .GT. DXRATMAX ) DXRATMAX = DXRAT 00591 END IF 00592 IF ( X_STATE .GT. WORKING_STATE ) FINAL_DX_X = DX_X 00593 END IF 00594 00595 IF ( Z_STATE .EQ. UNSTABLE_STATE .AND. DZ_Z .LE. DZ_UB ) 00596 $ Z_STATE = WORKING_STATE 00597 IF ( Z_STATE .EQ. NOPROG_STATE .AND. DZRAT .LE. RTHRESH ) 00598 $ Z_STATE = WORKING_STATE 00599 IF ( Z_STATE .EQ. WORKING_STATE ) THEN 00600 IF ( DZ_Z .LE. EPS ) THEN 00601 Z_STATE = CONV_STATE 00602 ELSE IF ( DZ_Z .GT. DZ_UB ) THEN 00603 Z_STATE = UNSTABLE_STATE 00604 DZRATMAX = 0.0 00605 FINAL_DZ_Z = HUGEVAL 00606 ELSE IF ( DZRAT .GT. RTHRESH ) THEN 00607 IF ( Y_PREC_STATE .NE. EXTRA_Y ) THEN 00608 INCR_PREC = .TRUE. 00609 ELSE 00610 Z_STATE = NOPROG_STATE 00611 END IF 00612 ELSE 00613 IF ( DZRAT .GT. DZRATMAX ) DZRATMAX = DZRAT 00614 END IF 00615 IF ( Z_STATE .GT. WORKING_STATE ) FINAL_DZ_Z = DZ_Z 00616 END IF 00617 00618 IF ( X_STATE.NE.WORKING_STATE.AND. 00619 $ ( IGNORE_CWISE.OR.Z_STATE.NE.WORKING_STATE ) ) 00620 $ GOTO 666 00621 00622 IF ( INCR_PREC ) THEN 00623 INCR_PREC = .FALSE. 00624 Y_PREC_STATE = Y_PREC_STATE + 1 00625 DO I = 1, N 00626 Y_TAIL( I ) = 0.0 00627 END DO 00628 END IF 00629 00630 PREVNORMDX = NORMDX 00631 PREV_DZ_Z = DZ_Z 00632 * 00633 * Update soluton. 00634 * 00635 IF (Y_PREC_STATE .LT. EXTRA_Y) THEN 00636 CALL SAXPY( N, 1.0, DY, 1, Y(1,J), 1 ) 00637 ELSE 00638 CALL SLA_WWADDW( N, Y(1,J), Y_TAIL, DY ) 00639 END IF 00640 00641 END DO 00642 * Target of "IF (Z_STOP .AND. X_STOP)". Sun's f77 won't EXIT. 00643 666 CONTINUE 00644 * 00645 * Set final_* when cnt hits ithresh. 00646 * 00647 IF ( X_STATE .EQ. WORKING_STATE ) FINAL_DX_X = DX_X 00648 IF ( Z_STATE .EQ. WORKING_STATE ) FINAL_DZ_Z = DZ_Z 00649 * 00650 * Compute error bounds. 00651 * 00652 IF ( N_NORMS .GE. 1 ) THEN 00653 ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) = 00654 $ FINAL_DX_X / (1 - DXRATMAX) 00655 END IF 00656 IF ( N_NORMS .GE. 2 ) THEN 00657 ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) = 00658 $ FINAL_DZ_Z / (1 - DZRATMAX) 00659 END IF 00660 * 00661 * Compute componentwise relative backward error from formula 00662 * max(i) ( abs(R(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) ) 00663 * where abs(Z) is the componentwise absolute value of the matrix 00664 * or vector Z. 00665 * 00666 * Compute residual RES = B_s - op(A_s) * Y, 00667 * op(A) = A, A**T, or A**H depending on TRANS (and type). 00668 CALL SCOPY( N, B( 1, J ), 1, RES, 1 ) 00669 CALL SSYMV( UPLO, N, -1.0, A, LDA, Y(1,J), 1, 1.0, RES, 1 ) 00670 00671 DO I = 1, N 00672 AYB( I ) = ABS( B( I, J ) ) 00673 END DO 00674 * 00675 * Compute abs(op(A_s))*abs(Y) + abs(B_s). 00676 * 00677 CALL SLA_SYAMV( UPLO2, N, 1.0, 00678 $ A, LDA, Y(1, J), 1, 1.0, AYB, 1 ) 00679 00680 CALL SLA_LIN_BERR( N, N, 1, RES, AYB, BERR_OUT( J ) ) 00681 * 00682 * End of loop for each RHS. 00683 * 00684 END DO 00685 * 00686 RETURN 00687 END