001:       SUBROUTINE SSYSVXX( FACT, UPLO, N, NRHS, A, LDA, AF, LDAF, IPIV,
002:      $                    EQUED, S, B, LDB, X, LDX, RCOND, RPVGRW, BERR,
003:      $                    N_ERR_BNDS, ERR_BNDS_NORM, ERR_BNDS_COMP,
004:      $                    NPARAMS, PARAMS, WORK, IWORK, INFO )
005: *
006: *     -- LAPACK driver routine (version 3.2)                          --
007: *     -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
008: *     -- Jason Riedy of Univ. of California Berkeley.                 --
009: *     -- November 2008                                                --
010: *
011: *     -- LAPACK is a software package provided by Univ. of Tennessee, --
012: *     -- Univ. of California Berkeley and NAG Ltd.                    --
013: *
014:       IMPLICIT NONE
015: *     ..
016: *     .. Scalar Arguments ..
017:       CHARACTER          EQUED, FACT, UPLO
018:       INTEGER            INFO, LDA, LDAF, LDB, LDX, N, NRHS, NPARAMS,
019:      $                   N_ERR_BNDS
020:       REAL               RCOND, RPVGRW
021: *     ..
022: *     .. Array Arguments ..
023:       INTEGER            IPIV( * ), IWORK( * )
024:       REAL               A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
025:      $                   X( LDX, * ), WORK( * )
026:       REAL               S( * ), PARAMS( * ), BERR( * ),
027:      $                   ERR_BNDS_NORM( NRHS, * ),
028:      $                   ERR_BNDS_COMP( NRHS, * )
029: *     ..
030: *
031: *     Purpose
032: *     =======
033: *
034: *     SSYSVXX uses the diagonal pivoting factorization to compute the
035: *     solution to a real system of linear equations A * X = B, where A
036: *     is an N-by-N symmetric matrix and X and B are N-by-NRHS matrices.
037: *
038: *     If requested, both normwise and maximum componentwise error bounds
039: *     are returned. SSYSVXX will return a solution with a tiny
040: *     guaranteed error (O(eps) where eps is the working machine
041: *     precision) unless the matrix is very ill-conditioned, in which
042: *     case a warning is returned. Relevant condition numbers also are
043: *     calculated and returned.
044: *
045: *     SSYSVXX accepts user-provided factorizations and equilibration
046: *     factors; see the definitions of the FACT and EQUED options.
047: *     Solving with refinement and using a factorization from a previous
048: *     SSYSVXX call will also produce a solution with either O(eps)
049: *     errors or warnings, but we cannot make that claim for general
050: *     user-provided factorizations and equilibration factors if they
051: *     differ from what SSYSVXX would itself produce.
052: *
053: *     Description
054: *     ===========
055: *
056: *     The following steps are performed:
057: *
058: *     1. If FACT = 'E', real scaling factors are computed to equilibrate
059: *     the system:
060: *
061: *       diag(S)*A*diag(S)     *inv(diag(S))*X = diag(S)*B
062: *
063: *     Whether or not the system will be equilibrated depends on the
064: *     scaling of the matrix A, but if equilibration is used, A is
065: *     overwritten by diag(S)*A*diag(S) and B by diag(S)*B.
066: *
067: *     2. If FACT = 'N' or 'E', the LU decomposition is used to factor
068: *     the matrix A (after equilibration if FACT = 'E') as
069: *
070: *        A = U * D * U**T,  if UPLO = 'U', or
071: *        A = L * D * L**T,  if UPLO = 'L',
072: *
073: *     where U (or L) is a product of permutation and unit upper (lower)
074: *     triangular matrices, and D is symmetric and block diagonal with
075: *     1-by-1 and 2-by-2 diagonal blocks.
076: *
077: *     3. If some D(i,i)=0, so that D is exactly singular, then the
078: *     routine returns with INFO = i. Otherwise, the factored form of A
079: *     is used to estimate the condition number of the matrix A (see
080: *     argument RCOND).  If the reciprocal of the condition number is
081: *     less than machine precision, the routine still goes on to solve
082: *     for X and compute error bounds as described below.
083: *
084: *     4. The system of equations is solved for X using the factored form
085: *     of A.
086: *
087: *     5. By default (unless PARAMS(LA_LINRX_ITREF_I) is set to zero),
088: *     the routine will use iterative refinement to try to get a small
089: *     error and error bounds.  Refinement calculates the residual to at
090: *     least twice the working precision.
091: *
092: *     6. If equilibration was used, the matrix X is premultiplied by
093: *     diag(R) so that it solves the original system before
094: *     equilibration.
095: *
096: *     Arguments
097: *     =========
098: *
099: *     Some optional parameters are bundled in the PARAMS array.  These
100: *     settings determine how refinement is performed, but often the
101: *     defaults are acceptable.  If the defaults are acceptable, users
102: *     can pass NPARAMS = 0 which prevents the source code from accessing
103: *     the PARAMS argument.
104: *
105: *     FACT    (input) CHARACTER*1
106: *     Specifies whether or not the factored form of the matrix A is
107: *     supplied on entry, and if not, whether the matrix A should be
108: *     equilibrated before it is factored.
109: *       = 'F':  On entry, AF and IPIV contain the factored form of A.
110: *               If EQUED is not 'N', the matrix A has been
111: *               equilibrated with scaling factors given by S.
112: *               A, AF, and IPIV are not modified.
113: *       = 'N':  The matrix A will be copied to AF and factored.
114: *       = 'E':  The matrix A will be equilibrated if necessary, then
115: *               copied to AF and factored.
116: *
117: *     N       (input) INTEGER
118: *     The number of linear equations, i.e., the order of the
119: *     matrix A.  N >= 0.
120: *
121: *     NRHS    (input) INTEGER
122: *     The number of right hand sides, i.e., the number of columns
123: *     of the matrices B and X.  NRHS >= 0.
124: *
125: *     A       (input/output) REAL array, dimension (LDA,N)
126: *     The symmetric matrix A.  If UPLO = 'U', the leading N-by-N
127: *     upper triangular part of A contains the upper triangular
128: *     part of the matrix A, and the strictly lower triangular
129: *     part of A is not referenced.  If UPLO = 'L', the leading
130: *     N-by-N lower triangular part of A contains the lower
131: *     triangular part of the matrix A, and the strictly upper
132: *     triangular part of A is not referenced.
133: *
134: *     On exit, if FACT = 'E' and EQUED = 'Y', A is overwritten by
135: *     diag(S)*A*diag(S).
136: *
137: *     LDA     (input) INTEGER
138: *     The leading dimension of the array A.  LDA >= max(1,N).
139: *
140: *     AF      (input or output) REAL array, dimension (LDAF,N)
141: *     If FACT = 'F', then AF is an input argument and on entry
142: *     contains the block diagonal matrix D and the multipliers
143: *     used to obtain the factor U or L from the factorization A =
144: *     U*D*U**T or A = L*D*L**T as computed by SSYTRF.
145: *
146: *     If FACT = 'N', then AF is an output argument and on exit
147: *     returns the block diagonal matrix D and the multipliers
148: *     used to obtain the factor U or L from the factorization A =
149: *     U*D*U**T or A = L*D*L**T.
150: *
151: *     LDAF    (input) INTEGER
152: *     The leading dimension of the array AF.  LDAF >= max(1,N).
153: *
154: *     IPIV    (input or output) INTEGER array, dimension (N)
155: *     If FACT = 'F', then IPIV is an input argument and on entry
156: *     contains details of the interchanges and the block
157: *     structure of D, as determined by SSYTRF.  If IPIV(k) > 0,
158: *     then rows and columns k and IPIV(k) were interchanged and
159: *     D(k,k) is a 1-by-1 diagonal block.  If UPLO = 'U' and
160: *     IPIV(k) = IPIV(k-1) < 0, then rows and columns k-1 and
161: *     -IPIV(k) were interchanged and D(k-1:k,k-1:k) is a 2-by-2
162: *     diagonal block.  If UPLO = 'L' and IPIV(k) = IPIV(k+1) < 0,
163: *     then rows and columns k+1 and -IPIV(k) were interchanged
164: *     and D(k:k+1,k:k+1) is a 2-by-2 diagonal block.
165: *
166: *     If FACT = 'N', then IPIV is an output argument and on exit
167: *     contains details of the interchanges and the block
168: *     structure of D, as determined by SSYTRF.
169: *
170: *     EQUED   (input or output) CHARACTER*1
171: *     Specifies the form of equilibration that was done.
172: *       = 'N':  No equilibration (always true if FACT = 'N').
173: *       = 'Y':  Both row and column equilibration, i.e., A has been
174: *               replaced by diag(S) * A * diag(S).
175: *     EQUED is an input argument if FACT = 'F'; otherwise, it is an
176: *     output argument.
177: *
178: *     S       (input or output) REAL array, dimension (N)
179: *     The scale factors for A.  If EQUED = 'Y', A is multiplied on
180: *     the left and right by diag(S).  S is an input argument if FACT =
181: *     'F'; otherwise, S is an output argument.  If FACT = 'F' and EQUED
182: *     = 'Y', each element of S must be positive.  If S is output, each
183: *     element of S is a power of the radix. If S is input, each element
184: *     of S should be a power of the radix to ensure a reliable solution
185: *     and error estimates. Scaling by powers of the radix does not cause
186: *     rounding errors unless the result underflows or overflows.
187: *     Rounding errors during scaling lead to refining with a matrix that
188: *     is not equivalent to the input matrix, producing error estimates
189: *     that may not be reliable.
190: *
191: *     B       (input/output) REAL array, dimension (LDB,NRHS)
192: *     On entry, the N-by-NRHS right hand side matrix B.
193: *     On exit,
194: *     if EQUED = 'N', B is not modified;
195: *     if EQUED = 'Y', B is overwritten by diag(S)*B;
196: *
197: *     LDB     (input) INTEGER
198: *     The leading dimension of the array B.  LDB >= max(1,N).
199: *
200: *     X       (output) REAL array, dimension (LDX,NRHS)
201: *     If INFO = 0, the N-by-NRHS solution matrix X to the original
202: *     system of equations.  Note that A and B are modified on exit if
203: *     EQUED .ne. 'N', and the solution to the equilibrated system is
204: *     inv(diag(S))*X.
205: *
206: *     LDX     (input) INTEGER
207: *     The leading dimension of the array X.  LDX >= max(1,N).
208: *
209: *     RCOND   (output) REAL
210: *     Reciprocal scaled condition number.  This is an estimate of the
211: *     reciprocal Skeel condition number of the matrix A after
212: *     equilibration (if done).  If this is less than the machine
213: *     precision (in particular, if it is zero), the matrix is singular
214: *     to working precision.  Note that the error may still be small even
215: *     if this number is very small and the matrix appears ill-
216: *     conditioned.
217: *
218: *     RPVGRW  (output) REAL
219: *     Reciprocal pivot growth.  On exit, this contains the reciprocal
220: *     pivot growth factor norm(A)/norm(U). The "max absolute element"
221: *     norm is used.  If this is much less than 1, then the stability of
222: *     the LU factorization of the (equilibrated) matrix A could be poor.
223: *     This also means that the solution X, estimated condition numbers,
224: *     and error bounds could be unreliable. If factorization fails with
225: *     0<INFO<=N, then this contains the reciprocal pivot growth factor
226: *     for the leading INFO columns of A.
227: *
228: *     BERR    (output) REAL array, dimension (NRHS)
229: *     Componentwise relative backward error.  This is the
230: *     componentwise relative backward error of each solution vector X(j)
231: *     (i.e., the smallest relative change in any element of A or B that
232: *     makes X(j) an exact solution).
233: *
234: *     N_ERR_BNDS (input) INTEGER
235: *     Number of error bounds to return for each right hand side
236: *     and each type (normwise or componentwise).  See ERR_BNDS_NORM and
237: *     ERR_BNDS_COMP below.
238: *
239: *     ERR_BNDS_NORM  (output) REAL array, dimension (NRHS, N_ERR_BNDS)
240: *     For each right-hand side, this array contains information about
241: *     various error bounds and condition numbers corresponding to the
242: *     normwise relative error, which is defined as follows:
243: *
244: *     Normwise relative error in the ith solution vector:
245: *             max_j (abs(XTRUE(j,i) - X(j,i)))
246: *            ------------------------------
247: *                  max_j abs(X(j,i))
248: *
249: *     The array is indexed by the type of error information as described
250: *     below. There currently are up to three pieces of information
251: *     returned.
252: *
253: *     The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
254: *     right-hand side.
255: *
256: *     The second index in ERR_BNDS_NORM(:,err) contains the following
257: *     three fields:
258: *     err = 1 "Trust/don't trust" boolean. Trust the answer if the
259: *              reciprocal condition number is less than the threshold
260: *              sqrt(n) * slamch('Epsilon').
261: *
262: *     err = 2 "Guaranteed" error bound: The estimated forward error,
263: *              almost certainly within a factor of 10 of the true error
264: *              so long as the next entry is greater than the threshold
265: *              sqrt(n) * slamch('Epsilon'). This error bound should only
266: *              be trusted if the previous boolean is true.
267: *
268: *     err = 3  Reciprocal condition number: Estimated normwise
269: *              reciprocal condition number.  Compared with the threshold
270: *              sqrt(n) * slamch('Epsilon') to determine if the error
271: *              estimate is "guaranteed". These reciprocal condition
272: *              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
273: *              appropriately scaled matrix Z.
274: *              Let Z = S*A, where S scales each row by a power of the
275: *              radix so all absolute row sums of Z are approximately 1.
276: *
277: *     See Lapack Working Note 165 for further details and extra
278: *     cautions.
279: *
280: *     ERR_BNDS_COMP  (output) REAL array, dimension (NRHS, N_ERR_BNDS)
281: *     For each right-hand side, this array contains information about
282: *     various error bounds and condition numbers corresponding to the
283: *     componentwise relative error, which is defined as follows:
284: *
285: *     Componentwise relative error in the ith solution vector:
286: *                    abs(XTRUE(j,i) - X(j,i))
287: *             max_j ----------------------
288: *                         abs(X(j,i))
289: *
290: *     The array is indexed by the right-hand side i (on which the
291: *     componentwise relative error depends), and the type of error
292: *     information as described below. There currently are up to three
293: *     pieces of information returned for each right-hand side. If
294: *     componentwise accuracy is not requested (PARAMS(3) = 0.0), then
295: *     ERR_BNDS_COMP is not accessed.  If N_ERR_BNDS .LT. 3, then at most
296: *     the first (:,N_ERR_BNDS) entries are returned.
297: *
298: *     The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
299: *     right-hand side.
300: *
301: *     The second index in ERR_BNDS_COMP(:,err) contains the following
302: *     three fields:
303: *     err = 1 "Trust/don't trust" boolean. Trust the answer if the
304: *              reciprocal condition number is less than the threshold
305: *              sqrt(n) * slamch('Epsilon').
306: *
307: *     err = 2 "Guaranteed" error bound: The estimated forward error,
308: *              almost certainly within a factor of 10 of the true error
309: *              so long as the next entry is greater than the threshold
310: *              sqrt(n) * slamch('Epsilon'). This error bound should only
311: *              be trusted if the previous boolean is true.
312: *
313: *     err = 3  Reciprocal condition number: Estimated componentwise
314: *              reciprocal condition number.  Compared with the threshold
315: *              sqrt(n) * slamch('Epsilon') to determine if the error
316: *              estimate is "guaranteed". These reciprocal condition
317: *              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
318: *              appropriately scaled matrix Z.
319: *              Let Z = S*(A*diag(x)), where x is the solution for the
320: *              current right-hand side and S scales each row of
321: *              A*diag(x) by a power of the radix so all absolute row
322: *              sums of Z are approximately 1.
323: *
324: *     See Lapack Working Note 165 for further details and extra
325: *     cautions.
326: *
327: *     NPARAMS (input) INTEGER
328: *     Specifies the number of parameters set in PARAMS.  If .LE. 0, the
329: *     PARAMS array is never referenced and default values are used.
330: *
331: *     PARAMS  (input / output) REAL array, dimension NPARAMS
332: *     Specifies algorithm parameters.  If an entry is .LT. 0.0, then
333: *     that entry will be filled with default value used for that
334: *     parameter.  Only positions up to NPARAMS are accessed; defaults
335: *     are used for higher-numbered parameters.
336: *
337: *       PARAMS(LA_LINRX_ITREF_I = 1) : Whether to perform iterative
338: *            refinement or not.
339: *         Default: 1.0
340: *            = 0.0 : No refinement is performed, and no error bounds are
341: *                    computed.
342: *            = 1.0 : Use the double-precision refinement algorithm,
343: *                    possibly with doubled-single computations if the
344: *                    compilation environment does not support DOUBLE
345: *                    PRECISION.
346: *              (other values are reserved for future use)
347: *
348: *       PARAMS(LA_LINRX_ITHRESH_I = 2) : Maximum number of residual
349: *            computations allowed for refinement.
350: *         Default: 10
351: *         Aggressive: Set to 100 to permit convergence using approximate
352: *                     factorizations or factorizations other than LU. If
353: *                     the factorization uses a technique other than
354: *                     Gaussian elimination, the guarantees in
355: *                     err_bnds_norm and err_bnds_comp may no longer be
356: *                     trustworthy.
357: *
358: *       PARAMS(LA_LINRX_CWISE_I = 3) : Flag determining if the code
359: *            will attempt to find a solution with small componentwise
360: *            relative error in the double-precision algorithm.  Positive
361: *            is true, 0.0 is false.
362: *         Default: 1.0 (attempt componentwise convergence)
363: *
364: *     WORK    (workspace) REAL array, dimension (4*N)
365: *
366: *     IWORK   (workspace) INTEGER array, dimension (N)
367: *
368: *     INFO    (output) INTEGER
369: *       = 0:  Successful exit. The solution to every right-hand side is
370: *         guaranteed.
371: *       < 0:  If INFO = -i, the i-th argument had an illegal value
372: *       > 0 and <= N:  U(INFO,INFO) is exactly zero.  The factorization
373: *         has been completed, but the factor U is exactly singular, so
374: *         the solution and error bounds could not be computed. RCOND = 0
375: *         is returned.
376: *       = N+J: The solution corresponding to the Jth right-hand side is
377: *         not guaranteed. The solutions corresponding to other right-
378: *         hand sides K with K > J may not be guaranteed as well, but
379: *         only the first such right-hand side is reported. If a small
380: *         componentwise error is not requested (PARAMS(3) = 0.0) then
381: *         the Jth right-hand side is the first with a normwise error
382: *         bound that is not guaranteed (the smallest J such
383: *         that ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0)
384: *         the Jth right-hand side is the first with either a normwise or
385: *         componentwise error bound that is not guaranteed (the smallest
386: *         J such that either ERR_BNDS_NORM(J,1) = 0.0 or
387: *         ERR_BNDS_COMP(J,1) = 0.0). See the definition of
388: *         ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information
389: *         about all of the right-hand sides check ERR_BNDS_NORM or
390: *         ERR_BNDS_COMP.
391: *
392: *     ==================================================================
393: *
394: *     .. Parameters ..
395:       REAL               ZERO, ONE
396:       PARAMETER          ( ZERO = 0.0E+0, ONE = 1.0E+0 )
397:       INTEGER            FINAL_NRM_ERR_I, FINAL_CMP_ERR_I, BERR_I
398:       INTEGER            RCOND_I, NRM_RCOND_I, NRM_ERR_I, CMP_RCOND_I
399:       INTEGER            CMP_ERR_I, PIV_GROWTH_I
400:       PARAMETER          ( FINAL_NRM_ERR_I = 1, FINAL_CMP_ERR_I = 2,
401:      $                   BERR_I = 3 )
402:       PARAMETER          ( RCOND_I = 4, NRM_RCOND_I = 5, NRM_ERR_I = 6 )
403:       PARAMETER          ( CMP_RCOND_I = 7, CMP_ERR_I = 8,
404:      $                   PIV_GROWTH_I = 9 )
405: *     ..
406: *     .. Local Scalars ..
407:       LOGICAL            EQUIL, NOFACT, RCEQU
408:       INTEGER            INFEQU, J
409:       REAL               AMAX, BIGNUM, SMIN, SMAX, SCOND, SMLNUM
410: *     ..
411: *     .. External Functions ..
412:       EXTERNAL           LSAME, SLAMCH, SLA_SYRPVGRW
413:       LOGICAL            LSAME
414:       REAL               SLAMCH, SLA_SYRPVGRW
415: *     ..
416: *     .. External Subroutines ..
417:       EXTERNAL           SSYCON, SSYEQUB, SSYTRF, SSYTRS,
418:      $                   SLACPY, SLAQSY, XERBLA, SLASCL2, SSYRFSX
419: *     ..
420: *     .. Intrinsic Functions ..
421:       INTRINSIC          MAX, MIN
422: *     ..
423: *     .. Executable Statements ..
424: *
425:       INFO = 0
426:       NOFACT = LSAME( FACT, 'N' )
427:       EQUIL = LSAME( FACT, 'E' )
428:       SMLNUM = SLAMCH( 'Safe minimum' )
429:       BIGNUM = ONE / SMLNUM
430:       IF( NOFACT .OR. EQUIL ) THEN
431:          EQUED = 'N'
432:          RCEQU = .FALSE.
433:       ELSE
434:          RCEQU = LSAME( EQUED, 'Y' )
435:       ENDIF
436: *
437: *     Default is failure.  If an input parameter is wrong or
438: *     factorization fails, make everything look horrible.  Only the
439: *     pivot growth is set here, the rest is initialized in SSYRFSX.
440: *
441:       RPVGRW = ZERO
442: *
443: *     Test the input parameters.  PARAMS is not tested until SSYRFSX.
444: *
445:       IF( .NOT.NOFACT .AND. .NOT.EQUIL .AND. .NOT.
446:      $     LSAME( FACT, 'F' ) ) THEN
447:          INFO = -1
448:       ELSE IF( .NOT.LSAME(UPLO, 'U') .AND.
449:      $         .NOT.LSAME(UPLO, 'L') ) THEN
450:          INFO = -2
451:       ELSE IF( N.LT.0 ) THEN
452:          INFO = -3
453:       ELSE IF( NRHS.LT.0 ) THEN
454:          INFO = -4
455:       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
456:          INFO = -6
457:       ELSE IF( LDAF.LT.MAX( 1, N ) ) THEN
458:          INFO = -8
459:       ELSE IF( LSAME( FACT, 'F' ) .AND. .NOT.
460:      $        ( RCEQU .OR. LSAME( EQUED, 'N' ) ) ) THEN
461:          INFO = -9
462:       ELSE
463:          IF ( RCEQU ) THEN
464:             SMIN = BIGNUM
465:             SMAX = ZERO
466:             DO 10 J = 1, N
467:                SMIN = MIN( SMIN, S( J ) )
468:                SMAX = MAX( SMAX, S( J ) )
469:  10         CONTINUE
470:             IF( SMIN.LE.ZERO ) THEN
471:                INFO = -10
472:             ELSE IF( N.GT.0 ) THEN
473:                SCOND = MAX( SMIN, SMLNUM ) / MIN( SMAX, BIGNUM )
474:             ELSE
475:                SCOND = ONE
476:             END IF
477:          END IF
478:          IF( INFO.EQ.0 ) THEN
479:             IF( LDB.LT.MAX( 1, N ) ) THEN
480:                INFO = -12
481:             ELSE IF( LDX.LT.MAX( 1, N ) ) THEN
482:                INFO = -14
483:             END IF
484:          END IF
485:       END IF
486: *
487:       IF( INFO.NE.0 ) THEN
488:          CALL XERBLA( 'SSYSVXX', -INFO )
489:          RETURN
490:       END IF
491: *
492:       IF( EQUIL ) THEN
493: *
494: *     Compute row and column scalings to equilibrate the matrix A.
495: *
496:          CALL SSYEQUB( UPLO, N, A, LDA, S, SCOND, AMAX, WORK, INFEQU )
497:          IF( INFEQU.EQ.0 ) THEN
498: *
499: *     Equilibrate the matrix.
500: *
501:             CALL SLAQSY( UPLO, N, A, LDA, S, SCOND, AMAX, EQUED )
502:             RCEQU = LSAME( EQUED, 'Y' )
503:          END IF
504:       END IF
505: *
506: *     Scale the right-hand side.
507: *
508:       IF( RCEQU ) CALL SLASCL2( N, NRHS, S, B, LDB )
509: *
510:       IF( NOFACT .OR. EQUIL ) THEN
511: *
512: *        Compute the LU factorization of A.
513: *
514:          CALL SLACPY( UPLO, N, N, A, LDA, AF, LDAF )
515:          CALL SSYTRF( UPLO, N, AF, LDAF, IPIV, WORK, 5*MAX(1,N), INFO )
516: *
517: *        Return if INFO is non-zero.
518: *
519:          IF( INFO.GT.0 ) THEN
520: *
521: *           Pivot in column INFO is exactly 0
522: *           Compute the reciprocal pivot growth factor of the
523: *           leading rank-deficient INFO columns of A.
524: *
525:             IF ( N.GT.0 )
526:      $           RPVGRW = SLA_SYRPVGRW(UPLO, N, INFO, A, LDA, AF,
527:      $           LDAF, IPIV, WORK )
528:             RETURN
529:          END IF
530:       END IF
531: *
532: *     Compute the reciprocal pivot growth factor RPVGRW.
533: *
534:       IF ( N.GT.0 )
535:      $     RPVGRW = SLA_SYRPVGRW( UPLO, N, INFO, A, LDA, AF, LDAF,
536:      $     IPIV, WORK )
537: *
538: *     Compute the solution matrix X.
539: *
540:       CALL SLACPY( 'Full', N, NRHS, B, LDB, X, LDX )
541:       CALL SSYTRS( UPLO, N, NRHS, AF, LDAF, IPIV, X, LDX, INFO )
542: *
543: *     Use iterative refinement to improve the computed solution and
544: *     compute error bounds and backward error estimates for it.
545: *
546:       CALL SSYRFSX( UPLO, EQUED, N, NRHS, A, LDA, AF, LDAF, IPIV,
547:      $     S, B, LDB, X, LDX, RCOND, BERR, N_ERR_BNDS, ERR_BNDS_NORM,
548:      $     ERR_BNDS_COMP, NPARAMS, PARAMS, WORK, IWORK, INFO )
549: *
550: *     Scale solutions.
551: *
552:       IF ( RCEQU ) THEN
553:          CALL SLASCL2 ( N, NRHS, S, X, LDX )
554:       END IF
555: *
556:       RETURN
557: *
558: *     End of SSYSVXX
559: *
560:       END
561: