![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief <b> SGBSVX computes the solution to system of linear equations A * X = B for GB matrices</b> 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 *> \htmlonly 00009 *> Download SGBSVX + dependencies 00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sgbsvx.f"> 00011 *> [TGZ]</a> 00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sgbsvx.f"> 00013 *> [ZIP]</a> 00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sgbsvx.f"> 00015 *> [TXT]</a> 00016 *> \endhtmlonly 00017 * 00018 * Definition: 00019 * =========== 00020 * 00021 * SUBROUTINE SGBSVX( FACT, TRANS, N, KL, KU, NRHS, AB, LDAB, AFB, 00022 * LDAFB, IPIV, EQUED, R, C, B, LDB, X, LDX, 00023 * RCOND, FERR, BERR, WORK, IWORK, INFO ) 00024 * 00025 * .. Scalar Arguments .. 00026 * CHARACTER EQUED, FACT, TRANS 00027 * INTEGER INFO, KL, KU, LDAB, LDAFB, LDB, LDX, N, NRHS 00028 * REAL RCOND 00029 * .. 00030 * .. Array Arguments .. 00031 * INTEGER IPIV( * ), IWORK( * ) 00032 * REAL AB( LDAB, * ), AFB( LDAFB, * ), B( LDB, * ), 00033 * $ BERR( * ), C( * ), FERR( * ), R( * ), 00034 * $ WORK( * ), X( LDX, * ) 00035 * .. 00036 * 00037 * 00038 *> \par Purpose: 00039 * ============= 00040 *> 00041 *> \verbatim 00042 *> 00043 *> SGBSVX uses the LU factorization to compute the solution to a real 00044 *> system of linear equations A * X = B, A**T * X = B, or A**H * X = B, 00045 *> where A is a band matrix of order N with KL subdiagonals and KU 00046 *> superdiagonals, and X and B are N-by-NRHS matrices. 00047 *> 00048 *> Error bounds on the solution and a condition estimate are also 00049 *> provided. 00050 *> \endverbatim 00051 * 00052 *> \par Description: 00053 * ================= 00054 *> 00055 *> \verbatim 00056 *> 00057 *> The following steps are performed by this subroutine: 00058 *> 00059 *> 1. If FACT = 'E', real scaling factors are computed to equilibrate 00060 *> the system: 00061 *> TRANS = 'N': diag(R)*A*diag(C) *inv(diag(C))*X = diag(R)*B 00062 *> TRANS = 'T': (diag(R)*A*diag(C))**T *inv(diag(R))*X = diag(C)*B 00063 *> TRANS = 'C': (diag(R)*A*diag(C))**H *inv(diag(R))*X = diag(C)*B 00064 *> Whether or not the system will be equilibrated depends on the 00065 *> scaling of the matrix A, but if equilibration is used, A is 00066 *> overwritten by diag(R)*A*diag(C) and B by diag(R)*B (if TRANS='N') 00067 *> or diag(C)*B (if TRANS = 'T' or 'C'). 00068 *> 00069 *> 2. If FACT = 'N' or 'E', the LU decomposition is used to factor the 00070 *> matrix A (after equilibration if FACT = 'E') as 00071 *> A = L * U, 00072 *> where L is a product of permutation and unit lower triangular 00073 *> matrices with KL subdiagonals, and U is upper triangular with 00074 *> KL+KU superdiagonals. 00075 *> 00076 *> 3. If some U(i,i)=0, so that U is exactly singular, then the routine 00077 *> returns with INFO = i. Otherwise, the factored form of A is used 00078 *> to estimate the condition number of the matrix A. If the 00079 *> reciprocal of the condition number is less than machine precision, 00080 *> INFO = N+1 is returned as a warning, but the routine still goes on 00081 *> to solve for X and compute error bounds as described below. 00082 *> 00083 *> 4. The system of equations is solved for X using the factored form 00084 *> of A. 00085 *> 00086 *> 5. Iterative refinement is applied to improve the computed solution 00087 *> matrix and calculate error bounds and backward error estimates 00088 *> for it. 00089 *> 00090 *> 6. If equilibration was used, the matrix X is premultiplied by 00091 *> diag(C) (if TRANS = 'N') or diag(R) (if TRANS = 'T' or 'C') so 00092 *> that it solves the original system before equilibration. 00093 *> \endverbatim 00094 * 00095 * Arguments: 00096 * ========== 00097 * 00098 *> \param[in] FACT 00099 *> \verbatim 00100 *> FACT is CHARACTER*1 00101 *> Specifies whether or not the factored form of the matrix A is 00102 *> supplied on entry, and if not, whether the matrix A should be 00103 *> equilibrated before it is factored. 00104 *> = 'F': On entry, AFB and IPIV contain the factored form of 00105 *> A. If EQUED is not 'N', the matrix A has been 00106 *> equilibrated with scaling factors given by R and C. 00107 *> AB, AFB, and IPIV are not modified. 00108 *> = 'N': The matrix A will be copied to AFB and factored. 00109 *> = 'E': The matrix A will be equilibrated if necessary, then 00110 *> copied to AFB and factored. 00111 *> \endverbatim 00112 *> 00113 *> \param[in] TRANS 00114 *> \verbatim 00115 *> TRANS is CHARACTER*1 00116 *> Specifies the form of the system of equations. 00117 *> = 'N': A * X = B (No transpose) 00118 *> = 'T': A**T * X = B (Transpose) 00119 *> = 'C': A**H * X = B (Transpose) 00120 *> \endverbatim 00121 *> 00122 *> \param[in] N 00123 *> \verbatim 00124 *> N is INTEGER 00125 *> The number of linear equations, i.e., the order of the 00126 *> matrix A. N >= 0. 00127 *> \endverbatim 00128 *> 00129 *> \param[in] KL 00130 *> \verbatim 00131 *> KL is INTEGER 00132 *> The number of subdiagonals within the band of A. KL >= 0. 00133 *> \endverbatim 00134 *> 00135 *> \param[in] KU 00136 *> \verbatim 00137 *> KU is INTEGER 00138 *> The number of superdiagonals within the band of A. KU >= 0. 00139 *> \endverbatim 00140 *> 00141 *> \param[in] NRHS 00142 *> \verbatim 00143 *> NRHS is INTEGER 00144 *> The number of right hand sides, i.e., the number of columns 00145 *> of the matrices B and X. NRHS >= 0. 00146 *> \endverbatim 00147 *> 00148 *> \param[in,out] AB 00149 *> \verbatim 00150 *> AB is REAL array, dimension (LDAB,N) 00151 *> On entry, the matrix A in band storage, in rows 1 to KL+KU+1. 00152 *> The j-th column of A is stored in the j-th column of the 00153 *> array AB as follows: 00154 *> AB(KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+kl) 00155 *> 00156 *> If FACT = 'F' and EQUED is not 'N', then A must have been 00157 *> equilibrated by the scaling factors in R and/or C. AB is not 00158 *> modified if FACT = 'F' or 'N', or if FACT = 'E' and 00159 *> EQUED = 'N' on exit. 00160 *> 00161 *> On exit, if EQUED .ne. 'N', A is scaled as follows: 00162 *> EQUED = 'R': A := diag(R) * A 00163 *> EQUED = 'C': A := A * diag(C) 00164 *> EQUED = 'B': A := diag(R) * A * diag(C). 00165 *> \endverbatim 00166 *> 00167 *> \param[in] LDAB 00168 *> \verbatim 00169 *> LDAB is INTEGER 00170 *> The leading dimension of the array AB. LDAB >= KL+KU+1. 00171 *> \endverbatim 00172 *> 00173 *> \param[in,out] AFB 00174 *> \verbatim 00175 *> AFB is REAL array, dimension (LDAFB,N) 00176 *> If FACT = 'F', then AFB is an input argument and on entry 00177 *> contains details of the LU factorization of the band matrix 00178 *> A, as computed by SGBTRF. U is stored as an upper triangular 00179 *> band matrix with KL+KU superdiagonals in rows 1 to KL+KU+1, 00180 *> and the multipliers used during the factorization are stored 00181 *> in rows KL+KU+2 to 2*KL+KU+1. If EQUED .ne. 'N', then AFB is 00182 *> the factored form of the equilibrated matrix A. 00183 *> 00184 *> If FACT = 'N', then AFB is an output argument and on exit 00185 *> returns details of the LU factorization of A. 00186 *> 00187 *> If FACT = 'E', then AFB is an output argument and on exit 00188 *> returns details of the LU factorization of the equilibrated 00189 *> matrix A (see the description of AB for the form of the 00190 *> equilibrated matrix). 00191 *> \endverbatim 00192 *> 00193 *> \param[in] LDAFB 00194 *> \verbatim 00195 *> LDAFB is INTEGER 00196 *> The leading dimension of the array AFB. LDAFB >= 2*KL+KU+1. 00197 *> \endverbatim 00198 *> 00199 *> \param[in,out] IPIV 00200 *> \verbatim 00201 *> IPIV is INTEGER array, dimension (N) 00202 *> If FACT = 'F', then IPIV is an input argument and on entry 00203 *> contains the pivot indices from the factorization A = L*U 00204 *> as computed by SGBTRF; row i of the matrix was interchanged 00205 *> with row IPIV(i). 00206 *> 00207 *> If FACT = 'N', then IPIV is an output argument and on exit 00208 *> contains the pivot indices from the factorization A = L*U 00209 *> of the original matrix A. 00210 *> 00211 *> If FACT = 'E', then IPIV is an output argument and on exit 00212 *> contains the pivot indices from the factorization A = L*U 00213 *> of the equilibrated matrix A. 00214 *> \endverbatim 00215 *> 00216 *> \param[in,out] EQUED 00217 *> \verbatim 00218 *> EQUED is CHARACTER*1 00219 *> Specifies the form of equilibration that was done. 00220 *> = 'N': No equilibration (always true if FACT = 'N'). 00221 *> = 'R': Row equilibration, i.e., A has been premultiplied by 00222 *> diag(R). 00223 *> = 'C': Column equilibration, i.e., A has been postmultiplied 00224 *> by diag(C). 00225 *> = 'B': Both row and column equilibration, i.e., A has been 00226 *> replaced by diag(R) * A * diag(C). 00227 *> EQUED is an input argument if FACT = 'F'; otherwise, it is an 00228 *> output argument. 00229 *> \endverbatim 00230 *> 00231 *> \param[in,out] R 00232 *> \verbatim 00233 *> R is REAL array, dimension (N) 00234 *> The row scale factors for A. If EQUED = 'R' or 'B', A is 00235 *> multiplied on the left by diag(R); if EQUED = 'N' or 'C', R 00236 *> is not accessed. R is an input argument if FACT = 'F'; 00237 *> otherwise, R is an output argument. If FACT = 'F' and 00238 *> EQUED = 'R' or 'B', each element of R must be positive. 00239 *> \endverbatim 00240 *> 00241 *> \param[in,out] C 00242 *> \verbatim 00243 *> C is REAL array, dimension (N) 00244 *> The column scale factors for A. If EQUED = 'C' or 'B', A is 00245 *> multiplied on the right by diag(C); if EQUED = 'N' or 'R', C 00246 *> is not accessed. C is an input argument if FACT = 'F'; 00247 *> otherwise, C is an output argument. If FACT = 'F' and 00248 *> EQUED = 'C' or 'B', each element of C must be positive. 00249 *> \endverbatim 00250 *> 00251 *> \param[in,out] B 00252 *> \verbatim 00253 *> B is REAL array, dimension (LDB,NRHS) 00254 *> On entry, the right hand side matrix B. 00255 *> On exit, 00256 *> if EQUED = 'N', B is not modified; 00257 *> if TRANS = 'N' and EQUED = 'R' or 'B', B is overwritten by 00258 *> diag(R)*B; 00259 *> if TRANS = 'T' or 'C' and EQUED = 'C' or 'B', B is 00260 *> overwritten by diag(C)*B. 00261 *> \endverbatim 00262 *> 00263 *> \param[in] LDB 00264 *> \verbatim 00265 *> LDB is INTEGER 00266 *> The leading dimension of the array B. LDB >= max(1,N). 00267 *> \endverbatim 00268 *> 00269 *> \param[out] X 00270 *> \verbatim 00271 *> X is REAL array, dimension (LDX,NRHS) 00272 *> If INFO = 0 or INFO = N+1, the N-by-NRHS solution matrix X 00273 *> to the original system of equations. Note that A and B are 00274 *> modified on exit if EQUED .ne. 'N', and the solution to the 00275 *> equilibrated system is inv(diag(C))*X if TRANS = 'N' and 00276 *> EQUED = 'C' or 'B', or inv(diag(R))*X if TRANS = 'T' or 'C' 00277 *> and EQUED = 'R' or 'B'. 00278 *> \endverbatim 00279 *> 00280 *> \param[in] LDX 00281 *> \verbatim 00282 *> LDX is INTEGER 00283 *> The leading dimension of the array X. LDX >= max(1,N). 00284 *> \endverbatim 00285 *> 00286 *> \param[out] RCOND 00287 *> \verbatim 00288 *> RCOND is REAL 00289 *> The estimate of the reciprocal condition number of the matrix 00290 *> A after equilibration (if done). If RCOND is less than the 00291 *> machine precision (in particular, if RCOND = 0), the matrix 00292 *> is singular to working precision. This condition is 00293 *> indicated by a return code of INFO > 0. 00294 *> \endverbatim 00295 *> 00296 *> \param[out] FERR 00297 *> \verbatim 00298 *> FERR is REAL array, dimension (NRHS) 00299 *> The estimated forward error bound for each solution vector 00300 *> X(j) (the j-th column of the solution matrix X). 00301 *> If XTRUE is the true solution corresponding to X(j), FERR(j) 00302 *> is an estimated upper bound for the magnitude of the largest 00303 *> element in (X(j) - XTRUE) divided by the magnitude of the 00304 *> largest element in X(j). The estimate is as reliable as 00305 *> the estimate for RCOND, and is almost always a slight 00306 *> overestimate of the true error. 00307 *> \endverbatim 00308 *> 00309 *> \param[out] BERR 00310 *> \verbatim 00311 *> BERR is REAL array, dimension (NRHS) 00312 *> The componentwise relative backward error of each solution 00313 *> vector X(j) (i.e., the smallest relative change in 00314 *> any element of A or B that makes X(j) an exact solution). 00315 *> \endverbatim 00316 *> 00317 *> \param[out] WORK 00318 *> \verbatim 00319 *> WORK is REAL array, dimension (3*N) 00320 *> On exit, WORK(1) contains the reciprocal pivot growth 00321 *> factor norm(A)/norm(U). The "max absolute element" norm is 00322 *> used. If WORK(1) is much less than 1, then the stability 00323 *> of the LU factorization of the (equilibrated) matrix A 00324 *> could be poor. This also means that the solution X, condition 00325 *> estimator RCOND, and forward error bound FERR could be 00326 *> unreliable. If factorization fails with 0<INFO<=N, then 00327 *> WORK(1) contains the reciprocal pivot growth factor for the 00328 *> leading INFO columns of A. 00329 *> \endverbatim 00330 *> 00331 *> \param[out] IWORK 00332 *> \verbatim 00333 *> IWORK is INTEGER array, dimension (N) 00334 *> \endverbatim 00335 *> 00336 *> \param[out] INFO 00337 *> \verbatim 00338 *> INFO is INTEGER 00339 *> = 0: successful exit 00340 *> < 0: if INFO = -i, the i-th argument had an illegal value 00341 *> > 0: if INFO = i, and i is 00342 *> <= N: U(i,i) is exactly zero. The factorization 00343 *> has been completed, but the factor U is exactly 00344 *> singular, so the solution and error bounds 00345 *> could not be computed. RCOND = 0 is returned. 00346 *> = N+1: U is nonsingular, but RCOND is less than machine 00347 *> precision, meaning that the matrix is singular 00348 *> to working precision. Nevertheless, the 00349 *> solution and error bounds are computed because 00350 *> there are a number of situations where the 00351 *> computed solution can be more accurate than the 00352 *> \endverbatim 00353 * 00354 * Authors: 00355 * ======== 00356 * 00357 *> \author Univ. of Tennessee 00358 *> \author Univ. of California Berkeley 00359 *> \author Univ. of Colorado Denver 00360 *> \author NAG Ltd. 00361 * 00362 *> \date April 2012 00363 * 00364 *> \ingroup realGBsolve 00365 * 00366 * ===================================================================== 00367 SUBROUTINE SGBSVX( FACT, TRANS, N, KL, KU, NRHS, AB, LDAB, AFB, 00368 $ LDAFB, IPIV, EQUED, R, C, B, LDB, X, LDX, 00369 $ RCOND, FERR, BERR, WORK, IWORK, INFO ) 00370 * 00371 * -- LAPACK driver routine (version 3.4.1) -- 00372 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00373 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00374 * April 2012 00375 * 00376 * .. Scalar Arguments .. 00377 CHARACTER EQUED, FACT, TRANS 00378 INTEGER INFO, KL, KU, LDAB, LDAFB, LDB, LDX, N, NRHS 00379 REAL RCOND 00380 * .. 00381 * .. Array Arguments .. 00382 INTEGER IPIV( * ), IWORK( * ) 00383 REAL AB( LDAB, * ), AFB( LDAFB, * ), B( LDB, * ), 00384 $ BERR( * ), C( * ), FERR( * ), R( * ), 00385 $ WORK( * ), X( LDX, * ) 00386 * .. 00387 * 00388 * ===================================================================== 00389 * Moved setting of INFO = N+1 so INFO does not subsequently get 00390 * overwritten. Sven, 17 Mar 05. 00391 * ===================================================================== 00392 * 00393 * .. Parameters .. 00394 REAL ZERO, ONE 00395 PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 ) 00396 * .. 00397 * .. Local Scalars .. 00398 LOGICAL COLEQU, EQUIL, NOFACT, NOTRAN, ROWEQU 00399 CHARACTER NORM 00400 INTEGER I, INFEQU, J, J1, J2 00401 REAL AMAX, ANORM, BIGNUM, COLCND, RCMAX, RCMIN, 00402 $ ROWCND, RPVGRW, SMLNUM 00403 * .. 00404 * .. External Functions .. 00405 LOGICAL LSAME 00406 REAL SLAMCH, SLANGB, SLANTB 00407 EXTERNAL LSAME, SLAMCH, SLANGB, SLANTB 00408 * .. 00409 * .. External Subroutines .. 00410 EXTERNAL SCOPY, SGBCON, SGBEQU, SGBRFS, SGBTRF, SGBTRS, 00411 $ SLACPY, SLAQGB, XERBLA 00412 * .. 00413 * .. Intrinsic Functions .. 00414 INTRINSIC ABS, MAX, MIN 00415 * .. 00416 * .. Executable Statements .. 00417 * 00418 INFO = 0 00419 NOFACT = LSAME( FACT, 'N' ) 00420 EQUIL = LSAME( FACT, 'E' ) 00421 NOTRAN = LSAME( TRANS, 'N' ) 00422 IF( NOFACT .OR. EQUIL ) THEN 00423 EQUED = 'N' 00424 ROWEQU = .FALSE. 00425 COLEQU = .FALSE. 00426 ELSE 00427 ROWEQU = LSAME( EQUED, 'R' ) .OR. LSAME( EQUED, 'B' ) 00428 COLEQU = LSAME( EQUED, 'C' ) .OR. LSAME( EQUED, 'B' ) 00429 SMLNUM = SLAMCH( 'Safe minimum' ) 00430 BIGNUM = ONE / SMLNUM 00431 END IF 00432 * 00433 * Test the input parameters. 00434 * 00435 IF( .NOT.NOFACT .AND. .NOT.EQUIL .AND. .NOT.LSAME( FACT, 'F' ) ) 00436 $ THEN 00437 INFO = -1 00438 ELSE IF( .NOT.NOTRAN .AND. .NOT.LSAME( TRANS, 'T' ) .AND. .NOT. 00439 $ LSAME( TRANS, 'C' ) ) THEN 00440 INFO = -2 00441 ELSE IF( N.LT.0 ) THEN 00442 INFO = -3 00443 ELSE IF( KL.LT.0 ) THEN 00444 INFO = -4 00445 ELSE IF( KU.LT.0 ) THEN 00446 INFO = -5 00447 ELSE IF( NRHS.LT.0 ) THEN 00448 INFO = -6 00449 ELSE IF( LDAB.LT.KL+KU+1 ) THEN 00450 INFO = -8 00451 ELSE IF( LDAFB.LT.2*KL+KU+1 ) THEN 00452 INFO = -10 00453 ELSE IF( LSAME( FACT, 'F' ) .AND. .NOT. 00454 $ ( ROWEQU .OR. COLEQU .OR. LSAME( EQUED, 'N' ) ) ) THEN 00455 INFO = -12 00456 ELSE 00457 IF( ROWEQU ) THEN 00458 RCMIN = BIGNUM 00459 RCMAX = ZERO 00460 DO 10 J = 1, N 00461 RCMIN = MIN( RCMIN, R( J ) ) 00462 RCMAX = MAX( RCMAX, R( J ) ) 00463 10 CONTINUE 00464 IF( RCMIN.LE.ZERO ) THEN 00465 INFO = -13 00466 ELSE IF( N.GT.0 ) THEN 00467 ROWCND = MAX( RCMIN, SMLNUM ) / MIN( RCMAX, BIGNUM ) 00468 ELSE 00469 ROWCND = ONE 00470 END IF 00471 END IF 00472 IF( COLEQU .AND. INFO.EQ.0 ) THEN 00473 RCMIN = BIGNUM 00474 RCMAX = ZERO 00475 DO 20 J = 1, N 00476 RCMIN = MIN( RCMIN, C( J ) ) 00477 RCMAX = MAX( RCMAX, C( J ) ) 00478 20 CONTINUE 00479 IF( RCMIN.LE.ZERO ) THEN 00480 INFO = -14 00481 ELSE IF( N.GT.0 ) THEN 00482 COLCND = MAX( RCMIN, SMLNUM ) / MIN( RCMAX, BIGNUM ) 00483 ELSE 00484 COLCND = ONE 00485 END IF 00486 END IF 00487 IF( INFO.EQ.0 ) THEN 00488 IF( LDB.LT.MAX( 1, N ) ) THEN 00489 INFO = -16 00490 ELSE IF( LDX.LT.MAX( 1, N ) ) THEN 00491 INFO = -18 00492 END IF 00493 END IF 00494 END IF 00495 * 00496 IF( INFO.NE.0 ) THEN 00497 CALL XERBLA( 'SGBSVX', -INFO ) 00498 RETURN 00499 END IF 00500 * 00501 IF( EQUIL ) THEN 00502 * 00503 * Compute row and column scalings to equilibrate the matrix A. 00504 * 00505 CALL SGBEQU( N, N, KL, KU, AB, LDAB, R, C, ROWCND, COLCND, 00506 $ AMAX, INFEQU ) 00507 IF( INFEQU.EQ.0 ) THEN 00508 * 00509 * Equilibrate the matrix. 00510 * 00511 CALL SLAQGB( N, N, KL, KU, AB, LDAB, R, C, ROWCND, COLCND, 00512 $ AMAX, EQUED ) 00513 ROWEQU = LSAME( EQUED, 'R' ) .OR. LSAME( EQUED, 'B' ) 00514 COLEQU = LSAME( EQUED, 'C' ) .OR. LSAME( EQUED, 'B' ) 00515 END IF 00516 END IF 00517 * 00518 * Scale the right hand side. 00519 * 00520 IF( NOTRAN ) THEN 00521 IF( ROWEQU ) THEN 00522 DO 40 J = 1, NRHS 00523 DO 30 I = 1, N 00524 B( I, J ) = R( I )*B( I, J ) 00525 30 CONTINUE 00526 40 CONTINUE 00527 END IF 00528 ELSE IF( COLEQU ) THEN 00529 DO 60 J = 1, NRHS 00530 DO 50 I = 1, N 00531 B( I, J ) = C( I )*B( I, J ) 00532 50 CONTINUE 00533 60 CONTINUE 00534 END IF 00535 * 00536 IF( NOFACT .OR. EQUIL ) THEN 00537 * 00538 * Compute the LU factorization of the band matrix A. 00539 * 00540 DO 70 J = 1, N 00541 J1 = MAX( J-KU, 1 ) 00542 J2 = MIN( J+KL, N ) 00543 CALL SCOPY( J2-J1+1, AB( KU+1-J+J1, J ), 1, 00544 $ AFB( KL+KU+1-J+J1, J ), 1 ) 00545 70 CONTINUE 00546 * 00547 CALL SGBTRF( N, N, KL, KU, AFB, LDAFB, IPIV, INFO ) 00548 * 00549 * Return if INFO is non-zero. 00550 * 00551 IF( INFO.GT.0 ) THEN 00552 * 00553 * Compute the reciprocal pivot growth factor of the 00554 * leading rank-deficient INFO columns of A. 00555 * 00556 ANORM = ZERO 00557 DO 90 J = 1, INFO 00558 DO 80 I = MAX( KU+2-J, 1 ), MIN( N+KU+1-J, KL+KU+1 ) 00559 ANORM = MAX( ANORM, ABS( AB( I, J ) ) ) 00560 80 CONTINUE 00561 90 CONTINUE 00562 RPVGRW = SLANTB( 'M', 'U', 'N', INFO, MIN( INFO-1, KL+KU ), 00563 $ AFB( MAX( 1, KL+KU+2-INFO ), 1 ), LDAFB, 00564 $ WORK ) 00565 IF( RPVGRW.EQ.ZERO ) THEN 00566 RPVGRW = ONE 00567 ELSE 00568 RPVGRW = ANORM / RPVGRW 00569 END IF 00570 WORK( 1 ) = RPVGRW 00571 RCOND = ZERO 00572 RETURN 00573 END IF 00574 END IF 00575 * 00576 * Compute the norm of the matrix A and the 00577 * reciprocal pivot growth factor RPVGRW. 00578 * 00579 IF( NOTRAN ) THEN 00580 NORM = '1' 00581 ELSE 00582 NORM = 'I' 00583 END IF 00584 ANORM = SLANGB( NORM, N, KL, KU, AB, LDAB, WORK ) 00585 RPVGRW = SLANTB( 'M', 'U', 'N', N, KL+KU, AFB, LDAFB, WORK ) 00586 IF( RPVGRW.EQ.ZERO ) THEN 00587 RPVGRW = ONE 00588 ELSE 00589 RPVGRW = SLANGB( 'M', N, KL, KU, AB, LDAB, WORK ) / RPVGRW 00590 END IF 00591 * 00592 * Compute the reciprocal of the condition number of A. 00593 * 00594 CALL SGBCON( NORM, N, KL, KU, AFB, LDAFB, IPIV, ANORM, RCOND, 00595 $ WORK, IWORK, INFO ) 00596 * 00597 * Compute the solution matrix X. 00598 * 00599 CALL SLACPY( 'Full', N, NRHS, B, LDB, X, LDX ) 00600 CALL SGBTRS( TRANS, N, KL, KU, NRHS, AFB, LDAFB, IPIV, X, LDX, 00601 $ INFO ) 00602 * 00603 * Use iterative refinement to improve the computed solution and 00604 * compute error bounds and backward error estimates for it. 00605 * 00606 CALL SGBRFS( TRANS, N, KL, KU, NRHS, AB, LDAB, AFB, LDAFB, IPIV, 00607 $ B, LDB, X, LDX, FERR, BERR, WORK, IWORK, INFO ) 00608 * 00609 * Transform the solution matrix X to a solution of the original 00610 * system. 00611 * 00612 IF( NOTRAN ) THEN 00613 IF( COLEQU ) THEN 00614 DO 110 J = 1, NRHS 00615 DO 100 I = 1, N 00616 X( I, J ) = C( I )*X( I, J ) 00617 100 CONTINUE 00618 110 CONTINUE 00619 DO 120 J = 1, NRHS 00620 FERR( J ) = FERR( J ) / COLCND 00621 120 CONTINUE 00622 END IF 00623 ELSE IF( ROWEQU ) THEN 00624 DO 140 J = 1, NRHS 00625 DO 130 I = 1, N 00626 X( I, J ) = R( I )*X( I, J ) 00627 130 CONTINUE 00628 140 CONTINUE 00629 DO 150 J = 1, NRHS 00630 FERR( J ) = FERR( J ) / ROWCND 00631 150 CONTINUE 00632 END IF 00633 * 00634 * Set INFO = N+1 if the matrix is singular to working precision. 00635 * 00636 IF( RCOND.LT.SLAMCH( 'Epsilon' ) ) 00637 $ INFO = N + 1 00638 * 00639 WORK( 1 ) = RPVGRW 00640 RETURN 00641 * 00642 * End of SGBSVX 00643 * 00644 END