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