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