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


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