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