dporfsx.c
Go to the documentation of this file.
00001 /* dporfsx.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_n1 = -1;
00019 static integer c__0 = 0;
00020 static integer c__1 = 1;
00021 
00022 /* Subroutine */ int dporfsx_(char *uplo, char *equed, integer *n, integer *
00023         nrhs, doublereal *a, integer *lda, doublereal *af, integer *ldaf, 
00024         doublereal *s, doublereal *b, integer *ldb, doublereal *x, integer *
00025         ldx, doublereal *rcond, doublereal *berr, integer *n_err_bnds__, 
00026         doublereal *err_bnds_norm__, doublereal *err_bnds_comp__, integer *
00027         nparams, doublereal *params, doublereal *work, integer *iwork, 
00028         integer *info)
00029 {
00030     /* System generated locals */
00031     integer a_dim1, a_offset, af_dim1, af_offset, b_dim1, b_offset, x_dim1, 
00032             x_offset, err_bnds_norm_dim1, err_bnds_norm_offset, 
00033             err_bnds_comp_dim1, err_bnds_comp_offset, i__1;
00034     doublereal d__1, d__2;
00035 
00036     /* Builtin functions */
00037     double sqrt(doublereal);
00038 
00039     /* Local variables */
00040     doublereal illrcond_thresh__, unstable_thresh__, err_lbnd__;
00041     integer ref_type__, j;
00042     doublereal rcond_tmp__;
00043     integer prec_type__;
00044     extern doublereal dla_porcond__(char *, integer *, doublereal *, integer *
00045             , doublereal *, integer *, integer *, doublereal *, integer *, 
00046             doublereal *, integer *, ftnlen);
00047     doublereal cwise_wrong__;
00048     extern /* Subroutine */ int dla_porfsx_extended__(integer *, char *, 
00049             integer *, integer *, doublereal *, integer *, doublereal *, 
00050             integer *, logical *, doublereal *, doublereal *, integer *, 
00051             doublereal *, integer *, doublereal *, integer *, doublereal *, 
00052             doublereal *, doublereal *, doublereal *, doublereal *, 
00053             doublereal *, doublereal *, integer *, doublereal *, doublereal *,
00054              logical *, integer *, ftnlen);
00055     char norm[1];
00056     logical ignore_cwise__;
00057     extern logical lsame_(char *, char *);
00058     doublereal anorm;
00059     logical rcequ;
00060     extern doublereal dlamch_(char *);
00061     extern /* Subroutine */ int xerbla_(char *, integer *), dpocon_(
00062             char *, integer *, doublereal *, integer *, doublereal *, 
00063             doublereal *, doublereal *, integer *, integer *);
00064     extern doublereal dlansy_(char *, char *, integer *, doublereal *, 
00065             integer *, doublereal *);
00066     extern integer ilaprec_(char *);
00067     integer ithresh, n_norms__;
00068     doublereal rthresh;
00069 
00070 
00071 /*     -- LAPACK routine (version 3.2.1)                                 -- */
00072 /*     -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and -- */
00073 /*     -- Jason Riedy of Univ. of California Berkeley.                 -- */
00074 /*     -- April 2009                                                   -- */
00075 
00076 /*     -- LAPACK is a software package provided by Univ. of Tennessee, -- */
00077 /*     -- Univ. of California Berkeley and NAG Ltd.                    -- */
00078 
00079 /*     .. */
00080 /*     .. Scalar Arguments .. */
00081 /*     .. */
00082 /*     .. Array Arguments .. */
00083 /*     .. */
00084 
00085 /*     Purpose */
00086 /*     ======= */
00087 
00088 /*     DPORFSX improves the computed solution to a system of linear */
00089 /*     equations when the coefficient matrix is symmetric positive */
00090 /*     definite, and provides error bounds and backward error estimates */
00091 /*     for the solution.  In addition to normwise error bound, the code */
00092 /*     provides maximum componentwise error bound if possible.  See */
00093 /*     comments for ERR_BNDS_NORM and ERR_BNDS_COMP for details of the */
00094 /*     error bounds. */
00095 
00096 /*     The original system of linear equations may have been equilibrated */
00097 /*     before calling this routine, as described by arguments EQUED and S */
00098 /*     below. In this case, the solution and error bounds returned are */
00099 /*     for the original unequilibrated system. */
00100 
00101 /*     Arguments */
00102 /*     ========= */
00103 
00104 /*     Some optional parameters are bundled in the PARAMS array.  These */
00105 /*     settings determine how refinement is performed, but often the */
00106 /*     defaults are acceptable.  If the defaults are acceptable, users */
00107 /*     can pass NPARAMS = 0 which prevents the source code from accessing */
00108 /*     the PARAMS argument. */
00109 
00110 /*     UPLO    (input) CHARACTER*1 */
00111 /*       = 'U':  Upper triangle of A is stored; */
00112 /*       = 'L':  Lower triangle of A is stored. */
00113 
00114 /*     EQUED   (input) CHARACTER*1 */
00115 /*     Specifies the form of equilibration that was done to A */
00116 /*     before calling this routine. This is needed to compute */
00117 /*     the solution and error bounds correctly. */
00118 /*       = 'N':  No equilibration */
00119 /*       = 'Y':  Both row and column equilibration, i.e., A has been */
00120 /*               replaced by diag(S) * A * diag(S). */
00121 /*               The right hand side B has been changed accordingly. */
00122 
00123 /*     N       (input) INTEGER */
00124 /*     The order of the matrix A.  N >= 0. */
00125 
00126 /*     NRHS    (input) INTEGER */
00127 /*     The number of right hand sides, i.e., the number of columns */
00128 /*     of the matrices B and X.  NRHS >= 0. */
00129 
00130 /*     A       (input) DOUBLE PRECISION array, dimension (LDA,N) */
00131 /*     The symmetric matrix A.  If UPLO = 'U', the leading N-by-N */
00132 /*     upper triangular part of A contains the upper triangular part */
00133 /*     of the matrix A, and the strictly lower triangular part of A */
00134 /*     is not referenced.  If UPLO = 'L', the leading N-by-N lower */
00135 /*     triangular part of A contains the lower triangular part of */
00136 /*     the matrix A, and the strictly upper triangular part of A is */
00137 /*     not referenced. */
00138 
00139 /*     LDA     (input) INTEGER */
00140 /*     The leading dimension of the array A.  LDA >= max(1,N). */
00141 
00142 /*     AF      (input) DOUBLE PRECISION array, dimension (LDAF,N) */
00143 /*     The triangular factor U or L from the Cholesky factorization */
00144 /*     A = U**T*U or A = L*L**T, as computed by DPOTRF. */
00145 
00146 /*     LDAF    (input) INTEGER */
00147 /*     The leading dimension of the array AF.  LDAF >= max(1,N). */
00148 
00149 /*     S       (input or output) DOUBLE PRECISION array, dimension (N) */
00150 /*     The row scale factors for A.  If EQUED = 'Y', A is multiplied on */
00151 /*     the left and right by diag(S).  S is an input argument if FACT = */
00152 /*     'F'; otherwise, S is an output argument.  If FACT = 'F' and EQUED */
00153 /*     = 'Y', each element of S must be positive.  If S is output, each */
00154 /*     element of S is a power of the radix. If S is input, each element */
00155 /*     of S should be a power of the radix to ensure a reliable solution */
00156 /*     and error estimates. Scaling by powers of the radix does not cause */
00157 /*     rounding errors unless the result underflows or overflows. */
00158 /*     Rounding errors during scaling lead to refining with a matrix that */
00159 /*     is not equivalent to the input matrix, producing error estimates */
00160 /*     that may not be reliable. */
00161 
00162 /*     B       (input) DOUBLE PRECISION array, dimension (LDB,NRHS) */
00163 /*     The right hand side matrix B. */
00164 
00165 /*     LDB     (input) INTEGER */
00166 /*     The leading dimension of the array B.  LDB >= max(1,N). */
00167 
00168 /*     X       (input/output) DOUBLE PRECISION array, dimension (LDX,NRHS) */
00169 /*     On entry, the solution matrix X, as computed by DGETRS. */
00170 /*     On exit, the improved solution matrix X. */
00171 
00172 /*     LDX     (input) INTEGER */
00173 /*     The leading dimension of the array X.  LDX >= max(1,N). */
00174 
00175 /*     RCOND   (output) DOUBLE PRECISION */
00176 /*     Reciprocal scaled condition number.  This is an estimate of the */
00177 /*     reciprocal Skeel condition number of the matrix A after */
00178 /*     equilibration (if done).  If this is less than the machine */
00179 /*     precision (in particular, if it is zero), the matrix is singular */
00180 /*     to working precision.  Note that the error may still be small even */
00181 /*     if this number is very small and the matrix appears ill- */
00182 /*     conditioned. */
00183 
00184 /*     BERR    (output) DOUBLE PRECISION array, dimension (NRHS) */
00185 /*     Componentwise relative backward error.  This is the */
00186 /*     componentwise relative backward error of each solution vector X(j) */
00187 /*     (i.e., the smallest relative change in any element of A or B that */
00188 /*     makes X(j) an exact solution). */
00189 
00190 /*     N_ERR_BNDS (input) INTEGER */
00191 /*     Number of error bounds to return for each right hand side */
00192 /*     and each type (normwise or componentwise).  See ERR_BNDS_NORM and */
00193 /*     ERR_BNDS_COMP below. */
00194 
00195 /*     ERR_BNDS_NORM  (output) DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS) */
00196 /*     For each right-hand side, this array contains information about */
00197 /*     various error bounds and condition numbers corresponding to the */
00198 /*     normwise relative error, which is defined as follows: */
00199 
00200 /*     Normwise relative error in the ith solution vector: */
00201 /*             max_j (abs(XTRUE(j,i) - X(j,i))) */
00202 /*            ------------------------------ */
00203 /*                  max_j abs(X(j,i)) */
00204 
00205 /*     The array is indexed by the type of error information as described */
00206 /*     below. There currently are up to three pieces of information */
00207 /*     returned. */
00208 
00209 /*     The first index in ERR_BNDS_NORM(i,:) corresponds to the ith */
00210 /*     right-hand side. */
00211 
00212 /*     The second index in ERR_BNDS_NORM(:,err) contains the following */
00213 /*     three fields: */
00214 /*     err = 1 "Trust/don't trust" boolean. Trust the answer if the */
00215 /*              reciprocal condition number is less than the threshold */
00216 /*              sqrt(n) * dlamch('Epsilon'). */
00217 
00218 /*     err = 2 "Guaranteed" error bound: The estimated forward error, */
00219 /*              almost certainly within a factor of 10 of the true error */
00220 /*              so long as the next entry is greater than the threshold */
00221 /*              sqrt(n) * dlamch('Epsilon'). This error bound should only */
00222 /*              be trusted if the previous boolean is true. */
00223 
00224 /*     err = 3  Reciprocal condition number: Estimated normwise */
00225 /*              reciprocal condition number.  Compared with the threshold */
00226 /*              sqrt(n) * dlamch('Epsilon') to determine if the error */
00227 /*              estimate is "guaranteed". These reciprocal condition */
00228 /*              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some */
00229 /*              appropriately scaled matrix Z. */
00230 /*              Let Z = S*A, where S scales each row by a power of the */
00231 /*              radix so all absolute row sums of Z are approximately 1. */
00232 
00233 /*     See Lapack Working Note 165 for further details and extra */
00234 /*     cautions. */
00235 
00236 /*     ERR_BNDS_COMP  (output) DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS) */
00237 /*     For each right-hand side, this array contains information about */
00238 /*     various error bounds and condition numbers corresponding to the */
00239 /*     componentwise relative error, which is defined as follows: */
00240 
00241 /*     Componentwise relative error in the ith solution vector: */
00242 /*                    abs(XTRUE(j,i) - X(j,i)) */
00243 /*             max_j ---------------------- */
00244 /*                         abs(X(j,i)) */
00245 
00246 /*     The array is indexed by the right-hand side i (on which the */
00247 /*     componentwise relative error depends), and the type of error */
00248 /*     information as described below. There currently are up to three */
00249 /*     pieces of information returned for each right-hand side. If */
00250 /*     componentwise accuracy is not requested (PARAMS(3) = 0.0), then */
00251 /*     ERR_BNDS_COMP is not accessed.  If N_ERR_BNDS .LT. 3, then at most */
00252 /*     the first (:,N_ERR_BNDS) entries are returned. */
00253 
00254 /*     The first index in ERR_BNDS_COMP(i,:) corresponds to the ith */
00255 /*     right-hand side. */
00256 
00257 /*     The second index in ERR_BNDS_COMP(:,err) contains the following */
00258 /*     three fields: */
00259 /*     err = 1 "Trust/don't trust" boolean. Trust the answer if the */
00260 /*              reciprocal condition number is less than the threshold */
00261 /*              sqrt(n) * dlamch('Epsilon'). */
00262 
00263 /*     err = 2 "Guaranteed" error bound: The estimated forward error, */
00264 /*              almost certainly within a factor of 10 of the true error */
00265 /*              so long as the next entry is greater than the threshold */
00266 /*              sqrt(n) * dlamch('Epsilon'). This error bound should only */
00267 /*              be trusted if the previous boolean is true. */
00268 
00269 /*     err = 3  Reciprocal condition number: Estimated componentwise */
00270 /*              reciprocal condition number.  Compared with the threshold */
00271 /*              sqrt(n) * dlamch('Epsilon') to determine if the error */
00272 /*              estimate is "guaranteed". These reciprocal condition */
00273 /*              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some */
00274 /*              appropriately scaled matrix Z. */
00275 /*              Let Z = S*(A*diag(x)), where x is the solution for the */
00276 /*              current right-hand side and S scales each row of */
00277 /*              A*diag(x) by a power of the radix so all absolute row */
00278 /*              sums of Z are approximately 1. */
00279 
00280 /*     See Lapack Working Note 165 for further details and extra */
00281 /*     cautions. */
00282 
00283 /*     NPARAMS (input) INTEGER */
00284 /*     Specifies the number of parameters set in PARAMS.  If .LE. 0, the */
00285 /*     PARAMS array is never referenced and default values are used. */
00286 
00287 /*     PARAMS  (input / output) DOUBLE PRECISION array, dimension NPARAMS */
00288 /*     Specifies algorithm parameters.  If an entry is .LT. 0.0, then */
00289 /*     that entry will be filled with default value used for that */
00290 /*     parameter.  Only positions up to NPARAMS are accessed; defaults */
00291 /*     are used for higher-numbered parameters. */
00292 
00293 /*       PARAMS(LA_LINRX_ITREF_I = 1) : Whether to perform iterative */
00294 /*            refinement or not. */
00295 /*         Default: 1.0D+0 */
00296 /*            = 0.0 : No refinement is performed, and no error bounds are */
00297 /*                    computed. */
00298 /*            = 1.0 : Use the double-precision refinement algorithm, */
00299 /*                    possibly with doubled-single computations if the */
00300 /*                    compilation environment does not support DOUBLE */
00301 /*                    PRECISION. */
00302 /*              (other values are reserved for future use) */
00303 
00304 /*       PARAMS(LA_LINRX_ITHRESH_I = 2) : Maximum number of residual */
00305 /*            computations allowed for refinement. */
00306 /*         Default: 10 */
00307 /*         Aggressive: Set to 100 to permit convergence using approximate */
00308 /*                     factorizations or factorizations other than LU. If */
00309 /*                     the factorization uses a technique other than */
00310 /*                     Gaussian elimination, the guarantees in */
00311 /*                     err_bnds_norm and err_bnds_comp may no longer be */
00312 /*                     trustworthy. */
00313 
00314 /*       PARAMS(LA_LINRX_CWISE_I = 3) : Flag determining if the code */
00315 /*            will attempt to find a solution with small componentwise */
00316 /*            relative error in the double-precision algorithm.  Positive */
00317 /*            is true, 0.0 is false. */
00318 /*         Default: 1.0 (attempt componentwise convergence) */
00319 
00320 /*     WORK    (workspace) DOUBLE PRECISION array, dimension (4*N) */
00321 
00322 /*     IWORK   (workspace) INTEGER array, dimension (N) */
00323 
00324 /*     INFO    (output) INTEGER */
00325 /*       = 0:  Successful exit. The solution to every right-hand side is */
00326 /*         guaranteed. */
00327 /*       < 0:  If INFO = -i, the i-th argument had an illegal value */
00328 /*       > 0 and <= N:  U(INFO,INFO) is exactly zero.  The factorization */
00329 /*         has been completed, but the factor U is exactly singular, so */
00330 /*         the solution and error bounds could not be computed. RCOND = 0 */
00331 /*         is returned. */
00332 /*       = N+J: The solution corresponding to the Jth right-hand side is */
00333 /*         not guaranteed. The solutions corresponding to other right- */
00334 /*         hand sides K with K > J may not be guaranteed as well, but */
00335 /*         only the first such right-hand side is reported. If a small */
00336 /*         componentwise error is not requested (PARAMS(3) = 0.0) then */
00337 /*         the Jth right-hand side is the first with a normwise error */
00338 /*         bound that is not guaranteed (the smallest J such */
00339 /*         that ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0) */
00340 /*         the Jth right-hand side is the first with either a normwise or */
00341 /*         componentwise error bound that is not guaranteed (the smallest */
00342 /*         J such that either ERR_BNDS_NORM(J,1) = 0.0 or */
00343 /*         ERR_BNDS_COMP(J,1) = 0.0). See the definition of */
00344 /*         ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information */
00345 /*         about all of the right-hand sides check ERR_BNDS_NORM or */
00346 /*         ERR_BNDS_COMP. */
00347 
00348 /*     ================================================================== */
00349 
00350 /*     .. Parameters .. */
00351 /*     .. */
00352 /*     .. Local Scalars .. */
00353 /*     .. */
00354 /*     .. External Subroutines .. */
00355 /*     .. */
00356 /*     .. Intrinsic Functions .. */
00357 /*     .. */
00358 /*     .. External Functions .. */
00359 /*     .. */
00360 /*     .. Executable Statements .. */
00361 
00362 /*     Check the input parameters. */
00363 
00364     /* Parameter adjustments */
00365     err_bnds_comp_dim1 = *nrhs;
00366     err_bnds_comp_offset = 1 + err_bnds_comp_dim1;
00367     err_bnds_comp__ -= err_bnds_comp_offset;
00368     err_bnds_norm_dim1 = *nrhs;
00369     err_bnds_norm_offset = 1 + err_bnds_norm_dim1;
00370     err_bnds_norm__ -= err_bnds_norm_offset;
00371     a_dim1 = *lda;
00372     a_offset = 1 + a_dim1;
00373     a -= a_offset;
00374     af_dim1 = *ldaf;
00375     af_offset = 1 + af_dim1;
00376     af -= af_offset;
00377     --s;
00378     b_dim1 = *ldb;
00379     b_offset = 1 + b_dim1;
00380     b -= b_offset;
00381     x_dim1 = *ldx;
00382     x_offset = 1 + x_dim1;
00383     x -= x_offset;
00384     --berr;
00385     --params;
00386     --work;
00387     --iwork;
00388 
00389     /* Function Body */
00390     *info = 0;
00391     ref_type__ = 1;
00392     if (*nparams >= 1) {
00393         if (params[1] < 0.) {
00394             params[1] = 1.;
00395         } else {
00396             ref_type__ = (integer) params[1];
00397         }
00398     }
00399 
00400 /*     Set default parameters. */
00401 
00402     illrcond_thresh__ = (doublereal) (*n) * dlamch_("Epsilon");
00403     ithresh = 10;
00404     rthresh = .5;
00405     unstable_thresh__ = .25;
00406     ignore_cwise__ = FALSE_;
00407 
00408     if (*nparams >= 2) {
00409         if (params[2] < 0.) {
00410             params[2] = (doublereal) ithresh;
00411         } else {
00412             ithresh = (integer) params[2];
00413         }
00414     }
00415     if (*nparams >= 3) {
00416         if (params[3] < 0.) {
00417             if (ignore_cwise__) {
00418                 params[3] = 0.;
00419             } else {
00420                 params[3] = 1.;
00421             }
00422         } else {
00423             ignore_cwise__ = params[3] == 0.;
00424         }
00425     }
00426     if (ref_type__ == 0 || *n_err_bnds__ == 0) {
00427         n_norms__ = 0;
00428     } else if (ignore_cwise__) {
00429         n_norms__ = 1;
00430     } else {
00431         n_norms__ = 2;
00432     }
00433 
00434     rcequ = lsame_(equed, "Y");
00435 
00436 /*     Test input parameters. */
00437 
00438     if (! lsame_(uplo, "U") && ! lsame_(uplo, "L")) {
00439         *info = -1;
00440     } else if (! rcequ && ! lsame_(equed, "N")) {
00441         *info = -2;
00442     } else if (*n < 0) {
00443         *info = -3;
00444     } else if (*nrhs < 0) {
00445         *info = -4;
00446     } else if (*lda < max(1,*n)) {
00447         *info = -6;
00448     } else if (*ldaf < max(1,*n)) {
00449         *info = -8;
00450     } else if (*ldb < max(1,*n)) {
00451         *info = -11;
00452     } else if (*ldx < max(1,*n)) {
00453         *info = -13;
00454     }
00455     if (*info != 0) {
00456         i__1 = -(*info);
00457         xerbla_("DPORFSX", &i__1);
00458         return 0;
00459     }
00460 
00461 /*     Quick return if possible. */
00462 
00463     if (*n == 0 || *nrhs == 0) {
00464         *rcond = 1.;
00465         i__1 = *nrhs;
00466         for (j = 1; j <= i__1; ++j) {
00467             berr[j] = 0.;
00468             if (*n_err_bnds__ >= 1) {
00469                 err_bnds_norm__[j + err_bnds_norm_dim1] = 1.;
00470                 err_bnds_comp__[j + err_bnds_comp_dim1] = 1.;
00471             } else if (*n_err_bnds__ >= 2) {
00472                 err_bnds_norm__[j + (err_bnds_norm_dim1 << 1)] = 0.;
00473                 err_bnds_comp__[j + (err_bnds_comp_dim1 << 1)] = 0.;
00474             } else if (*n_err_bnds__ >= 3) {
00475                 err_bnds_norm__[j + err_bnds_norm_dim1 * 3] = 1.;
00476                 err_bnds_comp__[j + err_bnds_comp_dim1 * 3] = 1.;
00477             }
00478         }
00479         return 0;
00480     }
00481 
00482 /*     Default to failure. */
00483 
00484     *rcond = 0.;
00485     i__1 = *nrhs;
00486     for (j = 1; j <= i__1; ++j) {
00487         berr[j] = 1.;
00488         if (*n_err_bnds__ >= 1) {
00489             err_bnds_norm__[j + err_bnds_norm_dim1] = 1.;
00490             err_bnds_comp__[j + err_bnds_comp_dim1] = 1.;
00491         } else if (*n_err_bnds__ >= 2) {
00492             err_bnds_norm__[j + (err_bnds_norm_dim1 << 1)] = 1.;
00493             err_bnds_comp__[j + (err_bnds_comp_dim1 << 1)] = 1.;
00494         } else if (*n_err_bnds__ >= 3) {
00495             err_bnds_norm__[j + err_bnds_norm_dim1 * 3] = 0.;
00496             err_bnds_comp__[j + err_bnds_comp_dim1 * 3] = 0.;
00497         }
00498     }
00499 
00500 /*     Compute the norm of A and the reciprocal of the condition */
00501 /*     number of A. */
00502 
00503     *(unsigned char *)norm = 'I';
00504     anorm = dlansy_(norm, uplo, n, &a[a_offset], lda, &work[1]);
00505     dpocon_(uplo, n, &af[af_offset], ldaf, &anorm, rcond, &work[1], &iwork[1], 
00506              info);
00507 
00508 /*     Perform refinement on each right-hand side */
00509 
00510     if (ref_type__ != 0) {
00511         prec_type__ = ilaprec_("E");
00512         dla_porfsx_extended__(&prec_type__, uplo, n, nrhs, &a[a_offset], lda, 
00513                 &af[af_offset], ldaf, &rcequ, &s[1], &b[b_offset], ldb, &x[
00514                 x_offset], ldx, &berr[1], &n_norms__, &err_bnds_norm__[
00515                 err_bnds_norm_offset], &err_bnds_comp__[err_bnds_comp_offset],
00516                  &work[*n + 1], &work[1], &work[(*n << 1) + 1], &work[1], 
00517                 rcond, &ithresh, &rthresh, &unstable_thresh__, &
00518                 ignore_cwise__, info, (ftnlen)1);
00519     }
00520 /* Computing MAX */
00521     d__1 = 10., d__2 = sqrt((doublereal) (*n));
00522     err_lbnd__ = max(d__1,d__2) * dlamch_("Epsilon");
00523     if (*n_err_bnds__ >= 1 && n_norms__ >= 1) {
00524 
00525 /*     Compute scaled normwise condition number cond(A*C). */
00526 
00527         if (rcequ) {
00528             rcond_tmp__ = dla_porcond__(uplo, n, &a[a_offset], lda, &af[
00529                     af_offset], ldaf, &c_n1, &s[1], info, &work[1], &iwork[1],
00530                      (ftnlen)1);
00531         } else {
00532             rcond_tmp__ = dla_porcond__(uplo, n, &a[a_offset], lda, &af[
00533                     af_offset], ldaf, &c__0, &s[1], info, &work[1], &iwork[1],
00534                      (ftnlen)1);
00535         }
00536         i__1 = *nrhs;
00537         for (j = 1; j <= i__1; ++j) {
00538 
00539 /*     Cap the error at 1.0. */
00540 
00541             if (*n_err_bnds__ >= 2 && err_bnds_norm__[j + (err_bnds_norm_dim1 
00542                     << 1)] > 1.) {
00543                 err_bnds_norm__[j + (err_bnds_norm_dim1 << 1)] = 1.;
00544             }
00545 
00546 /*     Threshold the error (see LAWN). */
00547 
00548             if (rcond_tmp__ < illrcond_thresh__) {
00549                 err_bnds_norm__[j + (err_bnds_norm_dim1 << 1)] = 1.;
00550                 err_bnds_norm__[j + err_bnds_norm_dim1] = 0.;
00551                 if (*info <= *n) {
00552                     *info = *n + j;
00553                 }
00554             } else if (err_bnds_norm__[j + (err_bnds_norm_dim1 << 1)] < 
00555                     err_lbnd__) {
00556                 err_bnds_norm__[j + (err_bnds_norm_dim1 << 1)] = err_lbnd__;
00557                 err_bnds_norm__[j + err_bnds_norm_dim1] = 1.;
00558             }
00559 
00560 /*     Save the condition number. */
00561 
00562             if (*n_err_bnds__ >= 3) {
00563                 err_bnds_norm__[j + err_bnds_norm_dim1 * 3] = rcond_tmp__;
00564             }
00565         }
00566     }
00567     if (*n_err_bnds__ >= 1 && n_norms__ >= 2) {
00568 
00569 /*     Compute componentwise condition number cond(A*diag(Y(:,J))) for */
00570 /*     each right-hand side using the current solution as an estimate of */
00571 /*     the true solution.  If the componentwise error estimate is too */
00572 /*     large, then the solution is a lousy estimate of truth and the */
00573 /*     estimated RCOND may be too optimistic.  To avoid misleading users, */
00574 /*     the inverse condition number is set to 0.0 when the estimated */
00575 /*     cwise error is at least CWISE_WRONG. */
00576 
00577         cwise_wrong__ = sqrt(dlamch_("Epsilon"));
00578         i__1 = *nrhs;
00579         for (j = 1; j <= i__1; ++j) {
00580             if (err_bnds_comp__[j + (err_bnds_comp_dim1 << 1)] < 
00581                     cwise_wrong__) {
00582                 rcond_tmp__ = dla_porcond__(uplo, n, &a[a_offset], lda, &af[
00583                         af_offset], ldaf, &c__1, &x[j * x_dim1 + 1], info, &
00584                         work[1], &iwork[1], (ftnlen)1);
00585             } else {
00586                 rcond_tmp__ = 0.;
00587             }
00588 
00589 /*     Cap the error at 1.0. */
00590 
00591             if (*n_err_bnds__ >= 2 && err_bnds_comp__[j + (err_bnds_comp_dim1 
00592                     << 1)] > 1.) {
00593                 err_bnds_comp__[j + (err_bnds_comp_dim1 << 1)] = 1.;
00594             }
00595 
00596 /*     Threshold the error (see LAWN). */
00597 
00598             if (rcond_tmp__ < illrcond_thresh__) {
00599                 err_bnds_comp__[j + (err_bnds_comp_dim1 << 1)] = 1.;
00600                 err_bnds_comp__[j + err_bnds_comp_dim1] = 0.;
00601                 if (params[3] == 1. && *info < *n + j) {
00602                     *info = *n + j;
00603                 }
00604             } else if (err_bnds_comp__[j + (err_bnds_comp_dim1 << 1)] < 
00605                     err_lbnd__) {
00606                 err_bnds_comp__[j + (err_bnds_comp_dim1 << 1)] = err_lbnd__;
00607                 err_bnds_comp__[j + err_bnds_comp_dim1] = 1.;
00608             }
00609 
00610 /*     Save the condition number. */
00611 
00612             if (*n_err_bnds__ >= 3) {
00613                 err_bnds_comp__[j + err_bnds_comp_dim1 * 3] = rcond_tmp__;
00614             }
00615         }
00616     }
00617 
00618     return 0;
00619 
00620 /*     End of DPORFSX */
00621 
00622 } /* dporfsx_ */


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