Annotation of rpl/lapack/lapack/dsysvxx.f, revision 1.4

1.1       bertrand    1:       SUBROUTINE DSYSVXX( FACT, UPLO, N, NRHS, A, LDA, AF, LDAF, IPIV,
                      2:      $                    EQUED, S, B, LDB, X, LDX, RCOND, RPVGRW, BERR,
                      3:      $                    N_ERR_BNDS, ERR_BNDS_NORM, ERR_BNDS_COMP,
                      4:      $                    NPARAMS, PARAMS, WORK, IWORK, INFO )
                      5: *
                      6: *     -- LAPACK routine (version 3.2.2)                               --
                      7: *     -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
                      8: *     -- Jason Riedy of Univ. of California Berkeley.                 --
                      9: *     -- June 2010                                                    --
                     10: *
                     11: *     -- LAPACK is a software package provided by Univ. of Tennessee, --
                     12: *     -- Univ. of California Berkeley and NAG Ltd.                    --
                     13: *
                     14:       IMPLICIT NONE
                     15: *     ..
                     16: *     .. Scalar Arguments ..
                     17:       CHARACTER          EQUED, FACT, UPLO
                     18:       INTEGER            INFO, LDA, LDAF, LDB, LDX, N, NRHS, NPARAMS,
                     19:      $                   N_ERR_BNDS
                     20:       DOUBLE PRECISION   RCOND, RPVGRW
                     21: *     ..
                     22: *     .. Array Arguments ..
                     23:       INTEGER            IPIV( * ), IWORK( * )
                     24:       DOUBLE PRECISION   A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
                     25:      $                   X( LDX, * ), WORK( * )
                     26:       DOUBLE PRECISION   S( * ), PARAMS( * ), BERR( * ),
                     27:      $                   ERR_BNDS_NORM( NRHS, * ),
                     28:      $                   ERR_BNDS_COMP( NRHS, * )
                     29: *     ..
                     30: *
                     31: *     Purpose
                     32: *     =======
                     33: *
                     34: *     DSYSVXX uses the diagonal pivoting factorization to compute the
                     35: *     solution to a double precision system of linear equations A * X = B, where A
                     36: *     is an N-by-N symmetric matrix and X and B are N-by-NRHS matrices.
                     37: *
                     38: *     If requested, both normwise and maximum componentwise error bounds
                     39: *     are returned. DSYSVXX will return a solution with a tiny
                     40: *     guaranteed error (O(eps) where eps is the working machine
                     41: *     precision) unless the matrix is very ill-conditioned, in which
                     42: *     case a warning is returned. Relevant condition numbers also are
                     43: *     calculated and returned.
                     44: *
                     45: *     DSYSVXX accepts user-provided factorizations and equilibration
                     46: *     factors; see the definitions of the FACT and EQUED options.
                     47: *     Solving with refinement and using a factorization from a previous
                     48: *     DSYSVXX call will also produce a solution with either O(eps)
                     49: *     errors or warnings, but we cannot make that claim for general
                     50: *     user-provided factorizations and equilibration factors if they
                     51: *     differ from what DSYSVXX would itself produce.
                     52: *
                     53: *     Description
                     54: *     ===========
                     55: *
                     56: *     The following steps are performed:
                     57: *
                     58: *     1. If FACT = 'E', double precision scaling factors are computed to equilibrate
                     59: *     the system:
                     60: *
                     61: *       diag(S)*A*diag(S)     *inv(diag(S))*X = diag(S)*B
                     62: *
                     63: *     Whether or not the system will be equilibrated depends on the
                     64: *     scaling of the matrix A, but if equilibration is used, A is
                     65: *     overwritten by diag(S)*A*diag(S) and B by diag(S)*B.
                     66: *
                     67: *     2. If FACT = 'N' or 'E', the LU decomposition is used to factor
                     68: *     the matrix A (after equilibration if FACT = 'E') as
                     69: *
                     70: *        A = U * D * U**T,  if UPLO = 'U', or
                     71: *        A = L * D * L**T,  if UPLO = 'L',
                     72: *
                     73: *     where U (or L) is a product of permutation and unit upper (lower)
                     74: *     triangular matrices, and D is symmetric and block diagonal with
                     75: *     1-by-1 and 2-by-2 diagonal blocks.
                     76: *
                     77: *     3. If some D(i,i)=0, so that D is exactly singular, then the
                     78: *     routine returns with INFO = i. Otherwise, the factored form of A
                     79: *     is used to estimate the condition number of the matrix A (see
                     80: *     argument RCOND).  If the reciprocal of the condition number is
                     81: *     less than machine precision, the routine still goes on to solve
                     82: *     for X and compute error bounds as described below.
                     83: *
                     84: *     4. The system of equations is solved for X using the factored form
                     85: *     of A.
                     86: *
                     87: *     5. By default (unless PARAMS(LA_LINRX_ITREF_I) is set to zero),
                     88: *     the routine will use iterative refinement to try to get a small
                     89: *     error and error bounds.  Refinement calculates the residual to at
                     90: *     least twice the working precision.
                     91: *
                     92: *     6. If equilibration was used, the matrix X is premultiplied by
                     93: *     diag(R) so that it solves the original system before
                     94: *     equilibration.
                     95: *
                     96: *     Arguments
                     97: *     =========
                     98: *
                     99: *     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: *     UPLO    (input) CHARACTER*1
                    118: *       = 'U':  Upper triangle of A is stored;
                    119: *       = 'L':  Lower triangle of A is stored.
                    120: *
                    121: *     N       (input) INTEGER
                    122: *     The number of linear equations, i.e., the order of the
                    123: *     matrix A.  N >= 0.
                    124: *
                    125: *     NRHS    (input) INTEGER
                    126: *     The number of right hand sides, i.e., the number of columns
                    127: *     of the matrices B and X.  NRHS >= 0.
                    128: *
                    129: *     A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)
                    130: *     The symmetric matrix A.  If UPLO = 'U', the leading N-by-N
                    131: *     upper triangular part of A contains the upper triangular
                    132: *     part of the matrix A, and the strictly lower triangular
                    133: *     part of A is not referenced.  If UPLO = 'L', the leading
                    134: *     N-by-N lower triangular part of A contains the lower
                    135: *     triangular part of the matrix A, and the strictly upper
                    136: *     triangular part of A is not referenced.
                    137: *
                    138: *     On exit, if FACT = 'E' and EQUED = 'Y', A is overwritten by
                    139: *     diag(S)*A*diag(S).
                    140: *
                    141: *     LDA     (input) INTEGER
                    142: *     The leading dimension of the array A.  LDA >= max(1,N).
                    143: *
                    144: *     AF      (input or output) DOUBLE PRECISION array, dimension (LDAF,N)
                    145: *     If FACT = 'F', then AF is an input argument and on entry
                    146: *     contains the block diagonal matrix D and the multipliers
                    147: *     used to obtain the factor U or L from the factorization A =
                    148: *     U*D*U**T or A = L*D*L**T as computed by DSYTRF.
                    149: *
                    150: *     If FACT = 'N', then AF is an output argument and on exit
                    151: *     returns the block diagonal matrix D and the multipliers
                    152: *     used to obtain the factor U or L from the factorization A =
                    153: *     U*D*U**T or A = L*D*L**T.
                    154: *
                    155: *     LDAF    (input) INTEGER
                    156: *     The leading dimension of the array AF.  LDAF >= max(1,N).
                    157: *
                    158: *     IPIV    (input or output) INTEGER array, dimension (N)
                    159: *     If FACT = 'F', then IPIV is an input argument and on entry
                    160: *     contains details of the interchanges and the block
                    161: *     structure of D, as determined by DSYTRF.  If IPIV(k) > 0,
                    162: *     then rows and columns k and IPIV(k) were interchanged and
                    163: *     D(k,k) is a 1-by-1 diagonal block.  If UPLO = 'U' and
                    164: *     IPIV(k) = IPIV(k-1) < 0, then rows and columns k-1 and
                    165: *     -IPIV(k) were interchanged and D(k-1:k,k-1:k) is a 2-by-2
                    166: *     diagonal block.  If UPLO = 'L' and IPIV(k) = IPIV(k+1) < 0,
                    167: *     then rows and columns k+1 and -IPIV(k) were interchanged
                    168: *     and D(k:k+1,k:k+1) is a 2-by-2 diagonal block.
                    169: *
                    170: *     If FACT = 'N', then IPIV is an output argument and on exit
                    171: *     contains details of the interchanges and the block
                    172: *     structure of D, as determined by DSYTRF.
                    173: *
                    174: *     EQUED   (input or output) CHARACTER*1
                    175: *     Specifies the form of equilibration that was done.
                    176: *       = 'N':  No equilibration (always true if FACT = 'N').
                    177: *       = 'Y':  Both row and column equilibration, i.e., A has been
                    178: *               replaced by diag(S) * A * diag(S).
                    179: *     EQUED is an input argument if FACT = 'F'; otherwise, it is an
                    180: *     output argument.
                    181: *
                    182: *     S       (input or output) DOUBLE PRECISION array, dimension (N)
                    183: *     The scale factors for A.  If EQUED = 'Y', A is multiplied on
                    184: *     the left and right by diag(S).  S is an input argument if FACT =
                    185: *     'F'; otherwise, S is an output argument.  If FACT = 'F' and EQUED
                    186: *     = 'Y', each element of S must be positive.  If S is output, each
                    187: *     element of S is a power of the radix. If S is input, each element
                    188: *     of S should be a power of the radix to ensure a reliable solution
                    189: *     and error estimates. Scaling by powers of the radix does not cause
                    190: *     rounding errors unless the result underflows or overflows.
                    191: *     Rounding errors during scaling lead to refining with a matrix that
                    192: *     is not equivalent to the input matrix, producing error estimates
                    193: *     that may not be reliable.
                    194: *
                    195: *     B       (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
                    196: *     On entry, the N-by-NRHS right hand side matrix B.
                    197: *     On exit,
                    198: *     if EQUED = 'N', B is not modified;
                    199: *     if EQUED = 'Y', B is overwritten by diag(S)*B;
                    200: *
                    201: *     LDB     (input) INTEGER
                    202: *     The leading dimension of the array B.  LDB >= max(1,N).
                    203: *
                    204: *     X       (output) DOUBLE PRECISION array, dimension (LDX,NRHS)
                    205: *     If INFO = 0, the N-by-NRHS solution matrix X to the original
                    206: *     system of equations.  Note that A and B are modified on exit if
                    207: *     EQUED .ne. 'N', and the solution to the equilibrated system is
                    208: *     inv(diag(S))*X.
                    209: *
                    210: *     LDX     (input) INTEGER
                    211: *     The leading dimension of the array X.  LDX >= max(1,N).
                    212: *
                    213: *     RCOND   (output) DOUBLE PRECISION
                    214: *     Reciprocal scaled condition number.  This is an estimate of the
                    215: *     reciprocal Skeel condition number of the matrix A after
                    216: *     equilibration (if done).  If this is less than the machine
                    217: *     precision (in particular, if it is zero), the matrix is singular
                    218: *     to working precision.  Note that the error may still be small even
                    219: *     if this number is very small and the matrix appears ill-
                    220: *     conditioned.
                    221: *
                    222: *     RPVGRW  (output) DOUBLE PRECISION
                    223: *     Reciprocal pivot growth.  On exit, this contains the reciprocal
                    224: *     pivot growth factor norm(A)/norm(U). The "max absolute element"
                    225: *     norm is used.  If this is much less than 1, then the stability of
                    226: *     the LU factorization of the (equilibrated) matrix A could be poor.
                    227: *     This also means that the solution X, estimated condition numbers,
                    228: *     and error bounds could be unreliable. If factorization fails with
                    229: *     0<INFO<=N, then this contains the reciprocal pivot growth factor
                    230: *     for the leading INFO columns of A.
                    231: *
                    232: *     BERR    (output) DOUBLE PRECISION array, dimension (NRHS)
                    233: *     Componentwise relative backward error.  This is the
                    234: *     componentwise relative backward error of each solution vector X(j)
                    235: *     (i.e., the smallest relative change in any element of A or B that
                    236: *     makes X(j) an exact solution).
                    237: *
                    238: *     N_ERR_BNDS (input) INTEGER
                    239: *     Number of error bounds to return for each right hand side
                    240: *     and each type (normwise or componentwise).  See ERR_BNDS_NORM and
                    241: *     ERR_BNDS_COMP below.
                    242: *
                    243: *     ERR_BNDS_NORM  (output) DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS)
                    244: *     For each right-hand side, this array contains information about
                    245: *     various error bounds and condition numbers corresponding to the
                    246: *     normwise relative error, which is defined as follows:
                    247: *
                    248: *     Normwise relative error in the ith solution vector:
                    249: *             max_j (abs(XTRUE(j,i) - X(j,i)))
                    250: *            ------------------------------
                    251: *                  max_j abs(X(j,i))
                    252: *
                    253: *     The array is indexed by the type of error information as described
                    254: *     below. There currently are up to three pieces of information
                    255: *     returned.
                    256: *
                    257: *     The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
                    258: *     right-hand side.
                    259: *
                    260: *     The second index in ERR_BNDS_NORM(:,err) contains the following
                    261: *     three fields:
                    262: *     err = 1 "Trust/don't trust" boolean. Trust the answer if the
                    263: *              reciprocal condition number is less than the threshold
                    264: *              sqrt(n) * dlamch('Epsilon').
                    265: *
                    266: *     err = 2 "Guaranteed" error bound: The estimated forward error,
                    267: *              almost certainly within a factor of 10 of the true error
                    268: *              so long as the next entry is greater than the threshold
                    269: *              sqrt(n) * dlamch('Epsilon'). This error bound should only
                    270: *              be trusted if the previous boolean is true.
                    271: *
                    272: *     err = 3  Reciprocal condition number: Estimated normwise
                    273: *              reciprocal condition number.  Compared with the threshold
                    274: *              sqrt(n) * dlamch('Epsilon') to determine if the error
                    275: *              estimate is "guaranteed". These reciprocal condition
                    276: *              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
                    277: *              appropriately scaled matrix Z.
                    278: *              Let Z = S*A, where S scales each row by a power of the
                    279: *              radix so all absolute row sums of Z are approximately 1.
                    280: *
                    281: *     See Lapack Working Note 165 for further details and extra
                    282: *     cautions.
                    283: *
                    284: *     ERR_BNDS_COMP  (output) DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS)
                    285: *     For each right-hand side, this array contains information about
                    286: *     various error bounds and condition numbers corresponding to the
                    287: *     componentwise relative error, which is defined as follows:
                    288: *
                    289: *     Componentwise relative error in the ith solution vector:
                    290: *                    abs(XTRUE(j,i) - X(j,i))
                    291: *             max_j ----------------------
                    292: *                         abs(X(j,i))
                    293: *
                    294: *     The array is indexed by the right-hand side i (on which the
                    295: *     componentwise relative error depends), and the type of error
                    296: *     information as described below. There currently are up to three
                    297: *     pieces of information returned for each right-hand side. If
                    298: *     componentwise accuracy is not requested (PARAMS(3) = 0.0), then
                    299: *     ERR_BNDS_COMP is not accessed.  If N_ERR_BNDS .LT. 3, then at most
                    300: *     the first (:,N_ERR_BNDS) entries are returned.
                    301: *
                    302: *     The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
                    303: *     right-hand side.
                    304: *
                    305: *     The second index in ERR_BNDS_COMP(:,err) contains the following
                    306: *     three fields:
                    307: *     err = 1 "Trust/don't trust" boolean. Trust the answer if the
                    308: *              reciprocal condition number is less than the threshold
                    309: *              sqrt(n) * dlamch('Epsilon').
                    310: *
                    311: *     err = 2 "Guaranteed" error bound: The estimated forward error,
                    312: *              almost certainly within a factor of 10 of the true error
                    313: *              so long as the next entry is greater than the threshold
                    314: *              sqrt(n) * dlamch('Epsilon'). This error bound should only
                    315: *              be trusted if the previous boolean is true.
                    316: *
                    317: *     err = 3  Reciprocal condition number: Estimated componentwise
                    318: *              reciprocal condition number.  Compared with the threshold
                    319: *              sqrt(n) * dlamch('Epsilon') to determine if the error
                    320: *              estimate is "guaranteed". These reciprocal condition
                    321: *              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
                    322: *              appropriately scaled matrix Z.
                    323: *              Let Z = S*(A*diag(x)), where x is the solution for the
                    324: *              current right-hand side and S scales each row of
                    325: *              A*diag(x) by a power of the radix so all absolute row
                    326: *              sums of Z are approximately 1.
                    327: *
                    328: *     See Lapack Working Note 165 for further details and extra
                    329: *     cautions.
                    330: *
                    331: *     NPARAMS (input) INTEGER
                    332: *     Specifies the number of parameters set in PARAMS.  If .LE. 0, the
                    333: *     PARAMS array is never referenced and default values are used.
                    334: *
                    335: *     PARAMS  (input / output) DOUBLE PRECISION array, dimension (NPARAMS)
                    336: *     Specifies algorithm parameters.  If an entry is .LT. 0.0, then
                    337: *     that entry will be filled with default value used for that
                    338: *     parameter.  Only positions up to NPARAMS are accessed; defaults
                    339: *     are used for higher-numbered parameters.
                    340: *
                    341: *       PARAMS(LA_LINRX_ITREF_I = 1) : Whether to perform iterative
                    342: *            refinement or not.
                    343: *         Default: 1.0D+0
                    344: *            = 0.0 : No refinement is performed, and no error bounds are
                    345: *                    computed.
                    346: *            = 1.0 : Use the extra-precise refinement algorithm.
                    347: *              (other values are reserved for future use)
                    348: *
                    349: *       PARAMS(LA_LINRX_ITHRESH_I = 2) : Maximum number of residual
                    350: *            computations allowed for refinement.
                    351: *         Default: 10
                    352: *         Aggressive: Set to 100 to permit convergence using approximate
                    353: *                     factorizations or factorizations other than LU. If
                    354: *                     the factorization uses a technique other than
                    355: *                     Gaussian elimination, the guarantees in
                    356: *                     err_bnds_norm and err_bnds_comp may no longer be
                    357: *                     trustworthy.
                    358: *
                    359: *       PARAMS(LA_LINRX_CWISE_I = 3) : Flag determining if the code
                    360: *            will attempt to find a solution with small componentwise
                    361: *            relative error in the double-precision algorithm.  Positive
                    362: *            is true, 0.0 is false.
                    363: *         Default: 1.0 (attempt componentwise convergence)
                    364: *
                    365: *     WORK    (workspace) DOUBLE PRECISION array, dimension (4*N)
                    366: *
                    367: *     IWORK   (workspace) INTEGER array, dimension (N)
                    368: *
                    369: *     INFO    (output) INTEGER
                    370: *       = 0:  Successful exit. The solution to every right-hand side is
                    371: *         guaranteed.
                    372: *       < 0:  If INFO = -i, the i-th argument had an illegal value
                    373: *       > 0 and <= N:  U(INFO,INFO) is exactly zero.  The factorization
                    374: *         has been completed, but the factor U is exactly singular, so
                    375: *         the solution and error bounds could not be computed. RCOND = 0
                    376: *         is returned.
                    377: *       = N+J: The solution corresponding to the Jth right-hand side is
                    378: *         not guaranteed. The solutions corresponding to other right-
                    379: *         hand sides K with K > J may not be guaranteed as well, but
                    380: *         only the first such right-hand side is reported. If a small
                    381: *         componentwise error is not requested (PARAMS(3) = 0.0) then
                    382: *         the Jth right-hand side is the first with a normwise error
                    383: *         bound that is not guaranteed (the smallest J such
                    384: *         that ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0)
                    385: *         the Jth right-hand side is the first with either a normwise or
                    386: *         componentwise error bound that is not guaranteed (the smallest
                    387: *         J such that either ERR_BNDS_NORM(J,1) = 0.0 or
                    388: *         ERR_BNDS_COMP(J,1) = 0.0). See the definition of
                    389: *         ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information
                    390: *         about all of the right-hand sides check ERR_BNDS_NORM or
                    391: *         ERR_BNDS_COMP.
                    392: *
                    393: *     ==================================================================
                    394: *
                    395: *     .. Parameters ..
                    396:       DOUBLE PRECISION   ZERO, ONE
                    397:       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
                    398:       INTEGER            FINAL_NRM_ERR_I, FINAL_CMP_ERR_I, BERR_I
                    399:       INTEGER            RCOND_I, NRM_RCOND_I, NRM_ERR_I, CMP_RCOND_I
                    400:       INTEGER            CMP_ERR_I, PIV_GROWTH_I
                    401:       PARAMETER          ( FINAL_NRM_ERR_I = 1, FINAL_CMP_ERR_I = 2,
                    402:      $                   BERR_I = 3 )
                    403:       PARAMETER          ( RCOND_I = 4, NRM_RCOND_I = 5, NRM_ERR_I = 6 )
                    404:       PARAMETER          ( CMP_RCOND_I = 7, CMP_ERR_I = 8,
                    405:      $                   PIV_GROWTH_I = 9 )
                    406: *     ..
                    407: *     .. Local Scalars ..
                    408:       LOGICAL            EQUIL, NOFACT, RCEQU
                    409:       INTEGER            INFEQU, J
                    410:       DOUBLE PRECISION   AMAX, BIGNUM, SMIN, SMAX, SCOND, SMLNUM
                    411: *     ..
                    412: *     .. External Functions ..
                    413:       EXTERNAL           LSAME, DLAMCH, DLA_SYRPVGRW
                    414:       LOGICAL            LSAME
                    415:       DOUBLE PRECISION   DLAMCH, DLA_SYRPVGRW
                    416: *     ..
                    417: *     .. External Subroutines ..
                    418:       EXTERNAL           DSYCON, DSYEQUB, DSYTRF, DSYTRS,
                    419:      $                   DLACPY, DLAQSY, XERBLA, DLASCL2, DSYRFSX
                    420: *     ..
                    421: *     .. Intrinsic Functions ..
                    422:       INTRINSIC          MAX, MIN
                    423: *     ..
                    424: *     .. Executable Statements ..
                    425: *
                    426:       INFO = 0
                    427:       NOFACT = LSAME( FACT, 'N' )
                    428:       EQUIL = LSAME( FACT, 'E' )
                    429:       SMLNUM = DLAMCH( 'Safe minimum' )
                    430:       BIGNUM = ONE / SMLNUM
                    431:       IF( NOFACT .OR. EQUIL ) THEN
                    432:          EQUED = 'N'
                    433:          RCEQU = .FALSE.
                    434:       ELSE
                    435:          RCEQU = LSAME( EQUED, 'Y' )
                    436:       ENDIF
                    437: *
                    438: *     Default is failure.  If an input parameter is wrong or
                    439: *     factorization fails, make everything look horrible.  Only the
                    440: *     pivot growth is set here, the rest is initialized in DSYRFSX.
                    441: *
                    442:       RPVGRW = ZERO
                    443: *
                    444: *     Test the input parameters.  PARAMS is not tested until DSYRFSX.
                    445: *
                    446:       IF( .NOT.NOFACT .AND. .NOT.EQUIL .AND. .NOT.
                    447:      $     LSAME( FACT, 'F' ) ) THEN
                    448:          INFO = -1
                    449:       ELSE IF( .NOT.LSAME(UPLO, 'U') .AND.
                    450:      $         .NOT.LSAME(UPLO, 'L') ) THEN
                    451:          INFO = -2
                    452:       ELSE IF( N.LT.0 ) THEN
                    453:          INFO = -3
                    454:       ELSE IF( NRHS.LT.0 ) THEN
                    455:          INFO = -4
                    456:       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
                    457:          INFO = -6
                    458:       ELSE IF( LDAF.LT.MAX( 1, N ) ) THEN
                    459:          INFO = -8
                    460:       ELSE IF( LSAME( FACT, 'F' ) .AND. .NOT.
                    461:      $        ( RCEQU .OR. LSAME( EQUED, 'N' ) ) ) THEN
                    462:          INFO = -9
                    463:       ELSE
                    464:          IF ( RCEQU ) THEN
                    465:             SMIN = BIGNUM
                    466:             SMAX = ZERO
                    467:             DO 10 J = 1, N
                    468:                SMIN = MIN( SMIN, S( J ) )
                    469:                SMAX = MAX( SMAX, S( J ) )
                    470:  10         CONTINUE
                    471:             IF( SMIN.LE.ZERO ) THEN
                    472:                INFO = -10
                    473:             ELSE IF( N.GT.0 ) THEN
                    474:                SCOND = MAX( SMIN, SMLNUM ) / MIN( SMAX, BIGNUM )
                    475:             ELSE
                    476:                SCOND = ONE
                    477:             END IF
                    478:          END IF
                    479:          IF( INFO.EQ.0 ) THEN
                    480:             IF( LDB.LT.MAX( 1, N ) ) THEN
                    481:                INFO = -12
                    482:             ELSE IF( LDX.LT.MAX( 1, N ) ) THEN
                    483:                INFO = -14
                    484:             END IF
                    485:          END IF
                    486:       END IF
                    487: *
                    488:       IF( INFO.NE.0 ) THEN
                    489:          CALL XERBLA( 'DSYSVXX', -INFO )
                    490:          RETURN
                    491:       END IF
                    492: *
                    493:       IF( EQUIL ) THEN
                    494: *
                    495: *     Compute row and column scalings to equilibrate the matrix A.
                    496: *
                    497:          CALL DSYEQUB( UPLO, N, A, LDA, S, SCOND, AMAX, WORK, INFEQU )
                    498:          IF( INFEQU.EQ.0 ) THEN
                    499: *
                    500: *     Equilibrate the matrix.
                    501: *
                    502:             CALL DLAQSY( UPLO, N, A, LDA, S, SCOND, AMAX, EQUED )
                    503:             RCEQU = LSAME( EQUED, 'Y' )
                    504:          END IF
                    505:       END IF
                    506: *
                    507: *     Scale the right-hand side.
                    508: *
                    509:       IF( RCEQU ) CALL DLASCL2( N, NRHS, S, B, LDB )
                    510: *
                    511:       IF( NOFACT .OR. EQUIL ) THEN
                    512: *
                    513: *        Compute the LDL^T or UDU^T factorization of A.
                    514: *
                    515:          CALL DLACPY( UPLO, N, N, A, LDA, AF, LDAF )
                    516:          CALL DSYTRF( UPLO, N, AF, LDAF, IPIV, WORK, 5*MAX(1,N), INFO )
                    517: *
                    518: *        Return if INFO is non-zero.
                    519: *
                    520:          IF( INFO.GT.0 ) THEN
                    521: *
                    522: *           Pivot in column INFO is exactly 0
                    523: *           Compute the reciprocal pivot growth factor of the
                    524: *           leading rank-deficient INFO columns of A.
                    525: *
                    526:             IF ( N.GT.0 )
                    527:      $           RPVGRW = DLA_SYRPVGRW(UPLO, N, INFO, A, LDA, AF,
                    528:      $           LDAF, IPIV, WORK )
                    529:             RETURN
                    530:          END IF
                    531:       END IF
                    532: *
                    533: *     Compute the reciprocal pivot growth factor RPVGRW.
                    534: *
                    535:       IF ( N.GT.0 )
                    536:      $     RPVGRW = DLA_SYRPVGRW( UPLO, N, INFO, A, LDA, AF, LDAF,
                    537:      $     IPIV, WORK )
                    538: *
                    539: *     Compute the solution matrix X.
                    540: *
                    541:       CALL DLACPY( 'Full', N, NRHS, B, LDB, X, LDX )
                    542:       CALL DSYTRS( UPLO, N, NRHS, AF, LDAF, IPIV, X, LDX, INFO )
                    543: *
                    544: *     Use iterative refinement to improve the computed solution and
                    545: *     compute error bounds and backward error estimates for it.
                    546: *
                    547:       CALL DSYRFSX( UPLO, EQUED, N, NRHS, A, LDA, AF, LDAF, IPIV,
                    548:      $     S, B, LDB, X, LDX, RCOND, BERR, N_ERR_BNDS, ERR_BNDS_NORM,
                    549:      $     ERR_BNDS_COMP, NPARAMS, PARAMS, WORK, IWORK, INFO )
                    550: *
                    551: *     Scale solutions.
                    552: *
                    553:       IF ( RCEQU ) THEN
                    554:          CALL DLASCL2 ( N, NRHS, S, X, LDX )
                    555:       END IF
                    556: *
                    557:       RETURN
                    558: *
                    559: *     End of DSYSVXX
                    560: *
                    561:       END

CVSweb interface <joel.bertrand@systella.fr>