cla_herfsx_extended.c
Go to the documentation of this file.
00001 /* cla_herfsx_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_herfsx_extended__(integer *prec_type__, char *uplo, 
00024         integer *n, integer *nrhs, complex *a, integer *lda, complex *af, 
00025         integer *ldaf, integer *ipiv, logical *colequ, real *c__, complex *b, 
00026         integer *ldb, complex *y, integer *ldy, real *berr_out__, integer *
00027         n_norms__, real *err_bnds_norm__, real *err_bnds_comp__, complex *res,
00028          real *ayb, complex *dy, complex *y_tail__, real *rcond, integer *
00029         ithresh, real *rthresh, real *dz_ub__, logical *ignore_cwise__, 
00030         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, 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     extern /* Subroutine */ int chetrs_(char *, integer *, integer *, complex 
00075             *, integer *, integer *, complex *, integer *, integer *);
00076     real normdx, 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 /*  CLA_HERFSX_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 CHERFSX 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) COMPLEX 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) COMPLEX 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 CHETRF. */
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 CHETRF. */
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) REAL 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) COMPLEX 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) COMPLEX array, dimension */
00170 /*                    (LDY,NRHS) */
00171 /*     On entry, the solution matrix X, as computed by CHETRS. */
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) REAL 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 CLA_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) REAL 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) REAL 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) COMPLEX array, dimension (N) */
00285 /*     Workspace to hold the intermediate residual. */
00286 
00287 /*     AYB            (input) REAL array, dimension (N) */
00288 /*     Workspace. */
00289 
00290 /*     DY             (input) COMPLEX array, dimension (N) */
00291 /*     Workspace to hold the intermediate solution. */
00292 
00293 /*     Y_TAIL         (input) COMPLEX array, dimension (N) */
00294 /*     Workspace to hold the trailing bits of the intermediate solution. */
00295 
00296 /*     RCOND          (input) REAL */
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) REAL */
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) REAL */
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 CHETRS 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 /*     .. Statement Functions .. */
00352 /*     .. */
00353 /*     .. Statement Function Definitions .. */
00354 /*     .. */
00355 /*     .. Executable Statements .. */
00356 
00357     /* Parameter adjustments */
00358     err_bnds_comp_dim1 = *nrhs;
00359     err_bnds_comp_offset = 1 + err_bnds_comp_dim1;
00360     err_bnds_comp__ -= err_bnds_comp_offset;
00361     err_bnds_norm_dim1 = *nrhs;
00362     err_bnds_norm_offset = 1 + err_bnds_norm_dim1;
00363     err_bnds_norm__ -= err_bnds_norm_offset;
00364     a_dim1 = *lda;
00365     a_offset = 1 + a_dim1;
00366     a -= a_offset;
00367     af_dim1 = *ldaf;
00368     af_offset = 1 + af_dim1;
00369     af -= af_offset;
00370     --ipiv;
00371     --c__;
00372     b_dim1 = *ldb;
00373     b_offset = 1 + b_dim1;
00374     b -= b_offset;
00375     y_dim1 = *ldy;
00376     y_offset = 1 + y_dim1;
00377     y -= y_offset;
00378     --berr_out__;
00379     --res;
00380     --ayb;
00381     --dy;
00382     --y_tail__;
00383 
00384     /* Function Body */
00385     if (*info != 0) {
00386         return 0;
00387     }
00388     eps = slamch_("Epsilon");
00389     hugeval = slamch_("Overflow");
00390 /*     Force HUGEVAL to Inf */
00391     hugeval *= hugeval;
00392 /*     Using HUGEVAL may lead to spurious underflows. */
00393     incr_thresh__ = (real) (*n) * eps;
00394     if (lsame_(uplo, "L")) {
00395         uplo2 = ilauplo_("L");
00396     } else {
00397         uplo2 = ilauplo_("U");
00398     }
00399     i__1 = *nrhs;
00400     for (j = 1; j <= i__1; ++j) {
00401         y_prec_state__ = 1;
00402         if (y_prec_state__ == 2) {
00403             i__2 = *n;
00404             for (i__ = 1; i__ <= i__2; ++i__) {
00405                 i__3 = i__;
00406                 y_tail__[i__3].r = 0.f, y_tail__[i__3].i = 0.f;
00407             }
00408         }
00409         dxrat = 0.f;
00410         dxratmax = 0.f;
00411         dzrat = 0.f;
00412         dzratmax = 0.f;
00413         final_dx_x__ = hugeval;
00414         final_dz_z__ = hugeval;
00415         prevnormdx = hugeval;
00416         prev_dz_z__ = hugeval;
00417         dz_z__ = hugeval;
00418         dx_x__ = hugeval;
00419         x_state__ = 1;
00420         z_state__ = 0;
00421         incr_prec__ = FALSE_;
00422         i__2 = *ithresh;
00423         for (cnt = 1; cnt <= i__2; ++cnt) {
00424 
00425 /*         Compute residual RES = B_s - op(A_s) * Y, */
00426 /*             op(A) = A, A**T, or A**H depending on TRANS (and type). */
00427 
00428             ccopy_(n, &b[j * b_dim1 + 1], &c__1, &res[1], &c__1);
00429             if (y_prec_state__ == 0) {
00430                 chemv_(uplo, n, &c_b11, &a[a_offset], lda, &y[j * y_dim1 + 1], 
00431                          &c__1, &c_b12, &res[1], &c__1);
00432             } else if (y_prec_state__ == 1) {
00433                 blas_chemv_x__(&uplo2, n, &c_b11, &a[a_offset], lda, &y[j * 
00434                         y_dim1 + 1], &c__1, &c_b12, &res[1], &c__1, 
00435                         prec_type__);
00436             } else {
00437                 blas_chemv2_x__(&uplo2, n, &c_b11, &a[a_offset], lda, &y[j * 
00438                         y_dim1 + 1], &y_tail__[1], &c__1, &c_b12, &res[1], &
00439                         c__1, prec_type__);
00440             }
00441 /*         XXX: RES is no longer needed. */
00442             ccopy_(n, &res[1], &c__1, &dy[1], &c__1);
00443             chetrs_(uplo, n, nrhs, &af[af_offset], ldaf, &ipiv[1], &dy[1], n, 
00444                     info);
00445 
00446 /*         Calculate relative changes DX_X, DZ_Z and ratios DXRAT, DZRAT. */
00447 
00448             normx = 0.f;
00449             normy = 0.f;
00450             normdx = 0.f;
00451             dz_z__ = 0.f;
00452             ymin = hugeval;
00453             i__3 = *n;
00454             for (i__ = 1; i__ <= i__3; ++i__) {
00455                 i__4 = i__ + j * y_dim1;
00456                 yk = (r__1 = y[i__4].r, dabs(r__1)) + (r__2 = r_imag(&y[i__ + 
00457                         j * y_dim1]), dabs(r__2));
00458                 i__4 = i__;
00459                 dyk = (r__1 = dy[i__4].r, dabs(r__1)) + (r__2 = r_imag(&dy[
00460                         i__]), dabs(r__2));
00461                 if (yk != 0.f) {
00462 /* Computing MAX */
00463                     r__1 = dz_z__, r__2 = dyk / yk;
00464                     dz_z__ = dmax(r__1,r__2);
00465                 } else if (dyk != 0.f) {
00466                     dz_z__ = hugeval;
00467                 }
00468                 ymin = dmin(ymin,yk);
00469                 normy = dmax(normy,yk);
00470                 if (*colequ) {
00471 /* Computing MAX */
00472                     r__1 = normx, r__2 = yk * c__[i__];
00473                     normx = dmax(r__1,r__2);
00474 /* Computing MAX */
00475                     r__1 = normdx, r__2 = dyk * c__[i__];
00476                     normdx = dmax(r__1,r__2);
00477                 } else {
00478                     normx = normy;
00479                     normdx = dmax(normdx,dyk);
00480                 }
00481             }
00482             if (normx != 0.f) {
00483                 dx_x__ = normdx / normx;
00484             } else if (normdx == 0.f) {
00485                 dx_x__ = 0.f;
00486             } else {
00487                 dx_x__ = hugeval;
00488             }
00489             dxrat = normdx / prevnormdx;
00490             dzrat = dz_z__ / prev_dz_z__;
00491 
00492 /*         Check termination criteria. */
00493 
00494             if (ymin * *rcond < incr_thresh__ * normy && y_prec_state__ < 2) {
00495                 incr_prec__ = TRUE_;
00496             }
00497             if (x_state__ == 3 && dxrat <= *rthresh) {
00498                 x_state__ = 1;
00499             }
00500             if (x_state__ == 1) {
00501                 if (dx_x__ <= eps) {
00502                     x_state__ = 2;
00503                 } else if (dxrat > *rthresh) {
00504                     if (y_prec_state__ != 2) {
00505                         incr_prec__ = TRUE_;
00506                     } else {
00507                         x_state__ = 3;
00508                     }
00509                 } else {
00510                     if (dxrat > dxratmax) {
00511                         dxratmax = dxrat;
00512                     }
00513                 }
00514                 if (x_state__ > 1) {
00515                     final_dx_x__ = dx_x__;
00516                 }
00517             }
00518             if (z_state__ == 0 && dz_z__ <= *dz_ub__) {
00519                 z_state__ = 1;
00520             }
00521             if (z_state__ == 3 && dzrat <= *rthresh) {
00522                 z_state__ = 1;
00523             }
00524             if (z_state__ == 1) {
00525                 if (dz_z__ <= eps) {
00526                     z_state__ = 2;
00527                 } else if (dz_z__ > *dz_ub__) {
00528                     z_state__ = 0;
00529                     dzratmax = 0.f;
00530                     final_dz_z__ = hugeval;
00531                 } else if (dzrat > *rthresh) {
00532                     if (y_prec_state__ != 2) {
00533                         incr_prec__ = TRUE_;
00534                     } else {
00535                         z_state__ = 3;
00536                     }
00537                 } else {
00538                     if (dzrat > dzratmax) {
00539                         dzratmax = dzrat;
00540                     }
00541                 }
00542                 if (z_state__ > 1) {
00543                     final_dz_z__ = dz_z__;
00544                 }
00545             }
00546             if (x_state__ != 1 && (*ignore_cwise__ || z_state__ != 1)) {
00547                 goto L666;
00548             }
00549             if (incr_prec__) {
00550                 incr_prec__ = FALSE_;
00551                 ++y_prec_state__;
00552                 i__3 = *n;
00553                 for (i__ = 1; i__ <= i__3; ++i__) {
00554                     i__4 = i__;
00555                     y_tail__[i__4].r = 0.f, y_tail__[i__4].i = 0.f;
00556                 }
00557             }
00558             prevnormdx = normdx;
00559             prev_dz_z__ = dz_z__;
00560 
00561 /*           Update soluton. */
00562 
00563             if (y_prec_state__ < 2) {
00564                 caxpy_(n, &c_b12, &dy[1], &c__1, &y[j * y_dim1 + 1], &c__1);
00565             } else {
00566                 cla_wwaddw__(n, &y[j * y_dim1 + 1], &y_tail__[1], &dy[1]);
00567             }
00568         }
00569 /*        Target of "IF (Z_STOP .AND. X_STOP)".  Sun's f77 won't EXIT. */
00570 L666:
00571 
00572 /*     Set final_* when cnt hits ithresh. */
00573 
00574         if (x_state__ == 1) {
00575             final_dx_x__ = dx_x__;
00576         }
00577         if (z_state__ == 1) {
00578             final_dz_z__ = dz_z__;
00579         }
00580 
00581 /*     Compute error bounds. */
00582 
00583         if (*n_norms__ >= 1) {
00584             err_bnds_norm__[j + (err_bnds_norm_dim1 << 1)] = final_dx_x__ / (
00585                     1 - dxratmax);
00586         }
00587         if (*n_norms__ >= 2) {
00588             err_bnds_comp__[j + (err_bnds_comp_dim1 << 1)] = final_dz_z__ / (
00589                     1 - dzratmax);
00590         }
00591 
00592 /*     Compute componentwise relative backward error from formula */
00593 /*         max(i) ( abs(R(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) ) */
00594 /*     where abs(Z) is the componentwise absolute value of the matrix */
00595 /*     or vector Z. */
00596 
00597 /*         Compute residual RES = B_s - op(A_s) * Y, */
00598 /*             op(A) = A, A**T, or A**H depending on TRANS (and type). */
00599 
00600         ccopy_(n, &b[j * b_dim1 + 1], &c__1, &res[1], &c__1);
00601         chemv_(uplo, n, &c_b11, &a[a_offset], lda, &y[j * y_dim1 + 1], &c__1, 
00602                 &c_b12, &res[1], &c__1);
00603         i__2 = *n;
00604         for (i__ = 1; i__ <= i__2; ++i__) {
00605             i__3 = i__ + j * b_dim1;
00606             ayb[i__] = (r__1 = b[i__3].r, dabs(r__1)) + (r__2 = r_imag(&b[i__ 
00607                     + j * b_dim1]), dabs(r__2));
00608         }
00609 
00610 /*     Compute abs(op(A_s))*abs(Y) + abs(B_s). */
00611 
00612         cla_heamv__(&uplo2, n, &c_b33, &a[a_offset], lda, &y[j * y_dim1 + 1], 
00613                 &c__1, &c_b33, &ayb[1], &c__1);
00614         cla_lin_berr__(n, n, &c__1, &res[1], &ayb[1], &berr_out__[j]);
00615 
00616 /*     End of loop for each RHS. */
00617 
00618     }
00619 
00620     return 0;
00621 } /* cla_herfsx_extended__ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:29