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


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