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