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


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:37