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


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