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