ssysvxx.c
Go to the documentation of this file.
00001 /* ssysvxx.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 ssysvxx_(char *fact, char *uplo, integer *n, integer *
00017         nrhs, real *a, integer *lda, real *af, integer *ldaf, integer *ipiv, 
00018         char *equed, real *s, real *b, integer *ldb, real *x, integer *ldx, 
00019         real *rcond, real *rpvgrw, real *berr, integer *n_err_bnds__, real *
00020         err_bnds_norm__, real *err_bnds_comp__, integer *nparams, real *
00021         params, real *work, integer *iwork, integer *info)
00022 {
00023     /* System generated locals */
00024     integer a_dim1, a_offset, af_dim1, af_offset, b_dim1, b_offset, x_dim1, 
00025             x_offset, err_bnds_norm_dim1, err_bnds_norm_offset, 
00026             err_bnds_comp_dim1, err_bnds_comp_offset, i__1;
00027     real r__1, r__2;
00028 
00029     /* Local variables */
00030     extern /* Subroutine */ int ssyrfsx_(char *, char *, integer *, integer *, 
00031              real *, integer *, real *, integer *, integer *, real *, real *, 
00032             integer *, real *, integer *, real *, real *, integer *, real *, 
00033             real *, integer *, real *, real *, integer *, integer *);
00034     integer j;
00035     real amax, smin, smax;
00036     extern doublereal sla_syrpvgrw__(char *, integer *, integer *, real *, 
00037             integer *, real *, integer *, integer *, real *, ftnlen);
00038     extern logical lsame_(char *, char *);
00039     real scond;
00040     logical equil, rcequ;
00041     extern doublereal slamch_(char *);
00042     logical nofact;
00043     extern /* Subroutine */ int xerbla_(char *, integer *);
00044     real bignum;
00045     integer infequ;
00046     extern /* Subroutine */ int slacpy_(char *, integer *, integer *, real *, 
00047             integer *, real *, integer *);
00048     real smlnum;
00049     extern /* Subroutine */ int slaqsy_(char *, integer *, real *, integer *, 
00050             real *, real *, real *, char *), ssytrf_(char *, 
00051             integer *, real *, integer *, integer *, real *, integer *, 
00052             integer *), slascl2_(integer *, integer *, real *, real *, 
00053              integer *), ssytrs_(char *, integer *, integer *, real *, 
00054             integer *, integer *, real *, integer *, integer *), 
00055             ssyequb_(char *, integer *, real *, integer *, real *, real *, 
00056             real *, real *, integer *);
00057 
00058 
00059 /*     -- LAPACK routine (version 3.2.1)                               -- */
00060 /*     -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and -- */
00061 /*     -- Jason Riedy of Univ. of California Berkeley.                 -- */
00062 /*     -- April 2009                                                   -- */
00063 
00064 /*     -- LAPACK is a software package provided by Univ. of Tennessee, -- */
00065 /*     -- Univ. of California Berkeley and NAG Ltd.                    -- */
00066 
00067 /*     .. */
00068 /*     .. Scalar Arguments .. */
00069 /*     .. */
00070 /*     .. Array Arguments .. */
00071 /*     .. */
00072 
00073 /*     Purpose */
00074 /*     ======= */
00075 
00076 /*     SSYSVXX uses the diagonal pivoting factorization to compute the */
00077 /*     solution to a real system of linear equations A * X = B, where A */
00078 /*     is an N-by-N symmetric matrix and X and B are N-by-NRHS matrices. */
00079 
00080 /*     If requested, both normwise and maximum componentwise error bounds */
00081 /*     are returned. SSYSVXX will return a solution with a tiny */
00082 /*     guaranteed error (O(eps) where eps is the working machine */
00083 /*     precision) unless the matrix is very ill-conditioned, in which */
00084 /*     case a warning is returned. Relevant condition numbers also are */
00085 /*     calculated and returned. */
00086 
00087 /*     SSYSVXX accepts user-provided factorizations and equilibration */
00088 /*     factors; see the definitions of the FACT and EQUED options. */
00089 /*     Solving with refinement and using a factorization from a previous */
00090 /*     SSYSVXX call will also produce a solution with either O(eps) */
00091 /*     errors or warnings, but we cannot make that claim for general */
00092 /*     user-provided factorizations and equilibration factors if they */
00093 /*     differ from what SSYSVXX would itself produce. */
00094 
00095 /*     Description */
00096 /*     =========== */
00097 
00098 /*     The following steps are performed: */
00099 
00100 /*     1. If FACT = 'E', real scaling factors are computed to equilibrate */
00101 /*     the system: */
00102 
00103 /*       diag(S)*A*diag(S)     *inv(diag(S))*X = diag(S)*B */
00104 
00105 /*     Whether or not the system will be equilibrated depends on the */
00106 /*     scaling of the matrix A, but if equilibration is used, A is */
00107 /*     overwritten by diag(S)*A*diag(S) and B by diag(S)*B. */
00108 
00109 /*     2. If FACT = 'N' or 'E', the LU decomposition is used to factor */
00110 /*     the matrix A (after equilibration if FACT = 'E') as */
00111 
00112 /*        A = U * D * U**T,  if UPLO = 'U', or */
00113 /*        A = L * D * L**T,  if UPLO = 'L', */
00114 
00115 /*     where U (or L) is a product of permutation and unit upper (lower) */
00116 /*     triangular matrices, and D is symmetric and block diagonal with */
00117 /*     1-by-1 and 2-by-2 diagonal blocks. */
00118 
00119 /*     3. If some D(i,i)=0, so that D is exactly singular, then the */
00120 /*     routine returns with INFO = i. Otherwise, the factored form of A */
00121 /*     is used to estimate the condition number of the matrix A (see */
00122 /*     argument RCOND).  If the reciprocal of the condition number is */
00123 /*     less than machine precision, the routine still goes on to solve */
00124 /*     for X and compute error bounds as described below. */
00125 
00126 /*     4. The system of equations is solved for X using the factored form */
00127 /*     of A. */
00128 
00129 /*     5. By default (unless PARAMS(LA_LINRX_ITREF_I) is set to zero), */
00130 /*     the routine will use iterative refinement to try to get a small */
00131 /*     error and error bounds.  Refinement calculates the residual to at */
00132 /*     least twice the working precision. */
00133 
00134 /*     6. If equilibration was used, the matrix X is premultiplied by */
00135 /*     diag(R) so that it solves the original system before */
00136 /*     equilibration. */
00137 
00138 /*     Arguments */
00139 /*     ========= */
00140 
00141 /*     Some optional parameters are bundled in the PARAMS array.  These */
00142 /*     settings determine how refinement is performed, but often the */
00143 /*     defaults are acceptable.  If the defaults are acceptable, users */
00144 /*     can pass NPARAMS = 0 which prevents the source code from accessing */
00145 /*     the PARAMS argument. */
00146 
00147 /*     FACT    (input) CHARACTER*1 */
00148 /*     Specifies whether or not the factored form of the matrix A is */
00149 /*     supplied on entry, and if not, whether the matrix A should be */
00150 /*     equilibrated before it is factored. */
00151 /*       = 'F':  On entry, AF and IPIV contain the factored form of A. */
00152 /*               If EQUED is not 'N', the matrix A has been */
00153 /*               equilibrated with scaling factors given by S. */
00154 /*               A, AF, and IPIV are not modified. */
00155 /*       = 'N':  The matrix A will be copied to AF and factored. */
00156 /*       = 'E':  The matrix A will be equilibrated if necessary, then */
00157 /*               copied to AF and factored. */
00158 
00159 /*     UPLO    (input) CHARACTER*1 */
00160 /*       = 'U':  Upper triangle of A is stored; */
00161 /*       = 'L':  Lower triangle of A is stored. */
00162 
00163 /*     N       (input) INTEGER */
00164 /*     The number of linear equations, i.e., the order of the */
00165 /*     matrix A.  N >= 0. */
00166 
00167 /*     NRHS    (input) INTEGER */
00168 /*     The number of right hand sides, i.e., the number of columns */
00169 /*     of the matrices B and X.  NRHS >= 0. */
00170 
00171 /*     A       (input/output) REAL array, dimension (LDA,N) */
00172 /*     The symmetric matrix A.  If UPLO = 'U', the leading N-by-N */
00173 /*     upper triangular part of A contains the upper triangular */
00174 /*     part of the matrix A, and the strictly lower triangular */
00175 /*     part of A is not referenced.  If UPLO = 'L', the leading */
00176 /*     N-by-N lower triangular part of A contains the lower */
00177 /*     triangular part of the matrix A, and the strictly upper */
00178 /*     triangular part of A is not referenced. */
00179 
00180 /*     On exit, if FACT = 'E' and EQUED = 'Y', A is overwritten by */
00181 /*     diag(S)*A*diag(S). */
00182 
00183 /*     LDA     (input) INTEGER */
00184 /*     The leading dimension of the array A.  LDA >= max(1,N). */
00185 
00186 /*     AF      (input or output) REAL array, dimension (LDAF,N) */
00187 /*     If FACT = 'F', then AF is an input argument and on entry */
00188 /*     contains the block diagonal matrix D and the multipliers */
00189 /*     used to obtain the factor U or L from the factorization A = */
00190 /*     U*D*U**T or A = L*D*L**T as computed by SSYTRF. */
00191 
00192 /*     If FACT = 'N', then AF is an output argument and on exit */
00193 /*     returns the block diagonal matrix D and the multipliers */
00194 /*     used to obtain the factor U or L from the factorization A = */
00195 /*     U*D*U**T or A = L*D*L**T. */
00196 
00197 /*     LDAF    (input) INTEGER */
00198 /*     The leading dimension of the array AF.  LDAF >= max(1,N). */
00199 
00200 /*     IPIV    (input or output) INTEGER array, dimension (N) */
00201 /*     If FACT = 'F', then IPIV is an input argument and on entry */
00202 /*     contains details of the interchanges and the block */
00203 /*     structure of D, as determined by SSYTRF.  If IPIV(k) > 0, */
00204 /*     then rows and columns k and IPIV(k) were interchanged and */
00205 /*     D(k,k) is a 1-by-1 diagonal block.  If UPLO = 'U' and */
00206 /*     IPIV(k) = IPIV(k-1) < 0, then rows and columns k-1 and */
00207 /*     -IPIV(k) were interchanged and D(k-1:k,k-1:k) is a 2-by-2 */
00208 /*     diagonal block.  If UPLO = 'L' and IPIV(k) = IPIV(k+1) < 0, */
00209 /*     then rows and columns k+1 and -IPIV(k) were interchanged */
00210 /*     and D(k:k+1,k:k+1) is a 2-by-2 diagonal block. */
00211 
00212 /*     If FACT = 'N', then IPIV is an output argument and on exit */
00213 /*     contains details of the interchanges and the block */
00214 /*     structure of D, as determined by SSYTRF. */
00215 
00216 /*     EQUED   (input or output) CHARACTER*1 */
00217 /*     Specifies the form of equilibration that was done. */
00218 /*       = 'N':  No equilibration (always true if FACT = 'N'). */
00219 /*       = 'Y':  Both row and column equilibration, i.e., A has been */
00220 /*               replaced by diag(S) * A * diag(S). */
00221 /*     EQUED is an input argument if FACT = 'F'; otherwise, it is an */
00222 /*     output argument. */
00223 
00224 /*     S       (input or output) REAL array, dimension (N) */
00225 /*     The scale factors for A.  If EQUED = 'Y', A is multiplied on */
00226 /*     the left and right by diag(S).  S is an input argument if FACT = */
00227 /*     'F'; otherwise, S is an output argument.  If FACT = 'F' and EQUED */
00228 /*     = 'Y', each element of S must be positive.  If S is output, each */
00229 /*     element of S is a power of the radix. If S is input, each element */
00230 /*     of S should be a power of the radix to ensure a reliable solution */
00231 /*     and error estimates. Scaling by powers of the radix does not cause */
00232 /*     rounding errors unless the result underflows or overflows. */
00233 /*     Rounding errors during scaling lead to refining with a matrix that */
00234 /*     is not equivalent to the input matrix, producing error estimates */
00235 /*     that may not be reliable. */
00236 
00237 /*     B       (input/output) REAL array, dimension (LDB,NRHS) */
00238 /*     On entry, the N-by-NRHS right hand side matrix B. */
00239 /*     On exit, */
00240 /*     if EQUED = 'N', B is not modified; */
00241 /*     if EQUED = 'Y', B is overwritten by diag(S)*B; */
00242 
00243 /*     LDB     (input) INTEGER */
00244 /*     The leading dimension of the array B.  LDB >= max(1,N). */
00245 
00246 /*     X       (output) REAL array, dimension (LDX,NRHS) */
00247 /*     If INFO = 0, the N-by-NRHS solution matrix X to the original */
00248 /*     system of equations.  Note that A and B are modified on exit if */
00249 /*     EQUED .ne. 'N', and the solution to the equilibrated system is */
00250 /*     inv(diag(S))*X. */
00251 
00252 /*     LDX     (input) INTEGER */
00253 /*     The leading dimension of the array X.  LDX >= max(1,N). */
00254 
00255 /*     RCOND   (output) REAL */
00256 /*     Reciprocal scaled condition number.  This is an estimate of the */
00257 /*     reciprocal Skeel condition number of the matrix A after */
00258 /*     equilibration (if done).  If this is less than the machine */
00259 /*     precision (in particular, if it is zero), the matrix is singular */
00260 /*     to working precision.  Note that the error may still be small even */
00261 /*     if this number is very small and the matrix appears ill- */
00262 /*     conditioned. */
00263 
00264 /*     RPVGRW  (output) REAL */
00265 /*     Reciprocal pivot growth.  On exit, this contains the reciprocal */
00266 /*     pivot growth factor norm(A)/norm(U). The "max absolute element" */
00267 /*     norm is used.  If this is much less than 1, then the stability of */
00268 /*     the LU factorization of the (equilibrated) matrix A could be poor. */
00269 /*     This also means that the solution X, estimated condition numbers, */
00270 /*     and error bounds could be unreliable. If factorization fails with */
00271 /*     0<INFO<=N, then this contains the reciprocal pivot growth factor */
00272 /*     for the leading INFO columns of A. */
00273 
00274 /*     BERR    (output) REAL array, dimension (NRHS) */
00275 /*     Componentwise relative backward error.  This is the */
00276 /*     componentwise relative backward error of each solution vector X(j) */
00277 /*     (i.e., the smallest relative change in any element of A or B that */
00278 /*     makes X(j) an exact solution). */
00279 
00280 /*     N_ERR_BNDS (input) INTEGER */
00281 /*     Number of error bounds to return for each right hand side */
00282 /*     and each type (normwise or componentwise).  See ERR_BNDS_NORM and */
00283 /*     ERR_BNDS_COMP below. */
00284 
00285 /*     ERR_BNDS_NORM  (output) REAL array, dimension (NRHS, N_ERR_BNDS) */
00286 /*     For each right-hand side, this array contains information about */
00287 /*     various error bounds and condition numbers corresponding to the */
00288 /*     normwise relative error, which is defined as follows: */
00289 
00290 /*     Normwise relative error in the ith solution vector: */
00291 /*             max_j (abs(XTRUE(j,i) - X(j,i))) */
00292 /*            ------------------------------ */
00293 /*                  max_j abs(X(j,i)) */
00294 
00295 /*     The array is indexed by the type of error information as described */
00296 /*     below. There currently are up to three pieces of information */
00297 /*     returned. */
00298 
00299 /*     The first index in ERR_BNDS_NORM(i,:) corresponds to the ith */
00300 /*     right-hand side. */
00301 
00302 /*     The second index in ERR_BNDS_NORM(:,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) * slamch('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) * slamch('Epsilon'). This error bound should only */
00312 /*              be trusted if the previous boolean is true. */
00313 
00314 /*     err = 3  Reciprocal condition number: Estimated normwise */
00315 /*              reciprocal condition number.  Compared with the threshold */
00316 /*              sqrt(n) * slamch('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, where S scales each row by a power of the */
00321 /*              radix so all absolute row sums of Z are approximately 1. */
00322 
00323 /*     See Lapack Working Note 165 for further details and extra */
00324 /*     cautions. */
00325 
00326 /*     ERR_BNDS_COMP  (output) REAL array, dimension (NRHS, N_ERR_BNDS) */
00327 /*     For each right-hand side, this array contains information about */
00328 /*     various error bounds and condition numbers corresponding to the */
00329 /*     componentwise relative error, which is defined as follows: */
00330 
00331 /*     Componentwise relative error in the ith solution vector: */
00332 /*                    abs(XTRUE(j,i) - X(j,i)) */
00333 /*             max_j ---------------------- */
00334 /*                         abs(X(j,i)) */
00335 
00336 /*     The array is indexed by the right-hand side i (on which the */
00337 /*     componentwise relative error depends), and the type of error */
00338 /*     information as described below. There currently are up to three */
00339 /*     pieces of information returned for each right-hand side. If */
00340 /*     componentwise accuracy is not requested (PARAMS(3) = 0.0), then */
00341 /*     ERR_BNDS_COMP is not accessed.  If N_ERR_BNDS .LT. 3, then at most */
00342 /*     the first (:,N_ERR_BNDS) entries are returned. */
00343 
00344 /*     The first index in ERR_BNDS_COMP(i,:) corresponds to the ith */
00345 /*     right-hand side. */
00346 
00347 /*     The second index in ERR_BNDS_COMP(:,err) contains the following */
00348 /*     three fields: */
00349 /*     err = 1 "Trust/don't trust" boolean. Trust the answer if the */
00350 /*              reciprocal condition number is less than the threshold */
00351 /*              sqrt(n) * slamch('Epsilon'). */
00352 
00353 /*     err = 2 "Guaranteed" error bound: The estimated forward error, */
00354 /*              almost certainly within a factor of 10 of the true error */
00355 /*              so long as the next entry is greater than the threshold */
00356 /*              sqrt(n) * slamch('Epsilon'). This error bound should only */
00357 /*              be trusted if the previous boolean is true. */
00358 
00359 /*     err = 3  Reciprocal condition number: Estimated componentwise */
00360 /*              reciprocal condition number.  Compared with the threshold */
00361 /*              sqrt(n) * slamch('Epsilon') to determine if the error */
00362 /*              estimate is "guaranteed". These reciprocal condition */
00363 /*              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some */
00364 /*              appropriately scaled matrix Z. */
00365 /*              Let Z = S*(A*diag(x)), where x is the solution for the */
00366 /*              current right-hand side and S scales each row of */
00367 /*              A*diag(x) by a power of the radix so all absolute row */
00368 /*              sums of Z are approximately 1. */
00369 
00370 /*     See Lapack Working Note 165 for further details and extra */
00371 /*     cautions. */
00372 
00373 /*     NPARAMS (input) INTEGER */
00374 /*     Specifies the number of parameters set in PARAMS.  If .LE. 0, the */
00375 /*     PARAMS array is never referenced and default values are used. */
00376 
00377 /*     PARAMS  (input / output) REAL array, dimension NPARAMS */
00378 /*     Specifies algorithm parameters.  If an entry is .LT. 0.0, then */
00379 /*     that entry will be filled with default value used for that */
00380 /*     parameter.  Only positions up to NPARAMS are accessed; defaults */
00381 /*     are used for higher-numbered parameters. */
00382 
00383 /*       PARAMS(LA_LINRX_ITREF_I = 1) : Whether to perform iterative */
00384 /*            refinement or not. */
00385 /*         Default: 1.0 */
00386 /*            = 0.0 : No refinement is performed, and no error bounds are */
00387 /*                    computed. */
00388 /*            = 1.0 : Use the double-precision refinement algorithm, */
00389 /*                    possibly with doubled-single computations if the */
00390 /*                    compilation environment does not support DOUBLE */
00391 /*                    PRECISION. */
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) REAL array, dimension (4*N) */
00411 
00412 /*     IWORK   (workspace) INTEGER array, dimension (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     --iwork;
00477 
00478     /* Function Body */
00479     *info = 0;
00480     nofact = lsame_(fact, "N");
00481     equil = lsame_(fact, "E");
00482     smlnum = slamch_("Safe minimum");
00483     bignum = 1.f / 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 SSYRFSX. */
00494 
00495     *rpvgrw = 0.f;
00496 
00497 /*     Test the input parameters.  PARAMS is not tested until SSYRFSX. */
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.f;
00519             i__1 = *n;
00520             for (j = 1; j <= i__1; ++j) {
00521 /* Computing MIN */
00522                 r__1 = smin, r__2 = s[j];
00523                 smin = dmin(r__1,r__2);
00524 /* Computing MAX */
00525                 r__1 = smax, r__2 = s[j];
00526                 smax = dmax(r__1,r__2);
00527 /* L10: */
00528             }
00529             if (smin <= 0.f) {
00530                 *info = -10;
00531             } else if (*n > 0) {
00532                 scond = dmax(smin,smlnum) / dmin(smax,bignum);
00533             } else {
00534                 scond = 1.f;
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_("SSYSVXX", &i__1);
00549         return 0;
00550     }
00551 
00552     if (equil) {
00553 
00554 /*     Compute row and column scalings to equilibrate the matrix A. */
00555 
00556         ssyequb_(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             slaqsy_(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         slascl2_(n, nrhs, &s[1], &b[b_offset], ldb);
00571     }
00572 
00573     if (nofact || equil) {
00574 
00575 /*        Compute the LU factorization of A. */
00576 
00577         slacpy_(uplo, n, n, &a[a_offset], lda, &af[af_offset], ldaf);
00578         i__1 = max(1,*n) * 5;
00579         ssytrf_(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 = sla_syrpvgrw__(uplo, n, info, &a[a_offset], lda, &
00592                         af[af_offset], ldaf, &ipiv[1], &work[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 = sla_syrpvgrw__(uplo, n, info, &a[a_offset], lda, &af[
00602                 af_offset], ldaf, &ipiv[1], &work[1], (ftnlen)1);
00603     }
00604 
00605 /*     Compute the solution matrix X. */
00606 
00607     slacpy_("Full", n, nrhs, &b[b_offset], ldb, &x[x_offset], ldx);
00608     ssytrs_(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     ssyrfsx_(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], &iwork[1], info);
00619 
00620 /*     Scale solutions. */
00621 
00622     if (rcequ) {
00623         slascl2_(n, nrhs, &s[1], &x[x_offset], ldx);
00624     }
00625 
00626     return 0;
00627 
00628 /*     End of SSYSVXX */
00629 
00630 } /* ssysvxx_ */


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