LAPACK 3.3.0

zhesvxx.f

Go to the documentation of this file.
00001       SUBROUTINE ZHESVXX( FACT, UPLO, N, NRHS, A, LDA, AF, LDAF, IPIV,
00002      $                    EQUED, S, B, LDB, X, LDX, RCOND, RPVGRW, BERR,
00003      $                    N_ERR_BNDS, ERR_BNDS_NORM, ERR_BNDS_COMP,
00004      $                    NPARAMS, PARAMS, WORK, RWORK, INFO )
00005 *
00006 *     -- LAPACK driver routine (version 3.2.2)                          --
00007 *     -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
00008 *     -- Jason Riedy of Univ. of California Berkeley.                 --
00009 *     -- June 2010                                                    --
00010 *
00011 *     -- LAPACK is a software package provided by Univ. of Tennessee, --
00012 *     -- Univ. of California Berkeley and NAG Ltd.                    --
00013 *
00014       IMPLICIT NONE
00015 *     ..
00016 *     .. Scalar Arguments ..
00017       CHARACTER          EQUED, FACT, UPLO
00018       INTEGER            INFO, LDA, LDAF, LDB, LDX, N, NRHS, NPARAMS,
00019      $                   N_ERR_BNDS
00020       DOUBLE PRECISION   RCOND, RPVGRW
00021 *     ..
00022 *     .. Array Arguments ..
00023       INTEGER            IPIV( * )
00024       COMPLEX*16         A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
00025      $                   WORK( * ), X( LDX, * )
00026       DOUBLE PRECISION   S( * ), PARAMS( * ), BERR( * ), RWORK( * ),
00027      $                   ERR_BNDS_NORM( NRHS, * ),
00028      $                   ERR_BNDS_COMP( NRHS, * )
00029 *     ..
00030 *
00031 *     Purpose
00032 *     =======
00033 *
00034 *     ZHESVXX uses the diagonal pivoting factorization to compute the
00035 *     solution to a complex*16 system of linear equations A * X = B, where
00036 *     A is an N-by-N symmetric matrix and X and B are N-by-NRHS
00037 *     matrices.
00038 *
00039 *     If requested, both normwise and maximum componentwise error bounds
00040 *     are returned. ZHESVXX will return a solution with a tiny
00041 *     guaranteed error (O(eps) where eps is the working machine
00042 *     precision) unless the matrix is very ill-conditioned, in which
00043 *     case a warning is returned. Relevant condition numbers also are
00044 *     calculated and returned.
00045 *
00046 *     ZHESVXX accepts user-provided factorizations and equilibration
00047 *     factors; see the definitions of the FACT and EQUED options.
00048 *     Solving with refinement and using a factorization from a previous
00049 *     ZHESVXX call will also produce a solution with either O(eps)
00050 *     errors or warnings, but we cannot make that claim for general
00051 *     user-provided factorizations and equilibration factors if they
00052 *     differ from what ZHESVXX would itself produce.
00053 *
00054 *     Description
00055 *     ===========
00056 *
00057 *     The following steps are performed:
00058 *
00059 *     1. If FACT = 'E', double precision scaling factors are computed to equilibrate
00060 *     the system:
00061 *
00062 *       diag(S)*A*diag(S)     *inv(diag(S))*X = diag(S)*B
00063 *
00064 *     Whether or not the system will be equilibrated depends on the
00065 *     scaling of the matrix A, but if equilibration is used, A is
00066 *     overwritten by diag(S)*A*diag(S) and B by diag(S)*B.
00067 *
00068 *     2. If FACT = 'N' or 'E', the LU decomposition is used to factor
00069 *     the matrix A (after equilibration if FACT = 'E') as
00070 *
00071 *        A = U * D * U**T,  if UPLO = 'U', or
00072 *        A = L * D * L**T,  if UPLO = 'L',
00073 *
00074 *     where U (or L) is a product of permutation and unit upper (lower)
00075 *     triangular matrices, and D is symmetric and block diagonal with
00076 *     1-by-1 and 2-by-2 diagonal blocks.
00077 *
00078 *     3. If some D(i,i)=0, so that D is exactly singular, then the
00079 *     routine returns with INFO = i. Otherwise, the factored form of A
00080 *     is used to estimate the condition number of the matrix A (see
00081 *     argument RCOND).  If the reciprocal of the condition number is
00082 *     less than machine precision, the routine still goes on to solve
00083 *     for X and compute error bounds as described below.
00084 *
00085 *     4. The system of equations is solved for X using the factored form
00086 *     of A.
00087 *
00088 *     5. By default (unless PARAMS(LA_LINRX_ITREF_I) is set to zero),
00089 *     the routine will use iterative refinement to try to get a small
00090 *     error and error bounds.  Refinement calculates the residual to at
00091 *     least twice the working precision.
00092 *
00093 *     6. If equilibration was used, the matrix X is premultiplied by
00094 *     diag(R) so that it solves the original system before
00095 *     equilibration.
00096 *
00097 *     Arguments
00098 *     =========
00099 *
00100 *     Some optional parameters are bundled in the PARAMS array.  These
00101 *     settings determine how refinement is performed, but often the
00102 *     defaults are acceptable.  If the defaults are acceptable, users
00103 *     can pass NPARAMS = 0 which prevents the source code from accessing
00104 *     the PARAMS argument.
00105 *
00106 *     FACT    (input) CHARACTER*1
00107 *     Specifies whether or not the factored form of the matrix A is
00108 *     supplied on entry, and if not, whether the matrix A should be
00109 *     equilibrated before it is factored.
00110 *       = 'F':  On entry, AF and IPIV contain the factored form of A.
00111 *               If EQUED is not 'N', the matrix A has been
00112 *               equilibrated with scaling factors given by S.
00113 *               A, AF, and IPIV are not modified.
00114 *       = 'N':  The matrix A will be copied to AF and factored.
00115 *       = 'E':  The matrix A will be equilibrated if necessary, then
00116 *               copied to AF and factored.
00117 *
00118 *     N       (input) INTEGER
00119 *     The number of linear equations, i.e., the order of the
00120 *     matrix A.  N >= 0.
00121 *
00122 *     NRHS    (input) INTEGER
00123 *     The number of right hand sides, i.e., the number of columns
00124 *     of the matrices B and X.  NRHS >= 0.
00125 *
00126 *     A       (input/output) COMPLEX*16 array, dimension (LDA,N)
00127 *     The symmetric matrix A.  If UPLO = 'U', the leading N-by-N
00128 *     upper triangular part of A contains the upper triangular
00129 *     part of the matrix A, and the strictly lower triangular
00130 *     part of A is not referenced.  If UPLO = 'L', the leading
00131 *     N-by-N lower triangular part of A contains the lower
00132 *     triangular part of the matrix A, and the strictly upper
00133 *     triangular part of A is not referenced.
00134 *
00135 *     On exit, if FACT = 'E' and EQUED = 'Y', A is overwritten by
00136 *     diag(S)*A*diag(S).
00137 *
00138 *     LDA     (input) INTEGER
00139 *     The leading dimension of the array A.  LDA >= max(1,N).
00140 *
00141 *     AF      (input or output) COMPLEX*16 array, dimension (LDAF,N)
00142 *     If FACT = 'F', then AF is an input argument and on entry
00143 *     contains the block diagonal matrix D and the multipliers
00144 *     used to obtain the factor U or L from the factorization A =
00145 *     U*D*U**T or A = L*D*L**T as computed by DSYTRF.
00146 *
00147 *     If FACT = 'N', then AF is an output argument and on exit
00148 *     returns the block diagonal matrix D and the multipliers
00149 *     used to obtain the factor U or L from the factorization A =
00150 *     U*D*U**T or A = L*D*L**T.
00151 *
00152 *     LDAF    (input) INTEGER
00153 *     The leading dimension of the array AF.  LDAF >= max(1,N).
00154 *
00155 *     IPIV    (input or output) INTEGER array, dimension (N)
00156 *     If FACT = 'F', then IPIV is an input argument and on entry
00157 *     contains details of the interchanges and the block
00158 *     structure of D, as determined by ZHETRF.  If IPIV(k) > 0,
00159 *     then rows and columns k and IPIV(k) were interchanged and
00160 *     D(k,k) is a 1-by-1 diagonal block.  If UPLO = 'U' and
00161 *     IPIV(k) = IPIV(k-1) < 0, then rows and columns k-1 and
00162 *     -IPIV(k) were interchanged and D(k-1:k,k-1:k) is a 2-by-2
00163 *     diagonal block.  If UPLO = 'L' and IPIV(k) = IPIV(k+1) < 0,
00164 *     then rows and columns k+1 and -IPIV(k) were interchanged
00165 *     and D(k:k+1,k:k+1) is a 2-by-2 diagonal block.
00166 *
00167 *     If FACT = 'N', then IPIV is an output argument and on exit
00168 *     contains details of the interchanges and the block
00169 *     structure of D, as determined by ZHETRF.
00170 *
00171 *     EQUED   (input or output) CHARACTER*1
00172 *     Specifies the form of equilibration that was done.
00173 *       = 'N':  No equilibration (always true if FACT = 'N').
00174 *       = 'Y':  Both row and column equilibration, i.e., A has been
00175 *               replaced by diag(S) * A * diag(S).
00176 *     EQUED is an input argument if FACT = 'F'; otherwise, it is an
00177 *     output argument.
00178 *
00179 *     S       (input or output) DOUBLE PRECISION array, dimension (N)
00180 *     The scale factors for A.  If EQUED = 'Y', A is multiplied on
00181 *     the left and right by diag(S).  S is an input argument if FACT =
00182 *     'F'; otherwise, S is an output argument.  If FACT = 'F' and EQUED
00183 *     = 'Y', each element of S must be positive.  If S is output, each
00184 *     element of S is a power of the radix. If S is input, each element
00185 *     of S should be a power of the radix to ensure a reliable solution
00186 *     and error estimates. Scaling by powers of the radix does not cause
00187 *     rounding errors unless the result underflows or overflows.
00188 *     Rounding errors during scaling lead to refining with a matrix that
00189 *     is not equivalent to the input matrix, producing error estimates
00190 *     that may not be reliable.
00191 *
00192 *     B       (input/output) COMPLEX*16 array, dimension (LDB,NRHS)
00193 *     On entry, the N-by-NRHS right hand side matrix B.
00194 *     On exit,
00195 *     if EQUED = 'N', B is not modified;
00196 *     if EQUED = 'Y', B is overwritten by diag(S)*B;
00197 *
00198 *     LDB     (input) INTEGER
00199 *     The leading dimension of the array B.  LDB >= max(1,N).
00200 *
00201 *     X       (output) COMPLEX*16 array, dimension (LDX,NRHS)
00202 *     If INFO = 0, the N-by-NRHS solution matrix X to the original
00203 *     system of equations.  Note that A and B are modified on exit if
00204 *     EQUED .ne. 'N', and the solution to the equilibrated system is
00205 *     inv(diag(S))*X.
00206 *
00207 *     LDX     (input) INTEGER
00208 *     The leading dimension of the array X.  LDX >= max(1,N).
00209 *
00210 *     RCOND   (output) DOUBLE PRECISION
00211 *     Reciprocal scaled condition number.  This is an estimate of the
00212 *     reciprocal Skeel condition number of the matrix A after
00213 *     equilibration (if done).  If this is less than the machine
00214 *     precision (in particular, if it is zero), the matrix is singular
00215 *     to working precision.  Note that the error may still be small even
00216 *     if this number is very small and the matrix appears ill-
00217 *     conditioned.
00218 *
00219 *     RPVGRW  (output) DOUBLE PRECISION
00220 *     Reciprocal pivot growth.  On exit, this contains the reciprocal
00221 *     pivot growth factor norm(A)/norm(U). The "max absolute element"
00222 *     norm is used.  If this is much less than 1, then the stability of
00223 *     the LU factorization of the (equilibrated) matrix A could be poor.
00224 *     This also means that the solution X, estimated condition numbers,
00225 *     and error bounds could be unreliable. If factorization fails with
00226 *     0<INFO<=N, then this contains the reciprocal pivot growth factor
00227 *     for the leading INFO columns of A.
00228 *
00229 *     BERR    (output) DOUBLE PRECISION array, dimension (NRHS)
00230 *     Componentwise relative backward error.  This is the
00231 *     componentwise relative backward error of each solution vector X(j)
00232 *     (i.e., the smallest relative change in any element of A or B that
00233 *     makes X(j) an exact solution).
00234 *
00235 *     N_ERR_BNDS (input) INTEGER
00236 *     Number of error bounds to return for each right hand side
00237 *     and each type (normwise or componentwise).  See ERR_BNDS_NORM and
00238 *     ERR_BNDS_COMP below.
00239 *
00240 *     ERR_BNDS_NORM  (output) DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS)
00241 *     For each right-hand side, this array contains information about
00242 *     various error bounds and condition numbers corresponding to the
00243 *     normwise relative error, which is defined as follows:
00244 *
00245 *     Normwise relative error in the ith solution vector:
00246 *             max_j (abs(XTRUE(j,i) - X(j,i)))
00247 *            ------------------------------
00248 *                  max_j abs(X(j,i))
00249 *
00250 *     The array is indexed by the type of error information as described
00251 *     below. There currently are up to three pieces of information
00252 *     returned.
00253 *
00254 *     The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
00255 *     right-hand side.
00256 *
00257 *     The second index in ERR_BNDS_NORM(:,err) contains the following
00258 *     three fields:
00259 *     err = 1 "Trust/don't trust" boolean. Trust the answer if the
00260 *              reciprocal condition number is less than the threshold
00261 *              sqrt(n) * dlamch('Epsilon').
00262 *
00263 *     err = 2 "Guaranteed" error bound: The estimated forward error,
00264 *              almost certainly within a factor of 10 of the true error
00265 *              so long as the next entry is greater than the threshold
00266 *              sqrt(n) * dlamch('Epsilon'). This error bound should only
00267 *              be trusted if the previous boolean is true.
00268 *
00269 *     err = 3  Reciprocal condition number: Estimated normwise
00270 *              reciprocal condition number.  Compared with the threshold
00271 *              sqrt(n) * dlamch('Epsilon') to determine if the error
00272 *              estimate is "guaranteed". These reciprocal condition
00273 *              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
00274 *              appropriately scaled matrix Z.
00275 *              Let Z = S*A, where S scales each row by a power of the
00276 *              radix so all absolute row sums of Z are approximately 1.
00277 *
00278 *     See Lapack Working Note 165 for further details and extra
00279 *     cautions.
00280 *
00281 *     ERR_BNDS_COMP  (output) DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS)
00282 *     For each right-hand side, this array contains information about
00283 *     various error bounds and condition numbers corresponding to the
00284 *     componentwise relative error, which is defined as follows:
00285 *
00286 *     Componentwise relative error in the ith solution vector:
00287 *                    abs(XTRUE(j,i) - X(j,i))
00288 *             max_j ----------------------
00289 *                         abs(X(j,i))
00290 *
00291 *     The array is indexed by the right-hand side i (on which the
00292 *     componentwise relative error depends), and the type of error
00293 *     information as described below. There currently are up to three
00294 *     pieces of information returned for each right-hand side. If
00295 *     componentwise accuracy is not requested (PARAMS(3) = 0.0), then
00296 *     ERR_BNDS_COMP is not accessed.  If N_ERR_BNDS .LT. 3, then at most
00297 *     the first (:,N_ERR_BNDS) entries are returned.
00298 *
00299 *     The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
00300 *     right-hand side.
00301 *
00302 *     The second index in ERR_BNDS_COMP(:,err) contains the following
00303 *     three fields:
00304 *     err = 1 "Trust/don't trust" boolean. Trust the answer if the
00305 *              reciprocal condition number is less than the threshold
00306 *              sqrt(n) * dlamch('Epsilon').
00307 *
00308 *     err = 2 "Guaranteed" error bound: The estimated forward error,
00309 *              almost certainly within a factor of 10 of the true error
00310 *              so long as the next entry is greater than the threshold
00311 *              sqrt(n) * dlamch('Epsilon'). This error bound should only
00312 *              be trusted if the previous boolean is true.
00313 *
00314 *     err = 3  Reciprocal condition number: Estimated componentwise
00315 *              reciprocal condition number.  Compared with the threshold
00316 *              sqrt(n) * dlamch('Epsilon') to determine if the error
00317 *              estimate is "guaranteed". These reciprocal condition
00318 *              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
00319 *              appropriately scaled matrix Z.
00320 *              Let Z = S*(A*diag(x)), where x is the solution for the
00321 *              current right-hand side and S scales each row of
00322 *              A*diag(x) by a power of the radix so all absolute row
00323 *              sums of Z are approximately 1.
00324 *
00325 *     See Lapack Working Note 165 for further details and extra
00326 *     cautions.
00327 *
00328 *     NPARAMS (input) INTEGER
00329 *     Specifies the number of parameters set in PARAMS.  If .LE. 0, the
00330 *     PARAMS array is never referenced and default values are used.
00331 *
00332 *     PARAMS  (input / output) DOUBLE PRECISION array, dimension NPARAMS
00333 *     Specifies algorithm parameters.  If an entry is .LT. 0.0, then
00334 *     that entry will be filled with default value used for that
00335 *     parameter.  Only positions up to NPARAMS are accessed; defaults
00336 *     are used for higher-numbered parameters.
00337 *
00338 *       PARAMS(LA_LINRX_ITREF_I = 1) : Whether to perform iterative
00339 *            refinement or not.
00340 *         Default: 1.0D+0
00341 *            = 0.0 : No refinement is performed, and no error bounds are
00342 *                    computed.
00343 *            = 1.0 : Use the extra-precise refinement algorithm.
00344 *              (other values are reserved for future use)
00345 *
00346 *       PARAMS(LA_LINRX_ITHRESH_I = 2) : Maximum number of residual
00347 *            computations allowed for refinement.
00348 *         Default: 10
00349 *         Aggressive: Set to 100 to permit convergence using approximate
00350 *                     factorizations or factorizations other than LU. If
00351 *                     the factorization uses a technique other than
00352 *                     Gaussian elimination, the guarantees in
00353 *                     err_bnds_norm and err_bnds_comp may no longer be
00354 *                     trustworthy.
00355 *
00356 *       PARAMS(LA_LINRX_CWISE_I = 3) : Flag determining if the code
00357 *            will attempt to find a solution with small componentwise
00358 *            relative error in the double-precision algorithm.  Positive
00359 *            is true, 0.0 is false.
00360 *         Default: 1.0 (attempt componentwise convergence)
00361 *
00362 *     WORK    (workspace) COMPLEX*16 array, dimension (2*N)
00363 *
00364 *     RWORK   (workspace) DOUBLE PRECISION array, dimension (2*N)
00365 *
00366 *     INFO    (output) INTEGER
00367 *       = 0:  Successful exit. The solution to every right-hand side is
00368 *         guaranteed.
00369 *       < 0:  If INFO = -i, the i-th argument had an illegal value
00370 *       > 0 and <= N:  U(INFO,INFO) is exactly zero.  The factorization
00371 *         has been completed, but the factor U is exactly singular, so
00372 *         the solution and error bounds could not be computed. RCOND = 0
00373 *         is returned.
00374 *       = N+J: The solution corresponding to the Jth right-hand side is
00375 *         not guaranteed. The solutions corresponding to other right-
00376 *         hand sides K with K > J may not be guaranteed as well, but
00377 *         only the first such right-hand side is reported. If a small
00378 *         componentwise error is not requested (PARAMS(3) = 0.0) then
00379 *         the Jth right-hand side is the first with a normwise error
00380 *         bound that is not guaranteed (the smallest J such
00381 *         that ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0)
00382 *         the Jth right-hand side is the first with either a normwise or
00383 *         componentwise error bound that is not guaranteed (the smallest
00384 *         J such that either ERR_BNDS_NORM(J,1) = 0.0 or
00385 *         ERR_BNDS_COMP(J,1) = 0.0). See the definition of
00386 *         ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information
00387 *         about all of the right-hand sides check ERR_BNDS_NORM or
00388 *         ERR_BNDS_COMP.
00389 *
00390 *     ==================================================================
00391 *
00392 *     .. Parameters ..
00393       DOUBLE PRECISION   ZERO, ONE
00394       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
00395       INTEGER            FINAL_NRM_ERR_I, FINAL_CMP_ERR_I, BERR_I
00396       INTEGER            RCOND_I, NRM_RCOND_I, NRM_ERR_I, CMP_RCOND_I
00397       INTEGER            CMP_ERR_I, PIV_GROWTH_I
00398       PARAMETER          ( FINAL_NRM_ERR_I = 1, FINAL_CMP_ERR_I = 2,
00399      $                   BERR_I = 3 )
00400       PARAMETER          ( RCOND_I = 4, NRM_RCOND_I = 5, NRM_ERR_I = 6 )
00401       PARAMETER          ( CMP_RCOND_I = 7, CMP_ERR_I = 8,
00402      $                   PIV_GROWTH_I = 9 )
00403 *     ..
00404 *     .. Local Scalars ..
00405       LOGICAL            EQUIL, NOFACT, RCEQU
00406       INTEGER            INFEQU, J
00407       DOUBLE PRECISION   AMAX, BIGNUM, SMIN, SMAX, SCOND, SMLNUM
00408 *     ..
00409 *     .. External Functions ..
00410       EXTERNAL           LSAME, DLAMCH,  ZLA_HERPVGRW
00411       LOGICAL            LSAME
00412       DOUBLE PRECISION   DLAMCH, ZLA_HERPVGRW
00413 *     ..
00414 *     .. External Subroutines ..
00415       EXTERNAL           ZHECON, ZHEEQUB, ZHETRF, ZHETRS, ZLACPY,
00416      $                   ZLAQHE, XERBLA, ZLASCL2, ZHERFSX
00417 *     ..
00418 *     .. Intrinsic Functions ..
00419       INTRINSIC          MAX, MIN
00420 *     ..
00421 *     .. Executable Statements ..
00422 *
00423       INFO = 0
00424       NOFACT = LSAME( FACT, 'N' )
00425       EQUIL = LSAME( FACT, 'E' )
00426       SMLNUM = DLAMCH( 'Safe minimum' )
00427       BIGNUM = ONE / SMLNUM
00428       IF( NOFACT .OR. EQUIL ) THEN
00429          EQUED = 'N'
00430          RCEQU = .FALSE.
00431       ELSE
00432          RCEQU = LSAME( EQUED, 'Y' )
00433       ENDIF
00434 *
00435 *     Default is failure.  If an input parameter is wrong or
00436 *     factorization fails, make everything look horrible.  Only the
00437 *     pivot growth is set here, the rest is initialized in ZHERFSX.
00438 *
00439       RPVGRW = ZERO
00440 *
00441 *     Test the input parameters.  PARAMS is not tested until ZHERFSX.
00442 *
00443       IF( .NOT.NOFACT .AND. .NOT.EQUIL .AND. .NOT.
00444      $     LSAME( FACT, 'F' ) ) THEN
00445          INFO = -1
00446       ELSE IF( .NOT.LSAME( UPLO, 'U' ) .AND.
00447      $         .NOT.LSAME( UPLO, 'L' ) ) THEN
00448          INFO = -2
00449       ELSE IF( N.LT.0 ) THEN
00450          INFO = -3
00451       ELSE IF( NRHS.LT.0 ) THEN
00452          INFO = -4
00453       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
00454          INFO = -6
00455       ELSE IF( LDAF.LT.MAX( 1, N ) ) THEN
00456          INFO = -8
00457       ELSE IF( LSAME( FACT, 'F' ) .AND. .NOT.
00458      $        ( RCEQU .OR. LSAME( EQUED, 'N' ) ) ) THEN
00459          INFO = -9
00460       ELSE
00461          IF ( RCEQU ) THEN
00462             SMIN = BIGNUM
00463             SMAX = ZERO
00464             DO 10 J = 1, N
00465                SMIN = MIN( SMIN, S( J ) )
00466                SMAX = MAX( SMAX, S( J ) )
00467  10         CONTINUE
00468             IF( SMIN.LE.ZERO ) THEN
00469                INFO = -10
00470             ELSE IF( N.GT.0 ) THEN
00471                SCOND = MAX( SMIN, SMLNUM ) / MIN( SMAX, BIGNUM )
00472             ELSE
00473                SCOND = ONE
00474             END IF
00475          END IF
00476          IF( INFO.EQ.0 ) THEN
00477             IF( LDB.LT.MAX( 1, N ) ) THEN
00478                INFO = -12
00479             ELSE IF( LDX.LT.MAX( 1, N ) ) THEN
00480                INFO = -14
00481             END IF
00482          END IF
00483       END IF
00484 *
00485       IF( INFO.NE.0 ) THEN
00486          CALL XERBLA( 'ZHESVXX', -INFO )
00487          RETURN
00488       END IF
00489 *
00490       IF( EQUIL ) THEN
00491 *
00492 *     Compute row and column scalings to equilibrate the matrix A.
00493 *
00494          CALL ZHEEQUB( UPLO, N, A, LDA, S, SCOND, AMAX, WORK, INFEQU )
00495          IF( INFEQU.EQ.0 ) THEN
00496 *
00497 *     Equilibrate the matrix.
00498 *
00499             CALL ZLAQHE( UPLO, N, A, LDA, S, SCOND, AMAX, EQUED )
00500             RCEQU = LSAME( EQUED, 'Y' )
00501          END IF
00502       END IF
00503 *
00504 *     Scale the right-hand side.
00505 *
00506       IF( RCEQU ) CALL ZLASCL2( N, NRHS, S, B, LDB )
00507 *
00508       IF( NOFACT .OR. EQUIL ) THEN
00509 *
00510 *        Compute the LDL^T or UDU^T factorization of A.
00511 *
00512          CALL ZLACPY( UPLO, N, N, A, LDA, AF, LDAF )
00513          CALL ZHETRF( UPLO, N, AF, LDAF, IPIV, WORK, 5*MAX(1,N), INFO )
00514 *
00515 *        Return if INFO is non-zero.
00516 *
00517          IF( INFO.GT.0 ) THEN
00518 *
00519 *           Pivot in column INFO is exactly 0
00520 *           Compute the reciprocal pivot growth factor of the
00521 *           leading rank-deficient INFO columns of A.
00522 *
00523             IF( N.GT.0 )
00524      $           RPVGRW = ZLA_HERPVGRW( UPLO, N, INFO, A, LDA, AF, LDAF,
00525      $           IPIV, RWORK )
00526             RETURN
00527          END IF
00528       END IF
00529 *
00530 *     Compute the reciprocal pivot growth factor RPVGRW.
00531 *
00532       IF( N.GT.0 )
00533      $     RPVGRW = ZLA_HERPVGRW( UPLO, N, INFO, A, LDA, AF, LDAF, IPIV,
00534      $     RWORK )
00535 *
00536 *     Compute the solution matrix X.
00537 *
00538       CALL ZLACPY( 'Full', N, NRHS, B, LDB, X, LDX )
00539       CALL ZHETRS( UPLO, N, NRHS, AF, LDAF, IPIV, X, LDX, INFO )
00540 *
00541 *     Use iterative refinement to improve the computed solution and
00542 *     compute error bounds and backward error estimates for it.
00543 *
00544       CALL ZHERFSX( UPLO, EQUED, N, NRHS, A, LDA, AF, LDAF, IPIV,
00545      $     S, B, LDB, X, LDX, RCOND, BERR, N_ERR_BNDS, ERR_BNDS_NORM,
00546      $     ERR_BNDS_COMP, NPARAMS, PARAMS, WORK, RWORK, INFO )
00547 *
00548 *     Scale solutions.
00549 *
00550       IF ( RCEQU ) THEN
00551          CALL ZLASCL2 ( N, NRHS, S, X, LDX )
00552       END IF
00553 *
00554       RETURN
00555 *
00556 *     End of ZHESVXX
00557 *
00558       END
 All Files Functions