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


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