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


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:49