LAPACK 3.3.1
Linear Algebra PACKage

ssysvxx.f

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