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