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