LAPACK 3.3.0

sposvxx.f

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