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