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