LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
zposvxx.f
Go to the documentation of this file.
00001 *> \brief <b> ZPOSVXX 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 ZPOSVXX + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zposvxx.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zposvxx.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zposvxx.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE ZPOSVXX( 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 *       DOUBLE PRECISION   RCOND, RPVGRW
00031 *       ..
00032 *       .. Array Arguments ..
00033 *       COMPLEX*16         A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
00034 *      $                   WORK( * ), X( LDX, * )
00035 *       DOUBLE PRECISION   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 *>    ZPOSVXX uses the Cholesky factorization A = U**T*U or A = L*L**T
00047 *>    to compute the solution to a complex*16 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. ZPOSVXX 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 *>    ZPOSVXX 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 *>    ZPOSVXX 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 ZPOSVXX would itself produce.
00065 *> \endverbatim
00066 *
00067 *> \par Description:
00068 *  =================
00069 *>
00070 *> \verbatim
00071 *>
00072 *>    The following steps are performed:
00073 *>
00074 *>    1. If FACT = 'E', double precision scaling factors are computed to equilibrate
00075 *>    the system:
00076 *>
00077 *>      diag(S)*A*diag(S)     *inv(diag(S))*X = diag(S)*B
00078 *>
00079 *>    Whether or not the system will be equilibrated depends on the
00080 *>    scaling of the matrix A, but if equilibration is used, A is
00081 *>    overwritten by diag(S)*A*diag(S) and B by diag(S)*B.
00082 *>
00083 *>    2. If FACT = 'N' or 'E', the 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*16 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*16 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 DOUBLE PRECISION 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*16 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*16 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 DOUBLE PRECISION
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 DOUBLE PRECISION
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 DOUBLE PRECISION 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 DOUBLE PRECISION 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) * dlamch('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) * dlamch('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) * dlamch('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 DOUBLE PRECISION 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) * dlamch('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) * dlamch('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) * dlamch('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) DOUBLE PRECISION 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.0D+0
00419 *>            = 0.0 : No refinement is performed, and no error bounds are
00420 *>                    computed.
00421 *>            = 1.0 : Use the extra-precise refinement algorithm.
00422 *>              (other values are reserved for future use)
00423 *>
00424 *>       PARAMS(LA_LINRX_ITHRESH_I = 2) : Maximum number of residual
00425 *>            computations allowed for refinement.
00426 *>         Default: 10
00427 *>         Aggressive: Set to 100 to permit convergence using approximate
00428 *>                     factorizations or factorizations other than LU. If
00429 *>                     the factorization uses a technique other than
00430 *>                     Gaussian elimination, the guarantees in
00431 *>                     err_bnds_norm and err_bnds_comp may no longer be
00432 *>                     trustworthy.
00433 *>
00434 *>       PARAMS(LA_LINRX_CWISE_I = 3) : Flag determining if the code
00435 *>            will attempt to find a solution with small componentwise
00436 *>            relative error in the double-precision algorithm.  Positive
00437 *>            is true, 0.0 is false.
00438 *>         Default: 1.0 (attempt componentwise convergence)
00439 *> \endverbatim
00440 *>
00441 *> \param[out] WORK
00442 *> \verbatim
00443 *>          WORK is COMPLEX*16 array, dimension (2*N)
00444 *> \endverbatim
00445 *>
00446 *> \param[out] RWORK
00447 *> \verbatim
00448 *>          RWORK is DOUBLE PRECISION array, dimension (2*N)
00449 *> \endverbatim
00450 *>
00451 *> \param[out] INFO
00452 *> \verbatim
00453 *>          INFO is INTEGER
00454 *>       = 0:  Successful exit. The solution to every right-hand side is
00455 *>         guaranteed.
00456 *>       < 0:  If INFO = -i, the i-th argument had an illegal value
00457 *>       > 0 and <= N:  U(INFO,INFO) is exactly zero.  The factorization
00458 *>         has been completed, but the factor U is exactly singular, so
00459 *>         the solution and error bounds could not be computed. RCOND = 0
00460 *>         is returned.
00461 *>       = N+J: The solution corresponding to the Jth right-hand side is
00462 *>         not guaranteed. The solutions corresponding to other right-
00463 *>         hand sides K with K > J may not be guaranteed as well, but
00464 *>         only the first such right-hand side is reported. If a small
00465 *>         componentwise error is not requested (PARAMS(3) = 0.0) then
00466 *>         the Jth right-hand side is the first with a normwise error
00467 *>         bound that is not guaranteed (the smallest J such
00468 *>         that ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0)
00469 *>         the Jth right-hand side is the first with either a normwise or
00470 *>         componentwise error bound that is not guaranteed (the smallest
00471 *>         J such that either ERR_BNDS_NORM(J,1) = 0.0 or
00472 *>         ERR_BNDS_COMP(J,1) = 0.0). See the definition of
00473 *>         ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information
00474 *>         about all of the right-hand sides check ERR_BNDS_NORM or
00475 *>         ERR_BNDS_COMP.
00476 *> \endverbatim
00477 *
00478 *  Authors:
00479 *  ========
00480 *
00481 *> \author Univ. of Tennessee 
00482 *> \author Univ. of California Berkeley 
00483 *> \author Univ. of Colorado Denver 
00484 *> \author NAG Ltd. 
00485 *
00486 *> \date April 2012
00487 *
00488 *> \ingroup complex16POsolve
00489 *
00490 *  =====================================================================
00491       SUBROUTINE ZPOSVXX( FACT, UPLO, N, NRHS, A, LDA, AF, LDAF, EQUED,
00492      $                    S, B, LDB, X, LDX, RCOND, RPVGRW, BERR,
00493      $                    N_ERR_BNDS, ERR_BNDS_NORM, ERR_BNDS_COMP,
00494      $                    NPARAMS, PARAMS, WORK, RWORK, INFO )
00495 *
00496 *  -- LAPACK driver routine (version 3.4.1) --
00497 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00498 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00499 *     April 2012
00500 *
00501 *     .. Scalar Arguments ..
00502       CHARACTER          EQUED, FACT, UPLO
00503       INTEGER            INFO, LDA, LDAF, LDB, LDX, N, NRHS, NPARAMS,
00504      $                   N_ERR_BNDS
00505       DOUBLE PRECISION   RCOND, RPVGRW
00506 *     ..
00507 *     .. Array Arguments ..
00508       COMPLEX*16         A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
00509      $                   WORK( * ), X( LDX, * )
00510       DOUBLE PRECISION   S( * ), PARAMS( * ), BERR( * ), RWORK( * ),
00511      $                   ERR_BNDS_NORM( NRHS, * ),
00512      $                   ERR_BNDS_COMP( NRHS, * )
00513 *     ..
00514 *
00515 *  ==================================================================
00516 *
00517 *     .. Parameters ..
00518       DOUBLE PRECISION   ZERO, ONE
00519       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
00520       INTEGER            FINAL_NRM_ERR_I, FINAL_CMP_ERR_I, BERR_I
00521       INTEGER            RCOND_I, NRM_RCOND_I, NRM_ERR_I, CMP_RCOND_I
00522       INTEGER            CMP_ERR_I, PIV_GROWTH_I
00523       PARAMETER          ( FINAL_NRM_ERR_I = 1, FINAL_CMP_ERR_I = 2,
00524      $                   BERR_I = 3 )
00525       PARAMETER          ( RCOND_I = 4, NRM_RCOND_I = 5, NRM_ERR_I = 6 )
00526       PARAMETER          ( CMP_RCOND_I = 7, CMP_ERR_I = 8,
00527      $                   PIV_GROWTH_I = 9 )
00528 *     ..
00529 *     .. Local Scalars ..
00530       LOGICAL            EQUIL, NOFACT, RCEQU
00531       INTEGER            INFEQU, J
00532       DOUBLE PRECISION   AMAX, BIGNUM, SMIN, SMAX, SCOND, SMLNUM
00533 *     ..
00534 *     .. External Functions ..
00535       EXTERNAL           LSAME, DLAMCH, ZLA_PORPVGRW
00536       LOGICAL            LSAME
00537       DOUBLE PRECISION   DLAMCH, ZLA_PORPVGRW
00538 *     ..
00539 *     .. External Subroutines ..
00540       EXTERNAL           ZPOCON, ZPOEQUB, ZPOTRF, ZPOTRS, ZLACPY,
00541      $                   ZLAQHE, XERBLA, ZLASCL2, ZPORFSX
00542 *     ..
00543 *     .. Intrinsic Functions ..
00544       INTRINSIC          MAX, MIN
00545 *     ..
00546 *     .. Executable Statements ..
00547 *
00548       INFO = 0
00549       NOFACT = LSAME( FACT, 'N' )
00550       EQUIL = LSAME( FACT, 'E' )
00551       SMLNUM = DLAMCH( 'Safe minimum' )
00552       BIGNUM = ONE / SMLNUM
00553       IF( NOFACT .OR. EQUIL ) THEN
00554          EQUED = 'N'
00555          RCEQU = .FALSE.
00556       ELSE
00557          RCEQU = LSAME( EQUED, 'Y' )
00558       ENDIF
00559 *
00560 *     Default is failure.  If an input parameter is wrong or
00561 *     factorization fails, make everything look horrible.  Only the
00562 *     pivot growth is set here, the rest is initialized in ZPORFSX.
00563 *
00564       RPVGRW = ZERO
00565 *
00566 *     Test the input parameters.  PARAMS is not tested until ZPORFSX.
00567 *
00568       IF( .NOT.NOFACT .AND. .NOT.EQUIL .AND. .NOT.
00569      $     LSAME( FACT, 'F' ) ) THEN
00570          INFO = -1
00571       ELSE IF( .NOT.LSAME( UPLO, 'U' ) .AND.
00572      $         .NOT.LSAME( UPLO, 'L' ) ) THEN
00573          INFO = -2
00574       ELSE IF( N.LT.0 ) THEN
00575          INFO = -3
00576       ELSE IF( NRHS.LT.0 ) THEN
00577          INFO = -4
00578       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
00579          INFO = -6
00580       ELSE IF( LDAF.LT.MAX( 1, N ) ) THEN
00581          INFO = -8
00582       ELSE IF( LSAME( FACT, 'F' ) .AND. .NOT.
00583      $        ( RCEQU .OR. LSAME( EQUED, 'N' ) ) ) THEN
00584          INFO = -9
00585       ELSE
00586          IF ( RCEQU ) THEN
00587             SMIN = BIGNUM
00588             SMAX = ZERO
00589             DO 10 J = 1, N
00590                SMIN = MIN( SMIN, S( J ) )
00591                SMAX = MAX( SMAX, S( J ) )
00592  10         CONTINUE
00593             IF( SMIN.LE.ZERO ) THEN
00594                INFO = -10
00595             ELSE IF( N.GT.0 ) THEN
00596                SCOND = MAX( SMIN, SMLNUM ) / MIN( SMAX, BIGNUM )
00597             ELSE
00598                SCOND = ONE
00599             END IF
00600          END IF
00601          IF( INFO.EQ.0 ) THEN
00602             IF( LDB.LT.MAX( 1, N ) ) THEN
00603                INFO = -12
00604             ELSE IF( LDX.LT.MAX( 1, N ) ) THEN
00605                INFO = -14
00606             END IF
00607          END IF
00608       END IF
00609 *
00610       IF( INFO.NE.0 ) THEN
00611          CALL XERBLA( 'ZPOSVXX', -INFO )
00612          RETURN
00613       END IF
00614 *
00615       IF( EQUIL ) THEN
00616 *
00617 *     Compute row and column scalings to equilibrate the matrix A.
00618 *
00619          CALL ZPOEQUB( N, A, LDA, S, SCOND, AMAX, INFEQU )
00620          IF( INFEQU.EQ.0 ) THEN
00621 *
00622 *     Equilibrate the matrix.
00623 *
00624             CALL ZLAQHE( UPLO, N, A, LDA, S, SCOND, AMAX, EQUED )
00625             RCEQU = LSAME( EQUED, 'Y' )
00626          END IF
00627       END IF
00628 *
00629 *     Scale the right-hand side.
00630 *
00631       IF( RCEQU ) CALL ZLASCL2( N, NRHS, S, B, LDB )
00632 *
00633       IF( NOFACT .OR. EQUIL ) THEN
00634 *
00635 *        Compute the Cholesky factorization of A.
00636 *
00637          CALL ZLACPY( UPLO, N, N, A, LDA, AF, LDAF )
00638          CALL ZPOTRF( UPLO, N, AF, LDAF, INFO )
00639 *
00640 *        Return if INFO is non-zero.
00641 *
00642          IF( INFO.GT.0 ) THEN
00643 *
00644 *           Pivot in column INFO is exactly 0
00645 *           Compute the reciprocal pivot growth factor of the
00646 *           leading rank-deficient INFO columns of A.
00647 *
00648             RPVGRW = ZLA_PORPVGRW( UPLO, N, A, LDA, AF, LDAF, RWORK )
00649             RETURN
00650          END IF
00651       END IF
00652 *
00653 *     Compute the reciprocal pivot growth factor RPVGRW.
00654 *
00655       RPVGRW = ZLA_PORPVGRW( UPLO, N, A, LDA, AF, LDAF, RWORK )
00656 *
00657 *     Compute the solution matrix X.
00658 *
00659       CALL ZLACPY( 'Full', N, NRHS, B, LDB, X, LDX )
00660       CALL ZPOTRS( UPLO, N, NRHS, AF, LDAF, X, LDX, INFO )
00661 *
00662 *     Use iterative refinement to improve the computed solution and
00663 *     compute error bounds and backward error estimates for it.
00664 *
00665       CALL ZPORFSX( UPLO, EQUED, N, NRHS, A, LDA, AF, LDAF,
00666      $     S, B, LDB, X, LDX, RCOND, BERR, N_ERR_BNDS, ERR_BNDS_NORM,
00667      $     ERR_BNDS_COMP,  NPARAMS, PARAMS, WORK, RWORK, INFO )
00668 
00669 *
00670 *     Scale solutions.
00671 *
00672       IF ( RCEQU ) THEN
00673          CALL ZLASCL2( N, NRHS, S, X, LDX )
00674       END IF
00675 *
00676       RETURN
00677 *
00678 *     End of ZPOSVXX
00679 *
00680       END
 All Files Functions