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


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