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


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