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


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