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


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:09