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