LAPACK 3.3.1
Linear Algebra PACKage

csysvxx.f

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