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