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


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