001:SUBROUTINECGBSVXX( FACT, TRANS, N, KL, KU, NRHS, AB, LDAB, AFB, 002: $ LDAFB, IPIV, EQUED, R, C, B, LDB, X, LDX, 003: $ RCOND, RPVGRW, BERR, N_ERR_BNDS, 004: $ ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS, 005: $ WORK, RWORK, INFO ) 006:*007:* -- LAPACK driver routine (version 3.2) --008:* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --009:* -- Jason Riedy of Univ. of California Berkeley. --010:* -- November 2008 --011:*012:* -- LAPACK is a software package provided by Univ. of Tennessee, --013:* -- Univ. of California Berkeley and NAG Ltd. --014:*015:IMPLICITNONE 016:* ..017:* .. Scalar Arguments ..018: CHARACTER EQUED, FACT, TRANS 019: INTEGER INFO, LDAB, LDAFB, LDB, LDX, N, NRHS, NPARAMS, 020: $ N_ERR_BNDS 021: REAL RCOND, RPVGRW 022:* ..023:* .. Array Arguments ..024: INTEGERIPIV( * ) 025: COMPLEXAB( LDAB, * ),AFB( LDAFB, * ),B( LDB, * ), 026: $X( LDX , * ),WORK( * ) 027: REALR( * ),C( * ),PARAMS( * ),BERR( * ), 028: $ERR_BNDS_NORM( NRHS, * ), 029: $ERR_BNDS_COMP( NRHS, * ),RWORK( * ) 030:* ..031:*032:* Purpose033:* =======034:*035:* CGBSVXX uses the LU factorization to compute the solution to a036:* complex system of linear equations A * X = B, where A is an037:* N-by-N matrix and X and B are N-by-NRHS matrices.038:*039:* If requested, both normwise and maximum componentwise error bounds040:* are returned. CGBSVXX will return a solution with a tiny041:* guaranteed error (O(eps) where eps is the working machine042:* precision) unless the matrix is very ill-conditioned, in which043:* case a warning is returned. Relevant condition numbers also are044:* calculated and returned.045:*046:* CGBSVXX accepts user-provided factorizations and equilibration047:* factors; see the definitions of the FACT and EQUED options.048:* Solving with refinement and using a factorization from a previous049:* CGBSVXX call will also produce a solution with either O(eps)050:* errors or warnings, but we cannot make that claim for general051:* user-provided factorizations and equilibration factors if they052:* differ from what CGBSVXX would itself produce.053:*054:* Description055:* ===========056:*057:* The following steps are performed:058:*059:* 1. If FACT = 'E', real scaling factors are computed to equilibrate060:* the system:061:*062:* TRANS = 'N': diag(R)*A*diag(C) *inv(diag(C))*X = diag(R)*B063:* TRANS = 'T': (diag(R)*A*diag(C))**T *inv(diag(R))*X = diag(C)*B064:* TRANS = 'C': (diag(R)*A*diag(C))**H *inv(diag(R))*X = diag(C)*B065:*066:* Whether or not the system will be equilibrated depends on the067:* scaling of the matrix A, but if equilibration is used, A is068:* overwritten by diag(R)*A*diag(C) and B by diag(R)*B (if TRANS='N')069:* or diag(C)*B (if TRANS = 'T' or 'C').070:*071:* 2. If FACT = 'N' or 'E', the LU decomposition is used to factor072:* the matrix A (after equilibration if FACT = 'E') as073:*074:* A = P * L * U,075:*076:* where P is a permutation matrix, L is a unit lower triangular077:* matrix, and U is upper triangular.078:*079:* 3. If some U(i,i)=0, so that U is exactly singular, then the080:* routine returns with INFO = i. Otherwise, the factored form of A081:* is used to estimate the condition number of the matrix A (see082:* argument RCOND). If the reciprocal of the condition number is less083:* than machine precision, the routine still goes on to solve for X084:* and compute error bounds as described below.085:*086:* 4. The system of equations is solved for X using the factored form087:* of A.088:*089:* 5. By default (unless PARAMS(LA_LINRX_ITREF_I) is set to zero),090:* the routine will use iterative refinement to try to get a small091:* error and error bounds. Refinement calculates the residual to at092:* least twice the working precision.093:*094:* 6. If equilibration was used, the matrix X is premultiplied by095:* diag(C) (if TRANS = 'N') or diag(R) (if TRANS = 'T' or 'C') so096:* that it solves the original system before equilibration.097:*098:* Arguments099:* =========100:*101:* Some optional parameters are bundled in the PARAMS array. These102:* settings determine how refinement is performed, but often the103:* defaults are acceptable. If the defaults are acceptable, users104:* can pass NPARAMS = 0 which prevents the source code from accessing105:* the PARAMS argument.106:*107:* FACT (input) CHARACTER*1108:* Specifies whether or not the factored form of the matrix A is109:* supplied on entry, and if not, whether the matrix A should be110:* equilibrated before it is factored.111:* = 'F': On entry, AF and IPIV contain the factored form of A.112:* If EQUED is not 'N', the matrix A has been113:* equilibrated with scaling factors given by R and C.114:* A, AF, and IPIV are not modified.115:* = 'N': The matrix A will be copied to AF and factored.116:* = 'E': The matrix A will be equilibrated if necessary, then117:* copied to AF and factored.118:*119:* TRANS (input) CHARACTER*1120:* Specifies the form of the system of equations:121:* = 'N': A * X = B (No transpose)122:* = 'T': A**T * X = B (Transpose)123:* = 'C': A**H * X = B (Conjugate Transpose = Transpose)124:*125:* N (input) INTEGER126:* The number of linear equations, i.e., the order of the127:* matrix A. N >= 0.128:*129:* KL (input) INTEGER130:* The number of subdiagonals within the band of A. KL >= 0.131:*132:* KU (input) INTEGER133:* The number of superdiagonals within the band of A. KU >= 0.134:*135:* NRHS (input) INTEGER136:* The number of right hand sides, i.e., the number of columns137:* of the matrices B and X. NRHS >= 0.138:*139:* AB (input/output) REAL array, dimension (LDAB,N)140:* On entry, the matrix A in band storage, in rows 1 to KL+KU+1.141:* The j-th column of A is stored in the j-th column of the142:* array AB as follows:143:* AB(KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+kl)144:*145:* If FACT = 'F' and EQUED is not 'N', then AB must have been146:* equilibrated by the scaling factors in R and/or C. AB is not147:* modified if FACT = 'F' or 'N', or if FACT = 'E' and148:* EQUED = 'N' on exit.149:*150:* On exit, if EQUED .ne. 'N', A is scaled as follows:151:* EQUED = 'R': A := diag(R) * A152:* EQUED = 'C': A := A * diag(C)153:* EQUED = 'B': A := diag(R) * A * diag(C).154:*155:* LDAB (input) INTEGER156:* The leading dimension of the array AB. LDAB >= KL+KU+1.157:*158:* AFB (input or output) REAL array, dimension (LDAFB,N)159:* If FACT = 'F', then AFB is an input argument and on entry160:* contains details of the LU factorization of the band matrix161:* A, as computed by CGBTRF. U is stored as an upper triangular162:* band matrix with KL+KU superdiagonals in rows 1 to KL+KU+1,163:* and the multipliers used during the factorization are stored164:* in rows KL+KU+2 to 2*KL+KU+1. If EQUED .ne. 'N', then AFB is165:* the factored form of the equilibrated matrix A.166:*167:* If FACT = 'N', then AF is an output argument and on exit168:* returns the factors L and U from the factorization A = P*L*U169:* of the original matrix A.170:*171:* If FACT = 'E', then AF is an output argument and on exit172:* returns the factors L and U from the factorization A = P*L*U173:* of the equilibrated matrix A (see the description of A for174:* the form of the equilibrated matrix).175:*176:* LDAFB (input) INTEGER177:* The leading dimension of the array AFB. LDAFB >= 2*KL+KU+1.178:*179:* IPIV (input or output) INTEGER array, dimension (N)180:* If FACT = 'F', then IPIV is an input argument and on entry181:* contains the pivot indices from the factorization A = P*L*U182:* as computed by SGETRF; row i of the matrix was interchanged183:* with row IPIV(i).184:*185:* If FACT = 'N', then IPIV is an output argument and on exit186:* contains the pivot indices from the factorization A = P*L*U187:* of the original matrix A.188:*189:* If FACT = 'E', then IPIV is an output argument and on exit190:* contains the pivot indices from the factorization A = P*L*U191:* of the equilibrated matrix A.192:*193:* EQUED (input or output) CHARACTER*1194:* Specifies the form of equilibration that was done.195:* = 'N': No equilibration (always true if FACT = 'N').196:* = 'R': Row equilibration, i.e., A has been premultiplied by197:* diag(R).198:* = 'C': Column equilibration, i.e., A has been postmultiplied199:* by diag(C).200:* = 'B': Both row and column equilibration, i.e., A has been201:* replaced by diag(R) * A * diag(C).202:* EQUED is an input argument if FACT = 'F'; otherwise, it is an203:* output argument.204:*205:* R (input or output) REAL array, dimension (N)206:* The row scale factors for A. If EQUED = 'R' or 'B', A is207:* multiplied on the left by diag(R); if EQUED = 'N' or 'C', R208:* is not accessed. R is an input argument if FACT = 'F';209:* otherwise, R is an output argument. If FACT = 'F' and210:* EQUED = 'R' or 'B', each element of R must be positive.211:* If R is output, each element of R is a power of the radix.212:* If R is input, each element of R should be a power of the radix213:* to ensure a reliable solution and error estimates. Scaling by214:* powers of the radix does not cause rounding errors unless the215:* result underflows or overflows. Rounding errors during scaling216:* lead to refining with a matrix that is not equivalent to the217:* input matrix, producing error estimates that may not be218:* reliable.219:*220:* C (input or output) REAL array, dimension (N)221:* The column scale factors for A. If EQUED = 'C' or 'B', A is222:* multiplied on the right by diag(C); if EQUED = 'N' or 'R', C223:* is not accessed. C is an input argument if FACT = 'F';224:* otherwise, C is an output argument. If FACT = 'F' and225:* EQUED = 'C' or 'B', each element of C must be positive.226:* If C is output, each element of C is a power of the radix.227:* If C is input, each element of C should be a power of the radix228:* to ensure a reliable solution and error estimates. Scaling by229:* powers of the radix does not cause rounding errors unless the230:* result underflows or overflows. Rounding errors during scaling231:* lead to refining with a matrix that is not equivalent to the232:* input matrix, producing error estimates that may not be233:* reliable.234:*235:* B (input/output) REAL array, dimension (LDB,NRHS)236:* On entry, the N-by-NRHS right hand side matrix B.237:* On exit,238:* if EQUED = 'N', B is not modified;239:* if TRANS = 'N' and EQUED = 'R' or 'B', B is overwritten by240:* diag(R)*B;241:* if TRANS = 'T' or 'C' and EQUED = 'C' or 'B', B is242:* overwritten by diag(C)*B.243:*244:* LDB (input) INTEGER245:* The leading dimension of the array B. LDB >= max(1,N).246:*247:* X (output) REAL array, dimension (LDX,NRHS)248:* If INFO = 0, the N-by-NRHS solution matrix X to the original249:* system of equations. Note that A and B are modified on exit250:* if EQUED .ne. 'N', and the solution to the equilibrated system is251:* inv(diag(C))*X if TRANS = 'N' and EQUED = 'C' or 'B', or252:* inv(diag(R))*X if TRANS = 'T' or 'C' and EQUED = 'R' or 'B'.253:*254:* LDX (input) INTEGER255:* The leading dimension of the array X. LDX >= max(1,N).256:*257:* RCOND (output) REAL258:* Reciprocal scaled condition number. This is an estimate of the259:* reciprocal Skeel condition number of the matrix A after260:* equilibration (if done). If this is less than the machine261:* precision (in particular, if it is zero), the matrix is singular262:* to working precision. Note that the error may still be small even263:* if this number is very small and the matrix appears ill-264:* conditioned.265:*266:* RPVGRW (output) REAL267:* Reciprocal pivot growth. On exit, this contains the reciprocal268:* pivot growth factor norm(A)/norm(U). The "max absolute element"269:* norm is used. If this is much less than 1, then the stability of270:* the LU factorization of the (equilibrated) matrix A could be poor.271:* This also means that the solution X, estimated condition numbers,272:* and error bounds could be unreliable. If factorization fails with273:* 0<INFO<=N, then this contains the reciprocal pivot growth factor274:* for the leading INFO columns of A. In SGESVX, this quantity is275:* returned in WORK(1).276:*277:* BERR (output) REAL array, dimension (NRHS)278:* Componentwise relative backward error. This is the279:* componentwise relative backward error of each solution vector X(j)280:* (i.e., the smallest relative change in any element of A or B that281:* makes X(j) an exact solution).282:*283:* N_ERR_BNDS (input) INTEGER284:* Number of error bounds to return for each right hand side285:* and each type (normwise or componentwise). See ERR_BNDS_NORM and286:* ERR_BNDS_COMP below.287:*288:* ERR_BNDS_NORM (output) REAL array, dimension (NRHS, N_ERR_BNDS)289:* For each right-hand side, this array contains information about290:* various error bounds and condition numbers corresponding to the291:* normwise relative error, which is defined as follows:292:*293:* Normwise relative error in the ith solution vector:294:* max_j (abs(XTRUE(j,i) - X(j,i)))295:* ------------------------------296:* max_j abs(X(j,i))297:*298:* The array is indexed by the type of error information as described299:* below. There currently are up to three pieces of information300:* returned.301:*302:* The first index in ERR_BNDS_NORM(i,:) corresponds to the ith303:* right-hand side.304:*305:* The second index in ERR_BNDS_NORM(:,err) contains the following306:* three fields:307:* err = 1 "Trust/don't trust" boolean. Trust the answer if the308:* reciprocal condition number is less than the threshold309:* sqrt(n) * slamch('Epsilon').310:*311:* err = 2 "Guaranteed" error bound: The estimated forward error,312:* almost certainly within a factor of 10 of the true error313:* so long as the next entry is greater than the threshold314:* sqrt(n) * slamch('Epsilon'). This error bound should only315:* be trusted if the previous boolean is true.316:*317:* err = 3 Reciprocal condition number: Estimated normwise318:* reciprocal condition number. Compared with the threshold319:* sqrt(n) * slamch('Epsilon') to determine if the error320:* estimate is "guaranteed". These reciprocal condition321:* numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some322:* appropriately scaled matrix Z.323:* Let Z = S*A, where S scales each row by a power of the324:* radix so all absolute row sums of Z are approximately 1.325:*326:* See Lapack Working Note 165 for further details and extra327:* cautions.328:*329:* ERR_BNDS_COMP (output) REAL array, dimension (NRHS, N_ERR_BNDS)330:* For each right-hand side, this array contains information about331:* various error bounds and condition numbers corresponding to the332:* componentwise relative error, which is defined as follows:333:*334:* Componentwise relative error in the ith solution vector:335:* abs(XTRUE(j,i) - X(j,i))336:* max_j ----------------------337:* abs(X(j,i))338:*339:* The array is indexed by the right-hand side i (on which the340:* componentwise relative error depends), and the type of error341:* information as described below. There currently are up to three342:* pieces of information returned for each right-hand side. If343:* componentwise accuracy is not requested (PARAMS(3) = 0.0), then344:* ERR_BNDS_COMP is not accessed. If N_ERR_BNDS .LT. 3, then at most345:* the first (:,N_ERR_BNDS) entries are returned.346:*347:* The first index in ERR_BNDS_COMP(i,:) corresponds to the ith348:* right-hand side.349:*350:* The second index in ERR_BNDS_COMP(:,err) contains the following351:* three fields:352:* err = 1 "Trust/don't trust" boolean. Trust the answer if the353:* reciprocal condition number is less than the threshold354:* sqrt(n) * slamch('Epsilon').355:*356:* err = 2 "Guaranteed" error bound: The estimated forward error,357:* almost certainly within a factor of 10 of the true error358:* so long as the next entry is greater than the threshold359:* sqrt(n) * slamch('Epsilon'). This error bound should only360:* be trusted if the previous boolean is true.361:*362:* err = 3 Reciprocal condition number: Estimated componentwise363:* reciprocal condition number. Compared with the threshold364:* sqrt(n) * slamch('Epsilon') to determine if the error365:* estimate is "guaranteed". These reciprocal condition366:* numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some367:* appropriately scaled matrix Z.368:* Let Z = S*(A*diag(x)), where x is the solution for the369:* current right-hand side and S scales each row of370:* A*diag(x) by a power of the radix so all absolute row371:* sums of Z are approximately 1.372:*373:* See Lapack Working Note 165 for further details and extra374:* cautions.375:*376:* NPARAMS (input) INTEGER377:* Specifies the number of parameters set in PARAMS. If .LE. 0, the378:* PARAMS array is never referenced and default values are used.379:*380:* PARAMS (input / output) REAL array, dimension NPARAMS381:* Specifies algorithm parameters. If an entry is .LT. 0.0, then382:* that entry will be filled with default value used for that383:* parameter. Only positions up to NPARAMS are accessed; defaults384:* are used for higher-numbered parameters.385:*386:* PARAMS(LA_LINRX_ITREF_I = 1) : Whether to perform iterative387:* refinement or not.388:* Default: 1.0389:* = 0.0 : No refinement is performed, and no error bounds are390:* computed.391:* = 1.0 : Use the double-precision refinement algorithm,392:* possibly with doubled-single computations if the393:* compilation environment does not support DOUBLE394:* PRECISION.395:* (other values are reserved for future use)396:*397:* PARAMS(LA_LINRX_ITHRESH_I = 2) : Maximum number of residual398:* computations allowed for refinement.399:* Default: 10400:* Aggressive: Set to 100 to permit convergence using approximate401:* factorizations or factorizations other than LU. If402:* the factorization uses a technique other than403:* Gaussian elimination, the guarantees in404:* err_bnds_norm and err_bnds_comp may no longer be405:* trustworthy.406:*407:* PARAMS(LA_LINRX_CWISE_I = 3) : Flag determining if the code408:* will attempt to find a solution with small componentwise409:* relative error in the double-precision algorithm. Positive410:* is true, 0.0 is false.411:* Default: 1.0 (attempt componentwise convergence)412:*413:* WORK (workspace) REAL array, dimension (4*N)414:*415:* IWORK (workspace) INTEGER array, dimension (N)416:*417:* INFO (output) INTEGER418:* = 0: Successful exit. The solution to every right-hand side is419:* guaranteed.420:* < 0: If INFO = -i, the i-th argument had an illegal value421:* > 0 and <= N: U(INFO,INFO) is exactly zero. The factorization422:* has been completed, but the factor U is exactly singular, so423:* the solution and error bounds could not be computed. RCOND = 0424:* is returned.425:* = N+J: The solution corresponding to the Jth right-hand side is426:* not guaranteed. The solutions corresponding to other right-427:* hand sides K with K > J may not be guaranteed as well, but428:* only the first such right-hand side is reported. If a small429:* componentwise error is not requested (PARAMS(3) = 0.0) then430:* the Jth right-hand side is the first with a normwise error431:* bound that is not guaranteed (the smallest J such432:* that ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0)433:* the Jth right-hand side is the first with either a normwise or434:* componentwise error bound that is not guaranteed (the smallest435:* J such that either ERR_BNDS_NORM(J,1) = 0.0 or436:* ERR_BNDS_COMP(J,1) = 0.0). See the definition of437:* ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information438:* about all of the right-hand sides check ERR_BNDS_NORM or439:* ERR_BNDS_COMP.440:*441:* ==================================================================442:*443:* .. Parameters ..444: REAL ZERO, ONE 445:PARAMETER( ZERO = 0.0E+0, ONE = 1.0E+0 ) 446: INTEGER FINAL_NRM_ERR_I, FINAL_CMP_ERR_I, BERR_I 447: INTEGER RCOND_I, NRM_RCOND_I, NRM_ERR_I, CMP_RCOND_I 448: INTEGER CMP_ERR_I, PIV_GROWTH_I 449:PARAMETER( FINAL_NRM_ERR_I = 1, FINAL_CMP_ERR_I = 2, 450: $ BERR_I = 3 ) 451:PARAMETER( RCOND_I = 4, NRM_RCOND_I = 5, NRM_ERR_I = 6 ) 452:PARAMETER( CMP_RCOND_I = 7, CMP_ERR_I = 8, 453: $ PIV_GROWTH_I = 9 ) 454:* ..455:* .. Local Scalars ..456:LOGICALCOLEQU, EQUIL, NOFACT, NOTRAN, ROWEQU 457: INTEGER INFEQU, I, J, KL, KU 458: REAL AMAX, BIGNUM, COLCND, RCMAX, RCMIN, 459: $ ROWCND, SMLNUM 460:* ..461:* .. External Functions ..462:EXTERNALLSAME, SLAMCH, CLA_GBRPVGRW 463:LOGICALLSAME 464: REAL SLAMCH, CLA_GBRPVGRW 465:* ..466:* .. External Subroutines ..467:EXTERNALCGBEQUB, CGBTRF, CGBTRS, CLACPY, CLAQGB, 468: $ XERBLA, CLASCL2, CGBRFSX 469:* ..470:* .. Intrinsic Functions ..471:INTRINSICMAX, MIN 472:* ..473:* .. Executable Statements ..474:*475: INFO = 0 476: NOFACT =LSAME( FACT, 'N' ) 477: EQUIL =LSAME( FACT, 'E' ) 478: NOTRAN =LSAME( TRANS, 'N' ) 479: SMLNUM =SLAMCH( 'Safe minimum' ) 480: BIGNUM = ONE / SMLNUM 481:IF( NOFACT .OR. EQUIL )THEN482: EQUED = 'N' 483: ROWEQU = .FALSE. 484: COLEQU = .FALSE. 485:ELSE486: ROWEQU =LSAME( EQUED, 'R' ) .OR.LSAME( EQUED, 'B' ) 487: COLEQU =LSAME( EQUED, 'C' ) .OR.LSAME( EQUED, 'B' ) 488:ENDIF489:*490:* Default is failure. If an input parameter is wrong or491:* factorization fails, make everything look horrible. Only the492:* pivot growth is set here, the rest is initialized in CGBRFSX.493:*494: RPVGRW = ZERO 495:*496:* Test the input parameters. PARAMS is not tested until SGERFSX.497:*498:IF( .NOT.NOFACT .AND. .NOT.EQUIL .AND. .NOT. 499: $LSAME( FACT, 'F' ) )THEN500: INFO = -1 501:ELSEIF( .NOT.NOTRAN .AND. .NOT.LSAME( TRANS, 'T' ) .AND. .NOT. 502: $LSAME( TRANS, 'C' ) )THEN503: INFO = -2 504:ELSEIF( N.LT.0 )THEN505: INFO = -3 506:ELSEIF( KL.LT.0 )THEN507: INFO = -4 508:ELSEIF( KU.LT.0 )THEN509: INFO = -5 510:ELSEIF( NRHS.LT.0 )THEN511: INFO = -6 512:ELSEIF( LDAB.LT.KL+KU+1 )THEN513: INFO = -8 514:ELSEIF( LDAFB.LT.2*KL+KU+1 )THEN515: INFO = -10 516:ELSEIF(LSAME( FACT, 'F' ) .AND. .NOT. 517: $ ( ROWEQU .OR. COLEQU .OR.LSAME( EQUED, 'N' ) ) )THEN518: INFO = -12 519:ELSE520:IF( ROWEQU )THEN521: RCMIN = BIGNUM 522: RCMAX = ZERO 523:DO10 J = 1, N 524: RCMIN =MIN( RCMIN,R( J ) ) 525: RCMAX =MAX( RCMAX,R( J ) ) 526: 10CONTINUE527:IF( RCMIN.LE.ZERO )THEN528: INFO = -13 529:ELSEIF( N.GT.0 )THEN530: ROWCND =MAX( RCMIN, SMLNUM ) /MIN( RCMAX, BIGNUM ) 531:ELSE532: ROWCND = ONE 533:ENDIF534:ENDIF535:IF( COLEQU .AND. INFO.EQ.0 )THEN536: RCMIN = BIGNUM 537: RCMAX = ZERO 538:DO20 J = 1, N 539: RCMIN =MIN( RCMIN,C( J ) ) 540: RCMAX =MAX( RCMAX,C( J ) ) 541: 20CONTINUE542:IF( RCMIN.LE.ZERO )THEN543: INFO = -14 544:ELSEIF( N.GT.0 )THEN545: COLCND =MAX( RCMIN, SMLNUM ) /MIN( RCMAX, BIGNUM ) 546:ELSE547: COLCND = ONE 548:ENDIF549:ENDIF550:IF( INFO.EQ.0 )THEN551:IF( LDB.LT.MAX( 1, N ) )THEN552: INFO = -15 553:ELSEIF( LDX.LT.MAX( 1, N ) )THEN554: INFO = -16 555:ENDIF556:ENDIF557:ENDIF558:*559:IF( INFO.NE.0 )THEN560:CALLXERBLA( 'CGBSVXX', -INFO ) 561:RETURN562:ENDIF563:*564:IF( EQUIL )THEN565:*566:* Compute row and column scalings to equilibrate the matrix A.567:*568:CALLCGBEQUB( N, N, KL, KU, AB, LDAB, R, C, ROWCND, COLCND, 569: $ AMAX, INFEQU ) 570:IF( INFEQU.EQ.0 )THEN571:*572:* Equilibrate the matrix.573:*574:CALLCLAQGB( N, N, KL, KU, AB, LDAB, R, C, ROWCND, COLCND, 575: $ AMAX, EQUED ) 576: ROWEQU =LSAME( EQUED, 'R' ) .OR.LSAME( EQUED, 'B' ) 577: COLEQU =LSAME( EQUED, 'C' ) .OR.LSAME( EQUED, 'B' ) 578:ENDIF579:*580:* If the scaling factors are not applied, set them to 1.0.581:*582:IF( .NOT.ROWEQU )THEN583:DOJ = 1, N 584:R( J ) = 1.0 585:ENDDO586:ENDIF587:IF( .NOT.COLEQU )THEN588:DOJ = 1, N 589:C( J ) = 1.0 590:ENDDO591:ENDIF592:ENDIF593:*594:* Scale the right-hand side.595:*596:IF( NOTRAN )THEN597:IF( ROWEQU )CALLCLASCL2( N, NRHS, R, B, LDB ) 598:ELSE599:IF( COLEQU )CALLCLASCL2( N, NRHS, C, B, LDB ) 600:ENDIF601:*602:IF( NOFACT .OR. EQUIL )THEN603:*604:* Compute the LU factorization of A.605:*606:DO40, J = 1, N 607:DO30, I = KL+1, 2*KL+KU+1 608:AFB( I, J ) =AB( I-KL, J ) 609: 30CONTINUE610: 40CONTINUE611:CALLCGBTRF( N, N, KL, KU, AFB, LDAFB, IPIV, INFO ) 612:*613:* Return if INFO is non-zero.614:*615:IF( INFO.GT.0 )THEN616:*617:* Pivot in column INFO is exactly 0618:* Compute the reciprocal pivot growth factor of the619:* leading rank-deficient INFO columns of A.620:*621: RPVGRW =CLA_GBRPVGRW( N, KL, KU, INFO, AB, LDAB, AFB, 622: $ LDAFB ) 623:RETURN624:ENDIF625:ENDIF626:*627:* Compute the reciprocal pivot growth factor RPVGRW.628:*629: RPVGRW =CLA_GBRPVGRW( N, KL, KU, N, AB, LDAB, AFB, LDAFB ) 630:*631:* Compute the solution matrix X.632:*633:CALLCLACPY( 'Full', N, NRHS, B, LDB, X, LDX ) 634:CALLCGBTRS( TRANS, N, KL, KU, NRHS, AFB, LDAFB, IPIV, X, LDX, 635: $ INFO ) 636:*637:* Use iterative refinement to improve the computed solution and638:* compute error bounds and backward error estimates for it.639:*640:CALLCGBRFSX( TRANS, EQUED, N, KL, KU, NRHS, AB, LDAB, AFB, LDAFB, 641: $ IPIV, R, C, B, LDB, X, LDX, RCOND, BERR, 642: $ N_ERR_BNDS, ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS, 643: $ WORK, RWORK, INFO ) 644: 645:*646:* Scale solutions.647:*648:IF( COLEQU .AND. NOTRAN )THEN649:CALLCLASCL2( N, NRHS, C, X, LDX ) 650:ELSEIF( ROWEQU .AND. .NOT.NOTRAN )THEN651:CALLCLASCL2( N, NRHS, R, X, LDX ) 652:ENDIF653:*654:RETURN655:*656:* End of CGBSVXX657:*658:END659: