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