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


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