00001 /* dla_syrfsx_extended.f -- translated by f2c (version 20061008). 00002 You must link the resulting object file with libf2c: 00003 on Microsoft Windows system, link with libf2c.lib; 00004 on Linux or Unix systems, link with .../path/to/libf2c.a -lm 00005 or, if you install libf2c.a in a standard place, with -lf2c -lm 00006 -- in that order, at the end of the command line, as in 00007 cc *.o -lf2c -lm 00008 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., 00009 00010 http://www.netlib.org/f2c/libf2c.zip 00011 */ 00012 00013 #include "f2c.h" 00014 #include "blaswrap.h" 00015 00016 /* Table of constant values */ 00017 00018 static integer c__1 = 1; 00019 static doublereal c_b9 = -1.; 00020 static doublereal c_b11 = 1.; 00021 00022 /* Subroutine */ int dla_syrfsx_extended__(integer *prec_type__, char *uplo, 00023 integer *n, integer *nrhs, doublereal *a, integer *lda, doublereal * 00024 af, integer *ldaf, integer *ipiv, logical *colequ, doublereal *c__, 00025 doublereal *b, integer *ldb, doublereal *y, integer *ldy, doublereal * 00026 berr_out__, integer *n_norms__, doublereal *err_bnds_norm__, 00027 doublereal *err_bnds_comp__, doublereal *res, doublereal *ayb, 00028 doublereal *dy, doublereal *y_tail__, doublereal *rcond, integer * 00029 ithresh, doublereal *rthresh, doublereal *dz_ub__, logical * 00030 ignore_cwise__, integer *info, ftnlen uplo_len) 00031 { 00032 /* System generated locals */ 00033 integer a_dim1, a_offset, af_dim1, af_offset, b_dim1, b_offset, y_dim1, 00034 y_offset, err_bnds_norm_dim1, err_bnds_norm_offset, 00035 err_bnds_comp_dim1, err_bnds_comp_offset, i__1, i__2, i__3; 00036 doublereal d__1, d__2; 00037 00038 /* Local variables */ 00039 doublereal dxratmax, dzratmax; 00040 integer i__, j; 00041 logical incr_prec__; 00042 extern /* Subroutine */ int dla_syamv__(integer *, integer *, doublereal * 00043 , doublereal *, integer *, doublereal *, integer *, doublereal *, 00044 doublereal *, integer *); 00045 doublereal prev_dz_z__, yk, final_dx_x__; 00046 extern /* Subroutine */ int dla_wwaddw__(integer *, doublereal *, 00047 doublereal *, doublereal *); 00048 doublereal final_dz_z__, prevnormdx; 00049 integer cnt; 00050 doublereal dyk, eps, incr_thresh__, dx_x__, dz_z__; 00051 extern /* Subroutine */ int dla_lin_berr__(integer *, integer *, integer * 00052 , doublereal *, doublereal *, doublereal *); 00053 doublereal ymin; 00054 integer y_prec_state__; 00055 extern /* Subroutine */ int blas_dsymv_x__(integer *, integer *, 00056 doublereal *, doublereal *, integer *, doublereal *, integer *, 00057 doublereal *, doublereal *, integer *, integer *); 00058 integer uplo2; 00059 extern logical lsame_(char *, char *); 00060 extern /* Subroutine */ int blas_dsymv2_x__(integer *, integer *, 00061 doublereal *, doublereal *, integer *, doublereal *, doublereal *, 00062 integer *, doublereal *, doublereal *, integer *, integer *), 00063 dcopy_(integer *, doublereal *, integer *, doublereal *, integer * 00064 ); 00065 doublereal dxrat, dzrat; 00066 extern /* Subroutine */ int daxpy_(integer *, doublereal *, doublereal *, 00067 integer *, doublereal *, integer *), dsymv_(char *, integer *, 00068 doublereal *, doublereal *, integer *, doublereal *, integer *, 00069 doublereal *, doublereal *, integer *); 00070 doublereal normx, normy; 00071 extern doublereal dlamch_(char *); 00072 doublereal normdx; 00073 extern /* Subroutine */ int dsytrs_(char *, integer *, integer *, 00074 doublereal *, integer *, integer *, doublereal *, integer *, 00075 integer *); 00076 doublereal hugeval; 00077 extern integer ilauplo_(char *); 00078 integer x_state__, z_state__; 00079 00080 00081 /* -- LAPACK routine (version 3.2.1) -- */ 00082 /* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and -- */ 00083 /* -- Jason Riedy of Univ. of California Berkeley. -- */ 00084 /* -- April 2009 -- */ 00085 00086 /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */ 00087 /* -- Univ. of California Berkeley and NAG Ltd. -- */ 00088 00089 /* .. */ 00090 /* .. Scalar Arguments .. */ 00091 /* .. */ 00092 /* .. Array Arguments .. */ 00093 /* .. */ 00094 00095 /* Purpose */ 00096 /* ======= */ 00097 00098 /* DLA_SYRFSX_EXTENDED improves the computed solution to a system of */ 00099 /* linear equations by performing extra-precise iterative refinement */ 00100 /* and provides error bounds and backward error estimates for the solution. */ 00101 /* This subroutine is called by DSYRFSX to perform iterative refinement. */ 00102 /* In addition to normwise error bound, the code provides maximum */ 00103 /* componentwise error bound if possible. See comments for ERR_BNDS_NORM */ 00104 /* and ERR_BNDS_COMP for details of the error bounds. Note that this */ 00105 /* subroutine is only resonsible for setting the second fields of */ 00106 /* ERR_BNDS_NORM and ERR_BNDS_COMP. */ 00107 00108 /* Arguments */ 00109 /* ========= */ 00110 00111 /* PREC_TYPE (input) INTEGER */ 00112 /* Specifies the intermediate precision to be used in refinement. */ 00113 /* The value is defined by ILAPREC(P) where P is a CHARACTER and */ 00114 /* P = 'S': Single */ 00115 /* = 'D': Double */ 00116 /* = 'I': Indigenous */ 00117 /* = 'X', 'E': Extra */ 00118 00119 /* UPLO (input) CHARACTER*1 */ 00120 /* = 'U': Upper triangle of A is stored; */ 00121 /* = 'L': Lower triangle of A is stored. */ 00122 00123 /* N (input) INTEGER */ 00124 /* The number of linear equations, i.e., the order of the */ 00125 /* matrix A. N >= 0. */ 00126 00127 /* NRHS (input) INTEGER */ 00128 /* The number of right-hand-sides, i.e., the number of columns of the */ 00129 /* matrix B. */ 00130 00131 /* A (input) DOUBLE PRECISION array, dimension (LDA,N) */ 00132 /* On entry, the N-by-N matrix A. */ 00133 00134 /* LDA (input) INTEGER */ 00135 /* The leading dimension of the array A. LDA >= max(1,N). */ 00136 00137 /* AF (input) DOUBLE PRECISION array, dimension (LDAF,N) */ 00138 /* The block diagonal matrix D and the multipliers used to */ 00139 /* obtain the factor U or L as computed by DSYTRF. */ 00140 00141 /* LDAF (input) INTEGER */ 00142 /* The leading dimension of the array AF. LDAF >= max(1,N). */ 00143 00144 /* IPIV (input) INTEGER array, dimension (N) */ 00145 /* Details of the interchanges and the block structure of D */ 00146 /* as determined by DSYTRF. */ 00147 00148 /* COLEQU (input) LOGICAL */ 00149 /* If .TRUE. then column equilibration was done to A before calling */ 00150 /* this routine. This is needed to compute the solution and error */ 00151 /* bounds correctly. */ 00152 00153 /* C (input) DOUBLE PRECISION array, dimension (N) */ 00154 /* The column scale factors for A. If COLEQU = .FALSE., C */ 00155 /* is not accessed. If C is input, each element of C should be a power */ 00156 /* of the radix to ensure a reliable solution and error estimates. */ 00157 /* Scaling by powers of the radix does not cause rounding errors unless */ 00158 /* the result underflows or overflows. Rounding errors during scaling */ 00159 /* lead to refining with a matrix that is not equivalent to the */ 00160 /* input matrix, producing error estimates that may not be */ 00161 /* reliable. */ 00162 00163 /* B (input) DOUBLE PRECISION array, dimension (LDB,NRHS) */ 00164 /* The right-hand-side matrix B. */ 00165 00166 /* LDB (input) INTEGER */ 00167 /* The leading dimension of the array B. LDB >= max(1,N). */ 00168 00169 /* Y (input/output) DOUBLE PRECISION array, dimension */ 00170 /* (LDY,NRHS) */ 00171 /* On entry, the solution matrix X, as computed by DSYTRS. */ 00172 /* On exit, the improved solution matrix Y. */ 00173 00174 /* LDY (input) INTEGER */ 00175 /* The leading dimension of the array Y. LDY >= max(1,N). */ 00176 00177 /* BERR_OUT (output) DOUBLE PRECISION array, dimension (NRHS) */ 00178 /* On exit, BERR_OUT(j) contains the componentwise relative backward */ 00179 /* error for right-hand-side j from the formula */ 00180 /* max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) ) */ 00181 /* where abs(Z) is the componentwise absolute value of the matrix */ 00182 /* or vector Z. This is computed by DLA_LIN_BERR. */ 00183 00184 /* N_NORMS (input) INTEGER */ 00185 /* Determines which error bounds to return (see ERR_BNDS_NORM */ 00186 /* and ERR_BNDS_COMP). */ 00187 /* If N_NORMS >= 1 return normwise error bounds. */ 00188 /* If N_NORMS >= 2 return componentwise error bounds. */ 00189 00190 /* ERR_BNDS_NORM (input/output) DOUBLE PRECISION array, dimension */ 00191 /* (NRHS, N_ERR_BNDS) */ 00192 /* For each right-hand side, this array contains information about */ 00193 /* various error bounds and condition numbers corresponding to the */ 00194 /* normwise relative error, which is defined as follows: */ 00195 00196 /* Normwise relative error in the ith solution vector: */ 00197 /* max_j (abs(XTRUE(j,i) - X(j,i))) */ 00198 /* ------------------------------ */ 00199 /* max_j abs(X(j,i)) */ 00200 00201 /* The array is indexed by the type of error information as described */ 00202 /* below. There currently are up to three pieces of information */ 00203 /* returned. */ 00204 00205 /* The first index in ERR_BNDS_NORM(i,:) corresponds to the ith */ 00206 /* right-hand side. */ 00207 00208 /* The second index in ERR_BNDS_NORM(:,err) contains the following */ 00209 /* three fields: */ 00210 /* err = 1 "Trust/don't trust" boolean. Trust the answer if the */ 00211 /* reciprocal condition number is less than the threshold */ 00212 /* sqrt(n) * slamch('Epsilon'). */ 00213 00214 /* err = 2 "Guaranteed" error bound: The estimated forward error, */ 00215 /* almost certainly within a factor of 10 of the true error */ 00216 /* so long as the next entry is greater than the threshold */ 00217 /* sqrt(n) * slamch('Epsilon'). This error bound should only */ 00218 /* be trusted if the previous boolean is true. */ 00219 00220 /* err = 3 Reciprocal condition number: Estimated normwise */ 00221 /* reciprocal condition number. Compared with the threshold */ 00222 /* sqrt(n) * slamch('Epsilon') to determine if the error */ 00223 /* estimate is "guaranteed". These reciprocal condition */ 00224 /* numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some */ 00225 /* appropriately scaled matrix Z. */ 00226 /* Let Z = S*A, where S scales each row by a power of the */ 00227 /* radix so all absolute row sums of Z are approximately 1. */ 00228 00229 /* This subroutine is only responsible for setting the second field */ 00230 /* above. */ 00231 /* See Lapack Working Note 165 for further details and extra */ 00232 /* cautions. */ 00233 00234 /* ERR_BNDS_COMP (input/output) DOUBLE PRECISION array, dimension */ 00235 /* (NRHS, N_ERR_BNDS) */ 00236 /* For each right-hand side, this array contains information about */ 00237 /* various error bounds and condition numbers corresponding to the */ 00238 /* componentwise relative error, which is defined as follows: */ 00239 00240 /* Componentwise relative error in the ith solution vector: */ 00241 /* abs(XTRUE(j,i) - X(j,i)) */ 00242 /* max_j ---------------------- */ 00243 /* abs(X(j,i)) */ 00244 00245 /* The array is indexed by the right-hand side i (on which the */ 00246 /* componentwise relative error depends), and the type of error */ 00247 /* information as described below. There currently are up to three */ 00248 /* pieces of information returned for each right-hand side. If */ 00249 /* componentwise accuracy is not requested (PARAMS(3) = 0.0), then */ 00250 /* ERR_BNDS_COMP is not accessed. If N_ERR_BNDS .LT. 3, then at most */ 00251 /* the first (:,N_ERR_BNDS) entries are returned. */ 00252 00253 /* The first index in ERR_BNDS_COMP(i,:) corresponds to the ith */ 00254 /* right-hand side. */ 00255 00256 /* The second index in ERR_BNDS_COMP(:,err) contains the following */ 00257 /* three fields: */ 00258 /* err = 1 "Trust/don't trust" boolean. Trust the answer if the */ 00259 /* reciprocal condition number is less than the threshold */ 00260 /* sqrt(n) * slamch('Epsilon'). */ 00261 00262 /* err = 2 "Guaranteed" error bound: The estimated forward error, */ 00263 /* almost certainly within a factor of 10 of the true error */ 00264 /* so long as the next entry is greater than the threshold */ 00265 /* sqrt(n) * slamch('Epsilon'). This error bound should only */ 00266 /* be trusted if the previous boolean is true. */ 00267 00268 /* err = 3 Reciprocal condition number: Estimated componentwise */ 00269 /* reciprocal condition number. Compared with the threshold */ 00270 /* sqrt(n) * slamch('Epsilon') to determine if the error */ 00271 /* estimate is "guaranteed". These reciprocal condition */ 00272 /* numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some */ 00273 /* appropriately scaled matrix Z. */ 00274 /* Let Z = S*(A*diag(x)), where x is the solution for the */ 00275 /* current right-hand side and S scales each row of */ 00276 /* A*diag(x) by a power of the radix so all absolute row */ 00277 /* sums of Z are approximately 1. */ 00278 00279 /* This subroutine is only responsible for setting the second field */ 00280 /* above. */ 00281 /* See Lapack Working Note 165 for further details and extra */ 00282 /* cautions. */ 00283 00284 /* RES (input) DOUBLE PRECISION array, dimension (N) */ 00285 /* Workspace to hold the intermediate residual. */ 00286 00287 /* AYB (input) DOUBLE PRECISION array, dimension (N) */ 00288 /* Workspace. This can be the same workspace passed for Y_TAIL. */ 00289 00290 /* DY (input) DOUBLE PRECISION array, dimension (N) */ 00291 /* Workspace to hold the intermediate solution. */ 00292 00293 /* Y_TAIL (input) DOUBLE PRECISION array, dimension (N) */ 00294 /* Workspace to hold the trailing bits of the intermediate solution. */ 00295 00296 /* RCOND (input) DOUBLE PRECISION */ 00297 /* Reciprocal scaled condition number. This is an estimate of the */ 00298 /* reciprocal Skeel condition number of the matrix A after */ 00299 /* equilibration (if done). If this is less than the machine */ 00300 /* precision (in particular, if it is zero), the matrix is singular */ 00301 /* to working precision. Note that the error may still be small even */ 00302 /* if this number is very small and the matrix appears ill- */ 00303 /* conditioned. */ 00304 00305 /* ITHRESH (input) INTEGER */ 00306 /* The maximum number of residual computations allowed for */ 00307 /* refinement. The default is 10. For 'aggressive' set to 100 to */ 00308 /* permit convergence using approximate factorizations or */ 00309 /* factorizations other than LU. If the factorization uses a */ 00310 /* technique other than Gaussian elimination, the guarantees in */ 00311 /* ERR_BNDS_NORM and ERR_BNDS_COMP may no longer be trustworthy. */ 00312 00313 /* RTHRESH (input) DOUBLE PRECISION */ 00314 /* Determines when to stop refinement if the error estimate stops */ 00315 /* decreasing. Refinement will stop when the next solution no longer */ 00316 /* satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is */ 00317 /* the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The */ 00318 /* default value is 0.5. For 'aggressive' set to 0.9 to permit */ 00319 /* convergence on extremely ill-conditioned matrices. See LAWN 165 */ 00320 /* for more details. */ 00321 00322 /* DZ_UB (input) DOUBLE PRECISION */ 00323 /* Determines when to start considering componentwise convergence. */ 00324 /* Componentwise convergence is only considered after each component */ 00325 /* of the solution Y is stable, which we definte as the relative */ 00326 /* change in each component being less than DZ_UB. The default value */ 00327 /* is 0.25, requiring the first bit to be stable. See LAWN 165 for */ 00328 /* more details. */ 00329 00330 /* IGNORE_CWISE (input) LOGICAL */ 00331 /* If .TRUE. then ignore componentwise convergence. Default value */ 00332 /* is .FALSE.. */ 00333 00334 /* INFO (output) INTEGER */ 00335 /* = 0: Successful exit. */ 00336 /* < 0: if INFO = -i, the ith argument to DSYTRS had an illegal */ 00337 /* value */ 00338 00339 /* ===================================================================== */ 00340 00341 /* .. Local Scalars .. */ 00342 /* .. */ 00343 /* .. Parameters .. */ 00344 /* .. */ 00345 /* .. External Functions .. */ 00346 /* .. */ 00347 /* .. External Subroutines .. */ 00348 /* .. */ 00349 /* .. Intrinsic Functions .. */ 00350 /* .. */ 00351 /* .. Executable Statements .. */ 00352 00353 /* Parameter adjustments */ 00354 err_bnds_comp_dim1 = *nrhs; 00355 err_bnds_comp_offset = 1 + err_bnds_comp_dim1; 00356 err_bnds_comp__ -= err_bnds_comp_offset; 00357 err_bnds_norm_dim1 = *nrhs; 00358 err_bnds_norm_offset = 1 + err_bnds_norm_dim1; 00359 err_bnds_norm__ -= err_bnds_norm_offset; 00360 a_dim1 = *lda; 00361 a_offset = 1 + a_dim1; 00362 a -= a_offset; 00363 af_dim1 = *ldaf; 00364 af_offset = 1 + af_dim1; 00365 af -= af_offset; 00366 --ipiv; 00367 --c__; 00368 b_dim1 = *ldb; 00369 b_offset = 1 + b_dim1; 00370 b -= b_offset; 00371 y_dim1 = *ldy; 00372 y_offset = 1 + y_dim1; 00373 y -= y_offset; 00374 --berr_out__; 00375 --res; 00376 --ayb; 00377 --dy; 00378 --y_tail__; 00379 00380 /* Function Body */ 00381 if (*info != 0) { 00382 return 0; 00383 } 00384 eps = dlamch_("Epsilon"); 00385 hugeval = dlamch_("Overflow"); 00386 /* Force HUGEVAL to Inf */ 00387 hugeval *= hugeval; 00388 /* Using HUGEVAL may lead to spurious underflows. */ 00389 incr_thresh__ = (doublereal) (*n) * eps; 00390 if (lsame_(uplo, "L")) { 00391 uplo2 = ilauplo_("L"); 00392 } else { 00393 uplo2 = ilauplo_("U"); 00394 } 00395 i__1 = *nrhs; 00396 for (j = 1; j <= i__1; ++j) { 00397 y_prec_state__ = 1; 00398 if (y_prec_state__ == 2) { 00399 i__2 = *n; 00400 for (i__ = 1; i__ <= i__2; ++i__) { 00401 y_tail__[i__] = 0.; 00402 } 00403 } 00404 dxrat = 0.; 00405 dxratmax = 0.; 00406 dzrat = 0.; 00407 dzratmax = 0.; 00408 final_dx_x__ = hugeval; 00409 final_dz_z__ = hugeval; 00410 prevnormdx = hugeval; 00411 prev_dz_z__ = hugeval; 00412 dz_z__ = hugeval; 00413 dx_x__ = hugeval; 00414 x_state__ = 1; 00415 z_state__ = 0; 00416 incr_prec__ = FALSE_; 00417 i__2 = *ithresh; 00418 for (cnt = 1; cnt <= i__2; ++cnt) { 00419 00420 /* Compute residual RES = B_s - op(A_s) * Y, */ 00421 /* op(A) = A, A**T, or A**H depending on TRANS (and type). */ 00422 00423 dcopy_(n, &b[j * b_dim1 + 1], &c__1, &res[1], &c__1); 00424 if (y_prec_state__ == 0) { 00425 dsymv_(uplo, n, &c_b9, &a[a_offset], lda, &y[j * y_dim1 + 1], 00426 &c__1, &c_b11, &res[1], &c__1); 00427 } else if (y_prec_state__ == 1) { 00428 blas_dsymv_x__(&uplo2, n, &c_b9, &a[a_offset], lda, &y[j * 00429 y_dim1 + 1], &c__1, &c_b11, &res[1], &c__1, 00430 prec_type__); 00431 } else { 00432 blas_dsymv2_x__(&uplo2, n, &c_b9, &a[a_offset], lda, &y[j * 00433 y_dim1 + 1], &y_tail__[1], &c__1, &c_b11, &res[1], & 00434 c__1, prec_type__); 00435 } 00436 /* XXX: RES is no longer needed. */ 00437 dcopy_(n, &res[1], &c__1, &dy[1], &c__1); 00438 dsytrs_(uplo, n, nrhs, &af[af_offset], ldaf, &ipiv[1], &dy[1], n, 00439 info); 00440 00441 /* Calculate relative changes DX_X, DZ_Z and ratios DXRAT, DZRAT. */ 00442 00443 normx = 0.; 00444 normy = 0.; 00445 normdx = 0.; 00446 dz_z__ = 0.; 00447 ymin = hugeval; 00448 i__3 = *n; 00449 for (i__ = 1; i__ <= i__3; ++i__) { 00450 yk = (d__1 = y[i__ + j * y_dim1], abs(d__1)); 00451 dyk = (d__1 = dy[i__], abs(d__1)); 00452 if (yk != 0.) { 00453 /* Computing MAX */ 00454 d__1 = dz_z__, d__2 = dyk / yk; 00455 dz_z__ = max(d__1,d__2); 00456 } else if (dyk != 0.) { 00457 dz_z__ = hugeval; 00458 } 00459 ymin = min(ymin,yk); 00460 normy = max(normy,yk); 00461 if (*colequ) { 00462 /* Computing MAX */ 00463 d__1 = normx, d__2 = yk * c__[i__]; 00464 normx = max(d__1,d__2); 00465 /* Computing MAX */ 00466 d__1 = normdx, d__2 = dyk * c__[i__]; 00467 normdx = max(d__1,d__2); 00468 } else { 00469 normx = normy; 00470 normdx = max(normdx,dyk); 00471 } 00472 } 00473 if (normx != 0.) { 00474 dx_x__ = normdx / normx; 00475 } else if (normdx == 0.) { 00476 dx_x__ = 0.; 00477 } else { 00478 dx_x__ = hugeval; 00479 } 00480 dxrat = normdx / prevnormdx; 00481 dzrat = dz_z__ / prev_dz_z__; 00482 00483 /* Check termination criteria. */ 00484 00485 if (ymin * *rcond < incr_thresh__ * normy && y_prec_state__ < 2) { 00486 incr_prec__ = TRUE_; 00487 } 00488 if (x_state__ == 3 && dxrat <= *rthresh) { 00489 x_state__ = 1; 00490 } 00491 if (x_state__ == 1) { 00492 if (dx_x__ <= eps) { 00493 x_state__ = 2; 00494 } else if (dxrat > *rthresh) { 00495 if (y_prec_state__ != 2) { 00496 incr_prec__ = TRUE_; 00497 } else { 00498 x_state__ = 3; 00499 } 00500 } else { 00501 if (dxrat > dxratmax) { 00502 dxratmax = dxrat; 00503 } 00504 } 00505 if (x_state__ > 1) { 00506 final_dx_x__ = dx_x__; 00507 } 00508 } 00509 if (z_state__ == 0 && dz_z__ <= *dz_ub__) { 00510 z_state__ = 1; 00511 } 00512 if (z_state__ == 3 && dzrat <= *rthresh) { 00513 z_state__ = 1; 00514 } 00515 if (z_state__ == 1) { 00516 if (dz_z__ <= eps) { 00517 z_state__ = 2; 00518 } else if (dz_z__ > *dz_ub__) { 00519 z_state__ = 0; 00520 dzratmax = 0.; 00521 final_dz_z__ = hugeval; 00522 } else if (dzrat > *rthresh) { 00523 if (y_prec_state__ != 2) { 00524 incr_prec__ = TRUE_; 00525 } else { 00526 z_state__ = 3; 00527 } 00528 } else { 00529 if (dzrat > dzratmax) { 00530 dzratmax = dzrat; 00531 } 00532 } 00533 if (z_state__ > 1) { 00534 final_dz_z__ = dz_z__; 00535 } 00536 } 00537 if (x_state__ != 1 && (*ignore_cwise__ || z_state__ != 1)) { 00538 goto L666; 00539 } 00540 if (incr_prec__) { 00541 incr_prec__ = FALSE_; 00542 ++y_prec_state__; 00543 i__3 = *n; 00544 for (i__ = 1; i__ <= i__3; ++i__) { 00545 y_tail__[i__] = 0.; 00546 } 00547 } 00548 prevnormdx = normdx; 00549 prev_dz_z__ = dz_z__; 00550 00551 /* Update soluton. */ 00552 00553 if (y_prec_state__ < 2) { 00554 daxpy_(n, &c_b11, &dy[1], &c__1, &y[j * y_dim1 + 1], &c__1); 00555 } else { 00556 dla_wwaddw__(n, &y[j * y_dim1 + 1], &y_tail__[1], &dy[1]); 00557 } 00558 } 00559 /* Target of "IF (Z_STOP .AND. X_STOP)". Sun's f77 won't EXIT. */ 00560 L666: 00561 00562 /* Set final_* when cnt hits ithresh. */ 00563 00564 if (x_state__ == 1) { 00565 final_dx_x__ = dx_x__; 00566 } 00567 if (z_state__ == 1) { 00568 final_dz_z__ = dz_z__; 00569 } 00570 00571 /* Compute error bounds. */ 00572 00573 if (*n_norms__ >= 1) { 00574 err_bnds_norm__[j + (err_bnds_norm_dim1 << 1)] = final_dx_x__ / ( 00575 1 - dxratmax); 00576 } 00577 if (*n_norms__ >= 2) { 00578 err_bnds_comp__[j + (err_bnds_comp_dim1 << 1)] = final_dz_z__ / ( 00579 1 - dzratmax); 00580 } 00581 00582 /* Compute componentwise relative backward error from formula */ 00583 /* max(i) ( abs(R(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) ) */ 00584 /* where abs(Z) is the componentwise absolute value of the matrix */ 00585 /* or vector Z. */ 00586 00587 /* Compute residual RES = B_s - op(A_s) * Y, */ 00588 /* op(A) = A, A**T, or A**H depending on TRANS (and type). */ 00589 dcopy_(n, &b[j * b_dim1 + 1], &c__1, &res[1], &c__1); 00590 dsymv_(uplo, n, &c_b9, &a[a_offset], lda, &y[j * y_dim1 + 1], &c__1, & 00591 c_b11, &res[1], &c__1); 00592 i__2 = *n; 00593 for (i__ = 1; i__ <= i__2; ++i__) { 00594 ayb[i__] = (d__1 = b[i__ + j * b_dim1], abs(d__1)); 00595 } 00596 00597 /* Compute abs(op(A_s))*abs(Y) + abs(B_s). */ 00598 00599 dla_syamv__(&uplo2, n, &c_b11, &a[a_offset], lda, &y[j * y_dim1 + 1], 00600 &c__1, &c_b11, &ayb[1], &c__1); 00601 dla_lin_berr__(n, n, &c__1, &res[1], &ayb[1], &berr_out__[j]); 00602 00603 /* End of loop for each RHS. */ 00604 00605 } 00606 00607 return 0; 00608 } /* dla_syrfsx_extended__ */