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


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