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