00001 /* dgbsvx.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__1 = 1; 00019 00020 /* Subroutine */ int dgbsvx_(char *fact, char *trans, integer *n, integer *kl, 00021 integer *ku, integer *nrhs, doublereal *ab, integer *ldab, 00022 doublereal *afb, integer *ldafb, integer *ipiv, char *equed, 00023 doublereal *r__, doublereal *c__, doublereal *b, integer *ldb, 00024 doublereal *x, integer *ldx, doublereal *rcond, doublereal *ferr, 00025 doublereal *berr, doublereal *work, integer *iwork, integer *info) 00026 { 00027 /* System generated locals */ 00028 integer ab_dim1, ab_offset, afb_dim1, afb_offset, b_dim1, b_offset, 00029 x_dim1, x_offset, i__1, i__2, i__3, i__4, i__5; 00030 doublereal d__1, d__2, d__3; 00031 00032 /* Local variables */ 00033 integer i__, j, j1, j2; 00034 doublereal amax; 00035 char norm[1]; 00036 extern logical lsame_(char *, char *); 00037 doublereal rcmin, rcmax, anorm; 00038 extern /* Subroutine */ int dcopy_(integer *, doublereal *, integer *, 00039 doublereal *, integer *); 00040 logical equil; 00041 extern doublereal dlangb_(char *, integer *, integer *, integer *, 00042 doublereal *, integer *, doublereal *), dlamch_(char *); 00043 extern /* Subroutine */ int dlaqgb_(integer *, integer *, integer *, 00044 integer *, doublereal *, integer *, doublereal *, doublereal *, 00045 doublereal *, doublereal *, doublereal *, char *), 00046 dgbcon_(char *, integer *, integer *, integer *, doublereal *, 00047 integer *, integer *, doublereal *, doublereal *, doublereal *, 00048 integer *, integer *); 00049 doublereal colcnd; 00050 extern doublereal dlantb_(char *, char *, char *, integer *, integer *, 00051 doublereal *, integer *, doublereal *); 00052 extern /* Subroutine */ int dgbequ_(integer *, integer *, integer *, 00053 integer *, doublereal *, integer *, doublereal *, doublereal *, 00054 doublereal *, doublereal *, doublereal *, integer *), dgbrfs_( 00055 char *, integer *, integer *, integer *, integer *, doublereal *, 00056 integer *, doublereal *, integer *, integer *, doublereal *, 00057 integer *, doublereal *, integer *, doublereal *, doublereal *, 00058 doublereal *, integer *, integer *), dgbtrf_(integer *, 00059 integer *, integer *, integer *, doublereal *, integer *, integer 00060 *, integer *); 00061 logical nofact; 00062 extern /* Subroutine */ int dlacpy_(char *, integer *, integer *, 00063 doublereal *, integer *, doublereal *, integer *), 00064 xerbla_(char *, integer *); 00065 doublereal bignum; 00066 extern /* Subroutine */ int dgbtrs_(char *, integer *, integer *, integer 00067 *, integer *, doublereal *, integer *, integer *, doublereal *, 00068 integer *, integer *); 00069 integer infequ; 00070 logical colequ; 00071 doublereal rowcnd; 00072 logical notran; 00073 doublereal smlnum; 00074 logical rowequ; 00075 doublereal rpvgrw; 00076 00077 00078 /* -- LAPACK driver routine (version 3.2) -- */ 00079 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ 00080 /* November 2006 */ 00081 00082 /* .. Scalar Arguments .. */ 00083 /* .. */ 00084 /* .. Array Arguments .. */ 00085 /* .. */ 00086 00087 /* Purpose */ 00088 /* ======= */ 00089 00090 /* DGBSVX uses the LU factorization to compute the solution to a real */ 00091 /* system of linear equations A * X = B, A**T * X = B, or A**H * X = B, */ 00092 /* where A is a band matrix of order N with KL subdiagonals and KU */ 00093 /* superdiagonals, and X and B are N-by-NRHS matrices. */ 00094 00095 /* Error bounds on the solution and a condition estimate are also */ 00096 /* provided. */ 00097 00098 /* Description */ 00099 /* =========== */ 00100 00101 /* The following steps are performed by this subroutine: */ 00102 00103 /* 1. If FACT = 'E', real scaling factors are computed to equilibrate */ 00104 /* the system: */ 00105 /* TRANS = 'N': diag(R)*A*diag(C) *inv(diag(C))*X = diag(R)*B */ 00106 /* TRANS = 'T': (diag(R)*A*diag(C))**T *inv(diag(R))*X = diag(C)*B */ 00107 /* TRANS = 'C': (diag(R)*A*diag(C))**H *inv(diag(R))*X = diag(C)*B */ 00108 /* Whether or not the system will be equilibrated depends on the */ 00109 /* scaling of the matrix A, but if equilibration is used, A is */ 00110 /* overwritten by diag(R)*A*diag(C) and B by diag(R)*B (if TRANS='N') */ 00111 /* or diag(C)*B (if TRANS = 'T' or 'C'). */ 00112 00113 /* 2. If FACT = 'N' or 'E', the LU decomposition is used to factor the */ 00114 /* matrix A (after equilibration if FACT = 'E') as */ 00115 /* A = L * U, */ 00116 /* where L is a product of permutation and unit lower triangular */ 00117 /* matrices with KL subdiagonals, and U is upper triangular with */ 00118 /* KL+KU superdiagonals. */ 00119 00120 /* 3. If some U(i,i)=0, so that U is exactly singular, then the routine */ 00121 /* returns with INFO = i. Otherwise, the factored form of A is used */ 00122 /* to estimate the condition number of the matrix A. If the */ 00123 /* reciprocal of the condition number is less than machine precision, */ 00124 /* INFO = N+1 is returned as a warning, but the routine still goes on */ 00125 /* to solve for X and compute error bounds as described below. */ 00126 00127 /* 4. The system of equations is solved for X using the factored form */ 00128 /* of A. */ 00129 00130 /* 5. Iterative refinement is applied to improve the computed solution */ 00131 /* matrix and calculate error bounds and backward error estimates */ 00132 /* for it. */ 00133 00134 /* 6. If equilibration was used, the matrix X is premultiplied by */ 00135 /* diag(C) (if TRANS = 'N') or diag(R) (if TRANS = 'T' or 'C') so */ 00136 /* that it solves the original system before equilibration. */ 00137 00138 /* Arguments */ 00139 /* ========= */ 00140 00141 /* FACT (input) CHARACTER*1 */ 00142 /* Specifies whether or not the factored form of the matrix A is */ 00143 /* supplied on entry, and if not, whether the matrix A should be */ 00144 /* equilibrated before it is factored. */ 00145 /* = 'F': On entry, AFB and IPIV contain the factored form of */ 00146 /* A. If EQUED is not 'N', the matrix A has been */ 00147 /* equilibrated with scaling factors given by R and C. */ 00148 /* AB, AFB, and IPIV are not modified. */ 00149 /* = 'N': The matrix A will be copied to AFB and factored. */ 00150 /* = 'E': The matrix A will be equilibrated if necessary, then */ 00151 /* copied to AFB and factored. */ 00152 00153 /* TRANS (input) CHARACTER*1 */ 00154 /* Specifies the form of the system of equations. */ 00155 /* = 'N': A * X = B (No transpose) */ 00156 /* = 'T': A**T * X = B (Transpose) */ 00157 /* = 'C': A**H * X = B (Transpose) */ 00158 00159 /* N (input) INTEGER */ 00160 /* The number of linear equations, i.e., the order of the */ 00161 /* matrix A. N >= 0. */ 00162 00163 /* KL (input) INTEGER */ 00164 /* The number of subdiagonals within the band of A. KL >= 0. */ 00165 00166 /* KU (input) INTEGER */ 00167 /* The number of superdiagonals within the band of A. KU >= 0. */ 00168 00169 /* NRHS (input) INTEGER */ 00170 /* The number of right hand sides, i.e., the number of columns */ 00171 /* of the matrices B and X. NRHS >= 0. */ 00172 00173 /* AB (input/output) DOUBLE PRECISION array, dimension (LDAB,N) */ 00174 /* On entry, the matrix A in band storage, in rows 1 to KL+KU+1. */ 00175 /* The j-th column of A is stored in the j-th column of the */ 00176 /* array AB as follows: */ 00177 /* AB(KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+kl) */ 00178 00179 /* If FACT = 'F' and EQUED is not 'N', then A must have been */ 00180 /* equilibrated by the scaling factors in R and/or C. AB is not */ 00181 /* modified if FACT = 'F' or 'N', or if FACT = 'E' and */ 00182 /* EQUED = 'N' on exit. */ 00183 00184 /* On exit, if EQUED .ne. 'N', A is scaled as follows: */ 00185 /* EQUED = 'R': A := diag(R) * A */ 00186 /* EQUED = 'C': A := A * diag(C) */ 00187 /* EQUED = 'B': A := diag(R) * A * diag(C). */ 00188 00189 /* LDAB (input) INTEGER */ 00190 /* The leading dimension of the array AB. LDAB >= KL+KU+1. */ 00191 00192 /* AFB (input or output) DOUBLE PRECISION array, dimension (LDAFB,N) */ 00193 /* If FACT = 'F', then AFB is an input argument and on entry */ 00194 /* contains details of the LU factorization of the band matrix */ 00195 /* A, as computed by DGBTRF. U is stored as an upper triangular */ 00196 /* band matrix with KL+KU superdiagonals in rows 1 to KL+KU+1, */ 00197 /* and the multipliers used during the factorization are stored */ 00198 /* in rows KL+KU+2 to 2*KL+KU+1. If EQUED .ne. 'N', then AFB is */ 00199 /* the factored form of the equilibrated matrix A. */ 00200 00201 /* If FACT = 'N', then AFB is an output argument and on exit */ 00202 /* returns details of the LU factorization of A. */ 00203 00204 /* If FACT = 'E', then AFB is an output argument and on exit */ 00205 /* returns details of the LU factorization of the equilibrated */ 00206 /* matrix A (see the description of AB for the form of the */ 00207 /* equilibrated matrix). */ 00208 00209 /* LDAFB (input) INTEGER */ 00210 /* The leading dimension of the array AFB. LDAFB >= 2*KL+KU+1. */ 00211 00212 /* IPIV (input or output) INTEGER array, dimension (N) */ 00213 /* If FACT = 'F', then IPIV is an input argument and on entry */ 00214 /* contains the pivot indices from the factorization A = L*U */ 00215 /* as computed by DGBTRF; row i of the matrix was interchanged */ 00216 /* with row IPIV(i). */ 00217 00218 /* If FACT = 'N', then IPIV is an output argument and on exit */ 00219 /* contains the pivot indices from the factorization A = L*U */ 00220 /* of the original matrix A. */ 00221 00222 /* If FACT = 'E', then IPIV is an output argument and on exit */ 00223 /* contains the pivot indices from the factorization A = L*U */ 00224 /* of the equilibrated matrix A. */ 00225 00226 /* EQUED (input or output) CHARACTER*1 */ 00227 /* Specifies the form of equilibration that was done. */ 00228 /* = 'N': No equilibration (always true if FACT = 'N'). */ 00229 /* = 'R': Row equilibration, i.e., A has been premultiplied by */ 00230 /* diag(R). */ 00231 /* = 'C': Column equilibration, i.e., A has been postmultiplied */ 00232 /* by diag(C). */ 00233 /* = 'B': Both row and column equilibration, i.e., A has been */ 00234 /* replaced by diag(R) * A * diag(C). */ 00235 /* EQUED is an input argument if FACT = 'F'; otherwise, it is an */ 00236 /* output argument. */ 00237 00238 /* R (input or output) DOUBLE PRECISION array, dimension (N) */ 00239 /* The row scale factors for A. If EQUED = 'R' or 'B', A is */ 00240 /* multiplied on the left by diag(R); if EQUED = 'N' or 'C', R */ 00241 /* is not accessed. R is an input argument if FACT = 'F'; */ 00242 /* otherwise, R is an output argument. If FACT = 'F' and */ 00243 /* EQUED = 'R' or 'B', each element of R must be positive. */ 00244 00245 /* C (input or output) DOUBLE PRECISION array, dimension (N) */ 00246 /* The column scale factors for A. If EQUED = 'C' or 'B', A is */ 00247 /* multiplied on the right by diag(C); if EQUED = 'N' or 'R', C */ 00248 /* is not accessed. C is an input argument if FACT = 'F'; */ 00249 /* otherwise, C is an output argument. If FACT = 'F' and */ 00250 /* EQUED = 'C' or 'B', each element of C must be positive. */ 00251 00252 /* B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS) */ 00253 /* On entry, the right hand side matrix B. */ 00254 /* On exit, */ 00255 /* if EQUED = 'N', B is not modified; */ 00256 /* if TRANS = 'N' and EQUED = 'R' or 'B', B is overwritten by */ 00257 /* diag(R)*B; */ 00258 /* if TRANS = 'T' or 'C' and EQUED = 'C' or 'B', B is */ 00259 /* overwritten by diag(C)*B. */ 00260 00261 /* LDB (input) INTEGER */ 00262 /* The leading dimension of the array B. LDB >= max(1,N). */ 00263 00264 /* X (output) DOUBLE PRECISION array, dimension (LDX,NRHS) */ 00265 /* If INFO = 0 or INFO = N+1, the N-by-NRHS solution matrix X */ 00266 /* to the original system of equations. Note that A and B are */ 00267 /* modified on exit if EQUED .ne. 'N', and the solution to the */ 00268 /* equilibrated system is inv(diag(C))*X if TRANS = 'N' and */ 00269 /* EQUED = 'C' or 'B', or inv(diag(R))*X if TRANS = 'T' or 'C' */ 00270 /* and EQUED = 'R' or 'B'. */ 00271 00272 /* LDX (input) INTEGER */ 00273 /* The leading dimension of the array X. LDX >= max(1,N). */ 00274 00275 /* RCOND (output) DOUBLE PRECISION */ 00276 /* The estimate of the reciprocal condition number of the matrix */ 00277 /* A after equilibration (if done). If RCOND is less than the */ 00278 /* machine precision (in particular, if RCOND = 0), the matrix */ 00279 /* is singular to working precision. This condition is */ 00280 /* indicated by a return code of INFO > 0. */ 00281 00282 /* FERR (output) DOUBLE PRECISION array, dimension (NRHS) */ 00283 /* The estimated forward error bound for each solution vector */ 00284 /* X(j) (the j-th column of the solution matrix X). */ 00285 /* If XTRUE is the true solution corresponding to X(j), FERR(j) */ 00286 /* is an estimated upper bound for the magnitude of the largest */ 00287 /* element in (X(j) - XTRUE) divided by the magnitude of the */ 00288 /* largest element in X(j). The estimate is as reliable as */ 00289 /* the estimate for RCOND, and is almost always a slight */ 00290 /* overestimate of the true error. */ 00291 00292 /* BERR (output) DOUBLE PRECISION array, dimension (NRHS) */ 00293 /* The componentwise relative backward error of each solution */ 00294 /* vector X(j) (i.e., the smallest relative change in */ 00295 /* any element of A or B that makes X(j) an exact solution). */ 00296 00297 /* WORK (workspace/output) DOUBLE PRECISION array, dimension (3*N) */ 00298 /* On exit, WORK(1) contains the reciprocal pivot growth */ 00299 /* factor norm(A)/norm(U). The "max absolute element" norm is */ 00300 /* used. If WORK(1) is much less than 1, then the stability */ 00301 /* of the LU factorization of the (equilibrated) matrix A */ 00302 /* could be poor. This also means that the solution X, condition */ 00303 /* estimator RCOND, and forward error bound FERR could be */ 00304 /* unreliable. If factorization fails with 0<INFO<=N, then */ 00305 /* WORK(1) contains the reciprocal pivot growth factor for the */ 00306 /* leading INFO columns of A. */ 00307 00308 /* IWORK (workspace) INTEGER array, dimension (N) */ 00309 00310 /* INFO (output) INTEGER */ 00311 /* = 0: successful exit */ 00312 /* < 0: if INFO = -i, the i-th argument had an illegal value */ 00313 /* > 0: if INFO = i, and i is */ 00314 /* <= N: U(i,i) is exactly zero. The factorization */ 00315 /* has been completed, but the factor U is exactly */ 00316 /* singular, so the solution and error bounds */ 00317 /* could not be computed. RCOND = 0 is returned. */ 00318 /* = N+1: U is nonsingular, but RCOND is less than machine */ 00319 /* precision, meaning that the matrix is singular */ 00320 /* to working precision. Nevertheless, the */ 00321 /* solution and error bounds are computed because */ 00322 /* there are a number of situations where the */ 00323 /* computed solution can be more accurate than the */ 00324 /* value of RCOND would suggest. */ 00325 00326 /* ===================================================================== */ 00327 00328 /* .. Parameters .. */ 00329 /* .. */ 00330 /* .. Local Scalars .. */ 00331 /* .. */ 00332 /* .. External Functions .. */ 00333 /* .. */ 00334 /* .. External Subroutines .. */ 00335 /* .. */ 00336 /* .. Intrinsic Functions .. */ 00337 /* .. */ 00338 /* .. Executable Statements .. */ 00339 00340 /* Parameter adjustments */ 00341 ab_dim1 = *ldab; 00342 ab_offset = 1 + ab_dim1; 00343 ab -= ab_offset; 00344 afb_dim1 = *ldafb; 00345 afb_offset = 1 + afb_dim1; 00346 afb -= afb_offset; 00347 --ipiv; 00348 --r__; 00349 --c__; 00350 b_dim1 = *ldb; 00351 b_offset = 1 + b_dim1; 00352 b -= b_offset; 00353 x_dim1 = *ldx; 00354 x_offset = 1 + x_dim1; 00355 x -= x_offset; 00356 --ferr; 00357 --berr; 00358 --work; 00359 --iwork; 00360 00361 /* Function Body */ 00362 *info = 0; 00363 nofact = lsame_(fact, "N"); 00364 equil = lsame_(fact, "E"); 00365 notran = lsame_(trans, "N"); 00366 if (nofact || equil) { 00367 *(unsigned char *)equed = 'N'; 00368 rowequ = FALSE_; 00369 colequ = FALSE_; 00370 } else { 00371 rowequ = lsame_(equed, "R") || lsame_(equed, 00372 "B"); 00373 colequ = lsame_(equed, "C") || lsame_(equed, 00374 "B"); 00375 smlnum = dlamch_("Safe minimum"); 00376 bignum = 1. / smlnum; 00377 } 00378 00379 /* Test the input parameters. */ 00380 00381 if (! nofact && ! equil && ! lsame_(fact, "F")) { 00382 *info = -1; 00383 } else if (! notran && ! lsame_(trans, "T") && ! 00384 lsame_(trans, "C")) { 00385 *info = -2; 00386 } else if (*n < 0) { 00387 *info = -3; 00388 } else if (*kl < 0) { 00389 *info = -4; 00390 } else if (*ku < 0) { 00391 *info = -5; 00392 } else if (*nrhs < 0) { 00393 *info = -6; 00394 } else if (*ldab < *kl + *ku + 1) { 00395 *info = -8; 00396 } else if (*ldafb < (*kl << 1) + *ku + 1) { 00397 *info = -10; 00398 } else if (lsame_(fact, "F") && ! (rowequ || colequ 00399 || lsame_(equed, "N"))) { 00400 *info = -12; 00401 } else { 00402 if (rowequ) { 00403 rcmin = bignum; 00404 rcmax = 0.; 00405 i__1 = *n; 00406 for (j = 1; j <= i__1; ++j) { 00407 /* Computing MIN */ 00408 d__1 = rcmin, d__2 = r__[j]; 00409 rcmin = min(d__1,d__2); 00410 /* Computing MAX */ 00411 d__1 = rcmax, d__2 = r__[j]; 00412 rcmax = max(d__1,d__2); 00413 /* L10: */ 00414 } 00415 if (rcmin <= 0.) { 00416 *info = -13; 00417 } else if (*n > 0) { 00418 rowcnd = max(rcmin,smlnum) / min(rcmax,bignum); 00419 } else { 00420 rowcnd = 1.; 00421 } 00422 } 00423 if (colequ && *info == 0) { 00424 rcmin = bignum; 00425 rcmax = 0.; 00426 i__1 = *n; 00427 for (j = 1; j <= i__1; ++j) { 00428 /* Computing MIN */ 00429 d__1 = rcmin, d__2 = c__[j]; 00430 rcmin = min(d__1,d__2); 00431 /* Computing MAX */ 00432 d__1 = rcmax, d__2 = c__[j]; 00433 rcmax = max(d__1,d__2); 00434 /* L20: */ 00435 } 00436 if (rcmin <= 0.) { 00437 *info = -14; 00438 } else if (*n > 0) { 00439 colcnd = max(rcmin,smlnum) / min(rcmax,bignum); 00440 } else { 00441 colcnd = 1.; 00442 } 00443 } 00444 if (*info == 0) { 00445 if (*ldb < max(1,*n)) { 00446 *info = -16; 00447 } else if (*ldx < max(1,*n)) { 00448 *info = -18; 00449 } 00450 } 00451 } 00452 00453 if (*info != 0) { 00454 i__1 = -(*info); 00455 xerbla_("DGBSVX", &i__1); 00456 return 0; 00457 } 00458 00459 if (equil) { 00460 00461 /* Compute row and column scalings to equilibrate the matrix A. */ 00462 00463 dgbequ_(n, n, kl, ku, &ab[ab_offset], ldab, &r__[1], &c__[1], &rowcnd, 00464 &colcnd, &amax, &infequ); 00465 if (infequ == 0) { 00466 00467 /* Equilibrate the matrix. */ 00468 00469 dlaqgb_(n, n, kl, ku, &ab[ab_offset], ldab, &r__[1], &c__[1], & 00470 rowcnd, &colcnd, &amax, equed); 00471 rowequ = lsame_(equed, "R") || lsame_(equed, 00472 "B"); 00473 colequ = lsame_(equed, "C") || lsame_(equed, 00474 "B"); 00475 } 00476 } 00477 00478 /* Scale the right hand side. */ 00479 00480 if (notran) { 00481 if (rowequ) { 00482 i__1 = *nrhs; 00483 for (j = 1; j <= i__1; ++j) { 00484 i__2 = *n; 00485 for (i__ = 1; i__ <= i__2; ++i__) { 00486 b[i__ + j * b_dim1] = r__[i__] * b[i__ + j * b_dim1]; 00487 /* L30: */ 00488 } 00489 /* L40: */ 00490 } 00491 } 00492 } else if (colequ) { 00493 i__1 = *nrhs; 00494 for (j = 1; j <= i__1; ++j) { 00495 i__2 = *n; 00496 for (i__ = 1; i__ <= i__2; ++i__) { 00497 b[i__ + j * b_dim1] = c__[i__] * b[i__ + j * b_dim1]; 00498 /* L50: */ 00499 } 00500 /* L60: */ 00501 } 00502 } 00503 00504 if (nofact || equil) { 00505 00506 /* Compute the LU factorization of the band matrix A. */ 00507 00508 i__1 = *n; 00509 for (j = 1; j <= i__1; ++j) { 00510 /* Computing MAX */ 00511 i__2 = j - *ku; 00512 j1 = max(i__2,1); 00513 /* Computing MIN */ 00514 i__2 = j + *kl; 00515 j2 = min(i__2,*n); 00516 i__2 = j2 - j1 + 1; 00517 dcopy_(&i__2, &ab[*ku + 1 - j + j1 + j * ab_dim1], &c__1, &afb[* 00518 kl + *ku + 1 - j + j1 + j * afb_dim1], &c__1); 00519 /* L70: */ 00520 } 00521 00522 dgbtrf_(n, n, kl, ku, &afb[afb_offset], ldafb, &ipiv[1], info); 00523 00524 /* Return if INFO is non-zero. */ 00525 00526 if (*info > 0) { 00527 00528 /* Compute the reciprocal pivot growth factor of the */ 00529 /* leading rank-deficient INFO columns of A. */ 00530 00531 anorm = 0.; 00532 i__1 = *info; 00533 for (j = 1; j <= i__1; ++j) { 00534 /* Computing MAX */ 00535 i__2 = *ku + 2 - j; 00536 /* Computing MIN */ 00537 i__4 = *n + *ku + 1 - j, i__5 = *kl + *ku + 1; 00538 i__3 = min(i__4,i__5); 00539 for (i__ = max(i__2,1); i__ <= i__3; ++i__) { 00540 /* Computing MAX */ 00541 d__2 = anorm, d__3 = (d__1 = ab[i__ + j * ab_dim1], abs( 00542 d__1)); 00543 anorm = max(d__2,d__3); 00544 /* L80: */ 00545 } 00546 /* L90: */ 00547 } 00548 /* Computing MIN */ 00549 i__3 = *info - 1, i__2 = *kl + *ku; 00550 i__1 = min(i__3,i__2); 00551 /* Computing MAX */ 00552 i__4 = 1, i__5 = *kl + *ku + 2 - *info; 00553 rpvgrw = dlantb_("M", "U", "N", info, &i__1, &afb[max(i__4, i__5) 00554 + afb_dim1], ldafb, &work[1]); 00555 if (rpvgrw == 0.) { 00556 rpvgrw = 1.; 00557 } else { 00558 rpvgrw = anorm / rpvgrw; 00559 } 00560 work[1] = rpvgrw; 00561 *rcond = 0.; 00562 return 0; 00563 } 00564 } 00565 00566 /* Compute the norm of the matrix A and the */ 00567 /* reciprocal pivot growth factor RPVGRW. */ 00568 00569 if (notran) { 00570 *(unsigned char *)norm = '1'; 00571 } else { 00572 *(unsigned char *)norm = 'I'; 00573 } 00574 anorm = dlangb_(norm, n, kl, ku, &ab[ab_offset], ldab, &work[1]); 00575 i__1 = *kl + *ku; 00576 rpvgrw = dlantb_("M", "U", "N", n, &i__1, &afb[afb_offset], ldafb, &work[ 00577 1]); 00578 if (rpvgrw == 0.) { 00579 rpvgrw = 1.; 00580 } else { 00581 rpvgrw = dlangb_("M", n, kl, ku, &ab[ab_offset], ldab, &work[1]) / rpvgrw; 00582 } 00583 00584 /* Compute the reciprocal of the condition number of A. */ 00585 00586 dgbcon_(norm, n, kl, ku, &afb[afb_offset], ldafb, &ipiv[1], &anorm, rcond, 00587 &work[1], &iwork[1], info); 00588 00589 /* Compute the solution matrix X. */ 00590 00591 dlacpy_("Full", n, nrhs, &b[b_offset], ldb, &x[x_offset], ldx); 00592 dgbtrs_(trans, n, kl, ku, nrhs, &afb[afb_offset], ldafb, &ipiv[1], &x[ 00593 x_offset], ldx, info); 00594 00595 /* Use iterative refinement to improve the computed solution and */ 00596 /* compute error bounds and backward error estimates for it. */ 00597 00598 dgbrfs_(trans, n, kl, ku, nrhs, &ab[ab_offset], ldab, &afb[afb_offset], 00599 ldafb, &ipiv[1], &b[b_offset], ldb, &x[x_offset], ldx, &ferr[1], & 00600 berr[1], &work[1], &iwork[1], info); 00601 00602 /* Transform the solution matrix X to a solution of the original */ 00603 /* system. */ 00604 00605 if (notran) { 00606 if (colequ) { 00607 i__1 = *nrhs; 00608 for (j = 1; j <= i__1; ++j) { 00609 i__3 = *n; 00610 for (i__ = 1; i__ <= i__3; ++i__) { 00611 x[i__ + j * x_dim1] = c__[i__] * x[i__ + j * x_dim1]; 00612 /* L100: */ 00613 } 00614 /* L110: */ 00615 } 00616 i__1 = *nrhs; 00617 for (j = 1; j <= i__1; ++j) { 00618 ferr[j] /= colcnd; 00619 /* L120: */ 00620 } 00621 } 00622 } else if (rowequ) { 00623 i__1 = *nrhs; 00624 for (j = 1; j <= i__1; ++j) { 00625 i__3 = *n; 00626 for (i__ = 1; i__ <= i__3; ++i__) { 00627 x[i__ + j * x_dim1] = r__[i__] * x[i__ + j * x_dim1]; 00628 /* L130: */ 00629 } 00630 /* L140: */ 00631 } 00632 i__1 = *nrhs; 00633 for (j = 1; j <= i__1; ++j) { 00634 ferr[j] /= rowcnd; 00635 /* L150: */ 00636 } 00637 } 00638 00639 /* Set INFO = N+1 if the matrix is singular to working precision. */ 00640 00641 if (*rcond < dlamch_("Epsilon")) { 00642 *info = *n + 1; 00643 } 00644 00645 work[1] = rpvgrw; 00646 return 0; 00647 00648 /* End of DGBSVX */ 00649 00650 } /* dgbsvx_ */