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