LAPACK 3.3.0
|
00001 SUBROUTINE DGESVXX( FACT, TRANS, N, NRHS, A, LDA, AF, LDAF, IPIV, 00002 $ EQUED, R, C, B, LDB, X, LDX, RCOND, RPVGRW, 00003 $ BERR, N_ERR_BNDS, ERR_BNDS_NORM, 00004 $ ERR_BNDS_COMP, NPARAMS, PARAMS, WORK, IWORK, 00005 $ INFO ) 00006 * 00007 * -- LAPACK driver routine (version 3.2.2) -- 00008 * -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and -- 00009 * -- Jason Riedy of Univ. of California Berkeley. -- 00010 * -- June 2010 -- 00011 * 00012 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00013 * -- Univ. of California Berkeley and NAG Ltd. -- 00014 * 00015 IMPLICIT NONE 00016 * .. 00017 * .. Scalar Arguments .. 00018 CHARACTER EQUED, FACT, TRANS 00019 INTEGER INFO, LDA, LDAF, LDB, LDX, N, NRHS, NPARAMS, 00020 $ N_ERR_BNDS 00021 DOUBLE PRECISION RCOND, RPVGRW 00022 * .. 00023 * .. Array Arguments .. 00024 INTEGER IPIV( * ), IWORK( * ) 00025 DOUBLE PRECISION A( LDA, * ), AF( LDAF, * ), B( LDB, * ), 00026 $ X( LDX , * ),WORK( * ) 00027 DOUBLE PRECISION R( * ), C( * ), PARAMS( * ), BERR( * ), 00028 $ ERR_BNDS_NORM( NRHS, * ), 00029 $ ERR_BNDS_COMP( NRHS, * ) 00030 * .. 00031 * 00032 * Purpose 00033 * ======= 00034 * 00035 * DGESVXX uses the LU factorization to compute the solution to a 00036 * double precision system of linear equations A * X = B, where A is an 00037 * N-by-N matrix and X and B are N-by-NRHS matrices. 00038 * 00039 * If requested, both normwise and maximum componentwise error bounds 00040 * are returned. DGESVXX will return a solution with a tiny 00041 * guaranteed error (O(eps) where eps is the working machine 00042 * precision) unless the matrix is very ill-conditioned, in which 00043 * case a warning is returned. Relevant condition numbers also are 00044 * calculated and returned. 00045 * 00046 * DGESVXX accepts user-provided factorizations and equilibration 00047 * factors; see the definitions of the FACT and EQUED options. 00048 * Solving with refinement and using a factorization from a previous 00049 * DGESVXX call will also produce a solution with either O(eps) 00050 * errors or warnings, but we cannot make that claim for general 00051 * user-provided factorizations and equilibration factors if they 00052 * differ from what DGESVXX would itself produce. 00053 * 00054 * Description 00055 * =========== 00056 * 00057 * The following steps are performed: 00058 * 00059 * 1. If FACT = 'E', double precision scaling factors are computed to equilibrate 00060 * the system: 00061 * 00062 * TRANS = 'N': diag(R)*A*diag(C) *inv(diag(C))*X = diag(R)*B 00063 * TRANS = 'T': (diag(R)*A*diag(C))**T *inv(diag(R))*X = diag(C)*B 00064 * TRANS = 'C': (diag(R)*A*diag(C))**H *inv(diag(R))*X = diag(C)*B 00065 * 00066 * Whether or not the system will be equilibrated depends on the 00067 * scaling of the matrix A, but if equilibration is used, A is 00068 * overwritten by diag(R)*A*diag(C) and B by diag(R)*B (if TRANS='N') 00069 * or diag(C)*B (if TRANS = 'T' or 'C'). 00070 * 00071 * 2. If FACT = 'N' or 'E', the LU decomposition is used to factor 00072 * the matrix A (after equilibration if FACT = 'E') as 00073 * 00074 * A = P * L * U, 00075 * 00076 * where P is a permutation matrix, L is a unit lower triangular 00077 * matrix, and U is upper triangular. 00078 * 00079 * 3. If some U(i,i)=0, so that U is exactly singular, then the 00080 * routine returns with INFO = i. Otherwise, the factored form of A 00081 * is used to estimate the condition number of the matrix A (see 00082 * argument RCOND). If the reciprocal of the condition number is less 00083 * than machine precision, the routine still goes on to solve for X 00084 * and compute error bounds as described below. 00085 * 00086 * 4. The system of equations is solved for X using the factored form 00087 * of A. 00088 * 00089 * 5. By default (unless PARAMS(LA_LINRX_ITREF_I) is set to zero), 00090 * the routine will use iterative refinement to try to get a small 00091 * error and error bounds. Refinement calculates the residual to at 00092 * least twice the working precision. 00093 * 00094 * 6. If equilibration was used, the matrix X is premultiplied by 00095 * diag(C) (if TRANS = 'N') or diag(R) (if TRANS = 'T' or 'C') so 00096 * that it solves the original system before equilibration. 00097 * 00098 * Arguments 00099 * ========= 00100 * 00101 * Some optional parameters are bundled in the PARAMS array. These 00102 * settings determine how refinement is performed, but often the 00103 * defaults are acceptable. If the defaults are acceptable, users 00104 * can pass NPARAMS = 0 which prevents the source code from accessing 00105 * the PARAMS argument. 00106 * 00107 * FACT (input) CHARACTER*1 00108 * Specifies whether or not the factored form of the matrix A is 00109 * supplied on entry, and if not, whether the matrix A should be 00110 * equilibrated before it is factored. 00111 * = 'F': On entry, AF and IPIV contain the factored form of A. 00112 * If EQUED is not 'N', the matrix A has been 00113 * equilibrated with scaling factors given by R and C. 00114 * A, AF, and IPIV are not modified. 00115 * = 'N': The matrix A will be copied to AF and factored. 00116 * = 'E': The matrix A will be equilibrated if necessary, then 00117 * copied to AF and factored. 00118 * 00119 * TRANS (input) CHARACTER*1 00120 * Specifies the form of the system of equations: 00121 * = 'N': A * X = B (No transpose) 00122 * = 'T': A**T * X = B (Transpose) 00123 * = 'C': A**H * X = B (Conjugate Transpose = Transpose) 00124 * 00125 * N (input) INTEGER 00126 * The number of linear equations, i.e., the order of the 00127 * matrix A. N >= 0. 00128 * 00129 * NRHS (input) INTEGER 00130 * The number of right hand sides, i.e., the number of columns 00131 * of the matrices B and X. NRHS >= 0. 00132 * 00133 * A (input/output) DOUBLE PRECISION array, dimension (LDA,N) 00134 * On entry, the N-by-N matrix A. If FACT = 'F' and EQUED is 00135 * not 'N', then A must have been equilibrated by the scaling 00136 * factors in R and/or C. A is not modified if FACT = 'F' or 00137 * 'N', or if FACT = 'E' and EQUED = 'N' on exit. 00138 * 00139 * On exit, if EQUED .ne. 'N', A is scaled as follows: 00140 * EQUED = 'R': A := diag(R) * A 00141 * EQUED = 'C': A := A * diag(C) 00142 * EQUED = 'B': A := diag(R) * A * diag(C). 00143 * 00144 * LDA (input) INTEGER 00145 * The leading dimension of the array A. LDA >= max(1,N). 00146 * 00147 * AF (input or output) DOUBLE PRECISION array, dimension (LDAF,N) 00148 * If FACT = 'F', then AF is an input argument and on entry 00149 * contains the factors L and U from the factorization 00150 * A = P*L*U as computed by DGETRF. If EQUED .ne. 'N', then 00151 * AF is the factored form of the equilibrated matrix A. 00152 * 00153 * If FACT = 'N', then AF is an output argument and on exit 00154 * returns the factors L and U from the factorization A = P*L*U 00155 * of the original matrix A. 00156 * 00157 * If FACT = 'E', then AF is an output argument and on exit 00158 * returns the factors L and U from the factorization A = P*L*U 00159 * of the equilibrated matrix A (see the description of A for 00160 * the form of the equilibrated matrix). 00161 * 00162 * LDAF (input) INTEGER 00163 * The leading dimension of the array AF. LDAF >= max(1,N). 00164 * 00165 * IPIV (input or output) INTEGER array, dimension (N) 00166 * If FACT = 'F', then IPIV is an input argument and on entry 00167 * contains the pivot indices from the factorization A = P*L*U 00168 * as computed by DGETRF; row i of the matrix was interchanged 00169 * with row IPIV(i). 00170 * 00171 * If FACT = 'N', then IPIV is an output argument and on exit 00172 * contains the pivot indices from the factorization A = P*L*U 00173 * of the original matrix A. 00174 * 00175 * If FACT = 'E', then IPIV is an output argument and on exit 00176 * contains the pivot indices from the factorization A = P*L*U 00177 * of the equilibrated matrix A. 00178 * 00179 * EQUED (input or output) CHARACTER*1 00180 * Specifies the form of equilibration that was done. 00181 * = 'N': No equilibration (always true if FACT = 'N'). 00182 * = 'R': Row equilibration, i.e., A has been premultiplied by 00183 * diag(R). 00184 * = 'C': Column equilibration, i.e., A has been postmultiplied 00185 * by diag(C). 00186 * = 'B': Both row and column equilibration, i.e., A has been 00187 * replaced by diag(R) * A * diag(C). 00188 * EQUED is an input argument if FACT = 'F'; otherwise, it is an 00189 * output argument. 00190 * 00191 * R (input or output) DOUBLE PRECISION array, dimension (N) 00192 * The row scale factors for A. If EQUED = 'R' or 'B', A is 00193 * multiplied on the left by diag(R); if EQUED = 'N' or 'C', R 00194 * is not accessed. R is an input argument if FACT = 'F'; 00195 * otherwise, R is an output argument. If FACT = 'F' and 00196 * EQUED = 'R' or 'B', each element of R must be positive. 00197 * If R is output, each element of R is a power of the radix. 00198 * If R is input, each element of R should be a power of the radix 00199 * to ensure a reliable solution and error estimates. Scaling by 00200 * powers of the radix does not cause rounding errors unless the 00201 * result underflows or overflows. Rounding errors during scaling 00202 * lead to refining with a matrix that is not equivalent to the 00203 * input matrix, producing error estimates that may not be 00204 * reliable. 00205 * 00206 * C (input or output) DOUBLE PRECISION array, dimension (N) 00207 * The column scale factors for A. If EQUED = 'C' or 'B', A is 00208 * multiplied on the right by diag(C); if EQUED = 'N' or 'R', C 00209 * is not accessed. C is an input argument if FACT = 'F'; 00210 * otherwise, C is an output argument. If FACT = 'F' and 00211 * EQUED = 'C' or 'B', each element of C must be positive. 00212 * If C is output, each element of C is a power of the radix. 00213 * If C is input, each element of C should be a power of the radix 00214 * to ensure a reliable solution and error estimates. Scaling by 00215 * powers of the radix does not cause rounding errors unless the 00216 * result underflows or overflows. Rounding errors during scaling 00217 * lead to refining with a matrix that is not equivalent to the 00218 * input matrix, producing error estimates that may not be 00219 * reliable. 00220 * 00221 * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS) 00222 * On entry, the N-by-NRHS right hand side matrix B. 00223 * On exit, 00224 * if EQUED = 'N', B is not modified; 00225 * if TRANS = 'N' and EQUED = 'R' or 'B', B is overwritten by 00226 * diag(R)*B; 00227 * if TRANS = 'T' or 'C' and EQUED = 'C' or 'B', B is 00228 * overwritten by diag(C)*B. 00229 * 00230 * LDB (input) INTEGER 00231 * The leading dimension of the array B. LDB >= max(1,N). 00232 * 00233 * X (output) DOUBLE PRECISION array, dimension (LDX,NRHS) 00234 * If INFO = 0, the N-by-NRHS solution matrix X to the original 00235 * system of equations. Note that A and B are modified on exit 00236 * if EQUED .ne. 'N', and the solution to the equilibrated system is 00237 * inv(diag(C))*X if TRANS = 'N' and EQUED = 'C' or 'B', or 00238 * inv(diag(R))*X if TRANS = 'T' or 'C' and EQUED = 'R' or 'B'. 00239 * 00240 * LDX (input) INTEGER 00241 * The leading dimension of the array X. LDX >= max(1,N). 00242 * 00243 * RCOND (output) DOUBLE PRECISION 00244 * Reciprocal scaled condition number. This is an estimate of the 00245 * reciprocal Skeel condition number of the matrix A after 00246 * equilibration (if done). If this is less than the machine 00247 * precision (in particular, if it is zero), the matrix is singular 00248 * to working precision. Note that the error may still be small even 00249 * if this number is very small and the matrix appears ill- 00250 * conditioned. 00251 * 00252 * RPVGRW (output) DOUBLE PRECISION 00253 * Reciprocal pivot growth. On exit, this contains the reciprocal 00254 * pivot growth factor norm(A)/norm(U). The "max absolute element" 00255 * norm is used. If this is much less than 1, then the stability of 00256 * the LU factorization of the (equilibrated) matrix A could be poor. 00257 * This also means that the solution X, estimated condition numbers, 00258 * and error bounds could be unreliable. If factorization fails with 00259 * 0<INFO<=N, then this contains the reciprocal pivot growth factor 00260 * for the leading INFO columns of A. In DGESVX, this quantity is 00261 * returned in WORK(1). 00262 * 00263 * BERR (output) DOUBLE PRECISION array, dimension (NRHS) 00264 * Componentwise relative backward error. This is the 00265 * componentwise relative backward error of each solution vector X(j) 00266 * (i.e., the smallest relative change in any element of A or B that 00267 * makes X(j) an exact solution). 00268 * 00269 * N_ERR_BNDS (input) INTEGER 00270 * Number of error bounds to return for each right hand side 00271 * and each type (normwise or componentwise). See ERR_BNDS_NORM and 00272 * ERR_BNDS_COMP below. 00273 * 00274 * ERR_BNDS_NORM (output) DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS) 00275 * For each right-hand side, this array contains information about 00276 * various error bounds and condition numbers corresponding to the 00277 * normwise relative error, which is defined as follows: 00278 * 00279 * Normwise relative error in the ith solution vector: 00280 * max_j (abs(XTRUE(j,i) - X(j,i))) 00281 * ------------------------------ 00282 * max_j abs(X(j,i)) 00283 * 00284 * The array is indexed by the type of error information as described 00285 * below. There currently are up to three pieces of information 00286 * returned. 00287 * 00288 * The first index in ERR_BNDS_NORM(i,:) corresponds to the ith 00289 * right-hand side. 00290 * 00291 * The second index in ERR_BNDS_NORM(:,err) contains the following 00292 * three fields: 00293 * err = 1 "Trust/don't trust" boolean. Trust the answer if the 00294 * reciprocal condition number is less than the threshold 00295 * sqrt(n) * dlamch('Epsilon'). 00296 * 00297 * err = 2 "Guaranteed" error bound: The estimated forward error, 00298 * almost certainly within a factor of 10 of the true error 00299 * so long as the next entry is greater than the threshold 00300 * sqrt(n) * dlamch('Epsilon'). This error bound should only 00301 * be trusted if the previous boolean is true. 00302 * 00303 * err = 3 Reciprocal condition number: Estimated normwise 00304 * reciprocal condition number. Compared with the threshold 00305 * sqrt(n) * dlamch('Epsilon') to determine if the error 00306 * estimate is "guaranteed". These reciprocal condition 00307 * numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some 00308 * appropriately scaled matrix Z. 00309 * Let Z = S*A, where S scales each row by a power of the 00310 * radix so all absolute row sums of Z are approximately 1. 00311 * 00312 * See Lapack Working Note 165 for further details and extra 00313 * cautions. 00314 * 00315 * ERR_BNDS_COMP (output) DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS) 00316 * For each right-hand side, this array contains information about 00317 * various error bounds and condition numbers corresponding to the 00318 * componentwise relative error, which is defined as follows: 00319 * 00320 * Componentwise relative error in the ith solution vector: 00321 * abs(XTRUE(j,i) - X(j,i)) 00322 * max_j ---------------------- 00323 * abs(X(j,i)) 00324 * 00325 * The array is indexed by the right-hand side i (on which the 00326 * componentwise relative error depends), and the type of error 00327 * information as described below. There currently are up to three 00328 * pieces of information returned for each right-hand side. If 00329 * componentwise accuracy is not requested (PARAMS(3) = 0.0), then 00330 * ERR_BNDS_COMP is not accessed. If N_ERR_BNDS .LT. 3, then at most 00331 * the first (:,N_ERR_BNDS) entries are returned. 00332 * 00333 * The first index in ERR_BNDS_COMP(i,:) corresponds to the ith 00334 * right-hand side. 00335 * 00336 * The second index in ERR_BNDS_COMP(:,err) contains the following 00337 * three fields: 00338 * err = 1 "Trust/don't trust" boolean. Trust the answer if the 00339 * reciprocal condition number is less than the threshold 00340 * sqrt(n) * dlamch('Epsilon'). 00341 * 00342 * err = 2 "Guaranteed" error bound: The estimated forward error, 00343 * almost certainly within a factor of 10 of the true error 00344 * so long as the next entry is greater than the threshold 00345 * sqrt(n) * dlamch('Epsilon'). This error bound should only 00346 * be trusted if the previous boolean is true. 00347 * 00348 * err = 3 Reciprocal condition number: Estimated componentwise 00349 * reciprocal condition number. Compared with the threshold 00350 * sqrt(n) * dlamch('Epsilon') to determine if the error 00351 * estimate is "guaranteed". These reciprocal condition 00352 * numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some 00353 * appropriately scaled matrix Z. 00354 * Let Z = S*(A*diag(x)), where x is the solution for the 00355 * current right-hand side and S scales each row of 00356 * A*diag(x) by a power of the radix so all absolute row 00357 * sums of Z are approximately 1. 00358 * 00359 * See Lapack Working Note 165 for further details and extra 00360 * cautions. 00361 * 00362 * NPARAMS (input) INTEGER 00363 * Specifies the number of parameters set in PARAMS. If .LE. 0, the 00364 * PARAMS array is never referenced and default values are used. 00365 * 00366 * PARAMS (input / output) DOUBLE PRECISION array, dimension (NPARAMS) 00367 * Specifies algorithm parameters. If an entry is .LT. 0.0, then 00368 * that entry will be filled with default value used for that 00369 * parameter. Only positions up to NPARAMS are accessed; defaults 00370 * are used for higher-numbered parameters. 00371 * 00372 * PARAMS(LA_LINRX_ITREF_I = 1) : Whether to perform iterative 00373 * refinement or not. 00374 * Default: 1.0D+0 00375 * = 0.0 : No refinement is performed, and no error bounds are 00376 * computed. 00377 * = 1.0 : Use the extra-precise refinement algorithm. 00378 * (other values are reserved for future use) 00379 * 00380 * PARAMS(LA_LINRX_ITHRESH_I = 2) : Maximum number of residual 00381 * computations allowed for refinement. 00382 * Default: 10 00383 * Aggressive: Set to 100 to permit convergence using approximate 00384 * factorizations or factorizations other than LU. If 00385 * the factorization uses a technique other than 00386 * Gaussian elimination, the guarantees in 00387 * err_bnds_norm and err_bnds_comp may no longer be 00388 * trustworthy. 00389 * 00390 * PARAMS(LA_LINRX_CWISE_I = 3) : Flag determining if the code 00391 * will attempt to find a solution with small componentwise 00392 * relative error in the double-precision algorithm. Positive 00393 * is true, 0.0 is false. 00394 * Default: 1.0 (attempt componentwise convergence) 00395 * 00396 * WORK (workspace) DOUBLE PRECISION array, dimension (4*N) 00397 * 00398 * IWORK (workspace) INTEGER array, dimension (N) 00399 * 00400 * INFO (output) INTEGER 00401 * = 0: Successful exit. The solution to every right-hand side is 00402 * guaranteed. 00403 * < 0: If INFO = -i, the i-th argument had an illegal value 00404 * > 0 and <= N: U(INFO,INFO) is exactly zero. The factorization 00405 * has been completed, but the factor U is exactly singular, so 00406 * the solution and error bounds could not be computed. RCOND = 0 00407 * is returned. 00408 * = N+J: The solution corresponding to the Jth right-hand side is 00409 * not guaranteed. The solutions corresponding to other right- 00410 * hand sides K with K > J may not be guaranteed as well, but 00411 * only the first such right-hand side is reported. If a small 00412 * componentwise error is not requested (PARAMS(3) = 0.0) then 00413 * the Jth right-hand side is the first with a normwise error 00414 * bound that is not guaranteed (the smallest J such 00415 * that ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0) 00416 * the Jth right-hand side is the first with either a normwise or 00417 * componentwise error bound that is not guaranteed (the smallest 00418 * J such that either ERR_BNDS_NORM(J,1) = 0.0 or 00419 * ERR_BNDS_COMP(J,1) = 0.0). See the definition of 00420 * ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information 00421 * about all of the right-hand sides check ERR_BNDS_NORM or 00422 * ERR_BNDS_COMP. 00423 * 00424 * ================================================================== 00425 * 00426 * .. Parameters .. 00427 DOUBLE PRECISION ZERO, ONE 00428 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 ) 00429 INTEGER FINAL_NRM_ERR_I, FINAL_CMP_ERR_I, BERR_I 00430 INTEGER RCOND_I, NRM_RCOND_I, NRM_ERR_I, CMP_RCOND_I 00431 INTEGER CMP_ERR_I, PIV_GROWTH_I 00432 PARAMETER ( FINAL_NRM_ERR_I = 1, FINAL_CMP_ERR_I = 2, 00433 $ BERR_I = 3 ) 00434 PARAMETER ( RCOND_I = 4, NRM_RCOND_I = 5, NRM_ERR_I = 6 ) 00435 PARAMETER ( CMP_RCOND_I = 7, CMP_ERR_I = 8, 00436 $ PIV_GROWTH_I = 9 ) 00437 * .. 00438 * .. Local Scalars .. 00439 LOGICAL COLEQU, EQUIL, NOFACT, NOTRAN, ROWEQU 00440 INTEGER INFEQU, J 00441 DOUBLE PRECISION AMAX, BIGNUM, COLCND, RCMAX, RCMIN, ROWCND, 00442 $ SMLNUM 00443 * .. 00444 * .. External Functions .. 00445 EXTERNAL LSAME, DLAMCH, DLA_RPVGRW 00446 LOGICAL LSAME 00447 DOUBLE PRECISION DLAMCH, DLA_RPVGRW 00448 * .. 00449 * .. External Subroutines .. 00450 EXTERNAL DGEEQUB, DGETRF, DGETRS, DLACPY, DLAQGE, 00451 $ XERBLA, DLASCL2, DGERFSX 00452 * .. 00453 * .. Intrinsic Functions .. 00454 INTRINSIC MAX, MIN 00455 * .. 00456 * .. Executable Statements .. 00457 * 00458 INFO = 0 00459 NOFACT = LSAME( FACT, 'N' ) 00460 EQUIL = LSAME( FACT, 'E' ) 00461 NOTRAN = LSAME( TRANS, 'N' ) 00462 SMLNUM = DLAMCH( 'Safe minimum' ) 00463 BIGNUM = ONE / SMLNUM 00464 IF( NOFACT .OR. EQUIL ) THEN 00465 EQUED = 'N' 00466 ROWEQU = .FALSE. 00467 COLEQU = .FALSE. 00468 ELSE 00469 ROWEQU = LSAME( EQUED, 'R' ) .OR. LSAME( EQUED, 'B' ) 00470 COLEQU = LSAME( EQUED, 'C' ) .OR. LSAME( EQUED, 'B' ) 00471 END IF 00472 * 00473 * Default is failure. If an input parameter is wrong or 00474 * factorization fails, make everything look horrible. Only the 00475 * pivot growth is set here, the rest is initialized in DGERFSX. 00476 * 00477 RPVGRW = ZERO 00478 * 00479 * Test the input parameters. PARAMS is not tested until DGERFSX. 00480 * 00481 IF( .NOT.NOFACT .AND. .NOT.EQUIL .AND. .NOT. 00482 $ LSAME( FACT, 'F' ) ) THEN 00483 INFO = -1 00484 ELSE IF( .NOT.NOTRAN .AND. .NOT.LSAME( TRANS, 'T' ) .AND. .NOT. 00485 $ LSAME( TRANS, 'C' ) ) THEN 00486 INFO = -2 00487 ELSE IF( N.LT.0 ) THEN 00488 INFO = -3 00489 ELSE IF( NRHS.LT.0 ) THEN 00490 INFO = -4 00491 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN 00492 INFO = -6 00493 ELSE IF( LDAF.LT.MAX( 1, N ) ) THEN 00494 INFO = -8 00495 ELSE IF( LSAME( FACT, 'F' ) .AND. .NOT. 00496 $ ( ROWEQU .OR. COLEQU .OR. LSAME( EQUED, 'N' ) ) ) THEN 00497 INFO = -10 00498 ELSE 00499 IF( ROWEQU ) THEN 00500 RCMIN = BIGNUM 00501 RCMAX = ZERO 00502 DO 10 J = 1, N 00503 RCMIN = MIN( RCMIN, R( J ) ) 00504 RCMAX = MAX( RCMAX, R( J ) ) 00505 10 CONTINUE 00506 IF( RCMIN.LE.ZERO ) THEN 00507 INFO = -11 00508 ELSE IF( N.GT.0 ) THEN 00509 ROWCND = MAX( RCMIN, SMLNUM ) / MIN( RCMAX, BIGNUM ) 00510 ELSE 00511 ROWCND = ONE 00512 END IF 00513 END IF 00514 IF( COLEQU .AND. INFO.EQ.0 ) THEN 00515 RCMIN = BIGNUM 00516 RCMAX = ZERO 00517 DO 20 J = 1, N 00518 RCMIN = MIN( RCMIN, C( J ) ) 00519 RCMAX = MAX( RCMAX, C( J ) ) 00520 20 CONTINUE 00521 IF( RCMIN.LE.ZERO ) THEN 00522 INFO = -12 00523 ELSE IF( N.GT.0 ) THEN 00524 COLCND = MAX( RCMIN, SMLNUM ) / MIN( RCMAX, BIGNUM ) 00525 ELSE 00526 COLCND = ONE 00527 END IF 00528 END IF 00529 IF( INFO.EQ.0 ) THEN 00530 IF( LDB.LT.MAX( 1, N ) ) THEN 00531 INFO = -14 00532 ELSE IF( LDX.LT.MAX( 1, N ) ) THEN 00533 INFO = -16 00534 END IF 00535 END IF 00536 END IF 00537 * 00538 IF( INFO.NE.0 ) THEN 00539 CALL XERBLA( 'DGESVXX', -INFO ) 00540 RETURN 00541 END IF 00542 * 00543 IF( EQUIL ) THEN 00544 * 00545 * Compute row and column scalings to equilibrate the matrix A. 00546 * 00547 CALL DGEEQUB( N, N, A, LDA, R, C, ROWCND, COLCND, AMAX, 00548 $ INFEQU ) 00549 IF( INFEQU.EQ.0 ) THEN 00550 * 00551 * Equilibrate the matrix. 00552 * 00553 CALL DLAQGE( N, N, A, LDA, R, C, ROWCND, COLCND, AMAX, 00554 $ EQUED ) 00555 ROWEQU = LSAME( EQUED, 'R' ) .OR. LSAME( EQUED, 'B' ) 00556 COLEQU = LSAME( EQUED, 'C' ) .OR. LSAME( EQUED, 'B' ) 00557 END IF 00558 * 00559 * If the scaling factors are not applied, set them to 1.0. 00560 * 00561 IF ( .NOT.ROWEQU ) THEN 00562 DO J = 1, N 00563 R( J ) = 1.0D+0 00564 END DO 00565 END IF 00566 IF ( .NOT.COLEQU ) THEN 00567 DO J = 1, N 00568 C( J ) = 1.0D+0 00569 END DO 00570 END IF 00571 END IF 00572 * 00573 * Scale the right-hand side. 00574 * 00575 IF( NOTRAN ) THEN 00576 IF( ROWEQU ) CALL DLASCL2( N, NRHS, R, B, LDB ) 00577 ELSE 00578 IF( COLEQU ) CALL DLASCL2( N, NRHS, C, B, LDB ) 00579 END IF 00580 * 00581 IF( NOFACT .OR. EQUIL ) THEN 00582 * 00583 * Compute the LU factorization of A. 00584 * 00585 CALL DLACPY( 'Full', N, N, A, LDA, AF, LDAF ) 00586 CALL DGETRF( N, N, AF, LDAF, IPIV, INFO ) 00587 * 00588 * Return if INFO is non-zero. 00589 * 00590 IF( INFO.GT.0 ) THEN 00591 * 00592 * Pivot in column INFO is exactly 0 00593 * Compute the reciprocal pivot growth factor of the 00594 * leading rank-deficient INFO columns of A. 00595 * 00596 RPVGRW = DLA_RPVGRW( N, INFO, A, LDA, AF, LDAF ) 00597 RETURN 00598 END IF 00599 END IF 00600 * 00601 * Compute the reciprocal pivot growth factor RPVGRW. 00602 * 00603 RPVGRW = DLA_RPVGRW( N, N, A, LDA, AF, LDAF ) 00604 * 00605 * Compute the solution matrix X. 00606 * 00607 CALL DLACPY( 'Full', N, NRHS, B, LDB, X, LDX ) 00608 CALL DGETRS( TRANS, N, NRHS, AF, LDAF, IPIV, X, LDX, INFO ) 00609 * 00610 * Use iterative refinement to improve the computed solution and 00611 * compute error bounds and backward error estimates for it. 00612 * 00613 CALL DGERFSX( TRANS, EQUED, N, NRHS, A, LDA, AF, LDAF, 00614 $ IPIV, R, C, B, LDB, X, LDX, RCOND, BERR, 00615 $ N_ERR_BNDS, ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS, 00616 $ WORK, IWORK, INFO ) 00617 * 00618 * Scale solutions. 00619 * 00620 IF ( COLEQU .AND. NOTRAN ) THEN 00621 CALL DLASCL2 ( N, NRHS, C, X, LDX ) 00622 ELSE IF ( ROWEQU .AND. .NOT.NOTRAN ) THEN 00623 CALL DLASCL2 ( N, NRHS, R, X, LDX ) 00624 END IF 00625 * 00626 RETURN 00627 * 00628 * End of DGESVXX 00629 00630 END