File:  [local] / rpl / lapack / lapack / dporfsx.f
Revision 1.3: download - view: text, annotated - select for diffs - revision graph
Fri Aug 13 21:03:55 2010 UTC (13 years, 9 months ago) by bertrand
Branches: MAIN
CVS tags: rpl-4_0_19, rpl-4_0_18, HEAD
Patches pour OS/2

    1:       SUBROUTINE DPORFSX( UPLO, EQUED, N, NRHS, A, LDA, AF, LDAF, S, B,
    2:      $                    LDB, X, LDX, RCOND, BERR, N_ERR_BNDS,
    3:      $                    ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS,
    4:      $                    WORK, IWORK, INFO )
    5: *
    6: *     -- LAPACK routine (version 3.2.2)                                 --
    7: *     -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
    8: *     -- Jason Riedy of Univ. of California Berkeley.                 --
    9: *     -- June 2010                                                    --
   10: *
   11: *     -- LAPACK is a software package provided by Univ. of Tennessee, --
   12: *     -- Univ. of California Berkeley and NAG Ltd.                    --
   13: *
   14:       IMPLICIT NONE
   15: *     ..
   16: *     .. Scalar Arguments ..
   17:       CHARACTER          UPLO, EQUED
   18:       INTEGER            INFO, LDA, LDAF, LDB, LDX, N, NRHS, NPARAMS,
   19:      $                   N_ERR_BNDS
   20:       DOUBLE PRECISION   RCOND
   21: *     ..
   22: *     .. Array Arguments ..
   23:       INTEGER            IWORK( * )
   24:       DOUBLE PRECISION   A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
   25:      $                   X( LDX, * ), WORK( * )
   26:       DOUBLE PRECISION   S( * ), PARAMS( * ), BERR( * ),
   27:      $                   ERR_BNDS_NORM( NRHS, * ),
   28:      $                   ERR_BNDS_COMP( NRHS, * )
   29: *     ..
   30: *
   31: *     Purpose
   32: *     =======
   33: *
   34: *     DPORFSX improves the computed solution to a system of linear
   35: *     equations when the coefficient matrix is symmetric positive
   36: *     definite, and provides error bounds and backward error estimates
   37: *     for the solution.  In addition to normwise error bound, the code
   38: *     provides maximum componentwise error bound if possible.  See
   39: *     comments for ERR_BNDS_NORM and ERR_BNDS_COMP for details of the
   40: *     error bounds.
   41: *
   42: *     The original system of linear equations may have been equilibrated
   43: *     before calling this routine, as described by arguments EQUED and S
   44: *     below. In this case, the solution and error bounds returned are
   45: *     for the original unequilibrated system.
   46: *
   47: *     Arguments
   48: *     =========
   49: *
   50: *     Some optional parameters are bundled in the PARAMS array.  These
   51: *     settings determine how refinement is performed, but often the
   52: *     defaults are acceptable.  If the defaults are acceptable, users
   53: *     can pass NPARAMS = 0 which prevents the source code from accessing
   54: *     the PARAMS argument.
   55: *
   56: *     UPLO    (input) CHARACTER*1
   57: *       = 'U':  Upper triangle of A is stored;
   58: *       = 'L':  Lower triangle of A is stored.
   59: *
   60: *     EQUED   (input) CHARACTER*1
   61: *     Specifies the form of equilibration that was done to A
   62: *     before calling this routine. This is needed to compute
   63: *     the solution and error bounds correctly.
   64: *       = 'N':  No equilibration
   65: *       = 'Y':  Both row and column equilibration, i.e., A has been
   66: *               replaced by diag(S) * A * diag(S).
   67: *               The right hand side B has been changed accordingly.
   68: *
   69: *     N       (input) INTEGER
   70: *     The order of the matrix A.  N >= 0.
   71: *
   72: *     NRHS    (input) INTEGER
   73: *     The number of right hand sides, i.e., the number of columns
   74: *     of the matrices B and X.  NRHS >= 0.
   75: *
   76: *     A       (input) DOUBLE PRECISION array, dimension (LDA,N)
   77: *     The symmetric matrix A.  If UPLO = 'U', the leading N-by-N
   78: *     upper triangular part of A contains the upper triangular part
   79: *     of the matrix A, and the strictly lower triangular part of A
   80: *     is not referenced.  If UPLO = 'L', the leading N-by-N lower
   81: *     triangular part of A contains the lower triangular part of
   82: *     the matrix A, and the strictly upper triangular part of A is
   83: *     not referenced.
   84: *
   85: *     LDA     (input) INTEGER
   86: *     The leading dimension of the array A.  LDA >= max(1,N).
   87: *
   88: *     AF      (input) DOUBLE PRECISION array, dimension (LDAF,N)
   89: *     The triangular factor U or L from the Cholesky factorization
   90: *     A = U**T*U or A = L*L**T, as computed by DPOTRF.
   91: *
   92: *     LDAF    (input) INTEGER
   93: *     The leading dimension of the array AF.  LDAF >= max(1,N).
   94: *
   95: *     S       (input or output) DOUBLE PRECISION array, dimension (N)
   96: *     The row scale factors for A.  If EQUED = 'Y', A is multiplied on
   97: *     the left and right by diag(S).  S is an input argument if FACT =
   98: *     'F'; otherwise, S is an output argument.  If FACT = 'F' and EQUED
   99: *     = 'Y', each element of S must be positive.  If S is output, each
  100: *     element of S is a power of the radix. If S is input, each element
  101: *     of S should be a power of the radix to ensure a reliable solution
  102: *     and error estimates. Scaling by powers of the radix does not cause
  103: *     rounding errors unless the result underflows or overflows.
  104: *     Rounding errors during scaling lead to refining with a matrix that
  105: *     is not equivalent to the input matrix, producing error estimates
  106: *     that may not be reliable.
  107: *
  108: *     B       (input) DOUBLE PRECISION array, dimension (LDB,NRHS)
  109: *     The right hand side matrix B.
  110: *
  111: *     LDB     (input) INTEGER
  112: *     The leading dimension of the array B.  LDB >= max(1,N).
  113: *
  114: *     X       (input/output) DOUBLE PRECISION array, dimension (LDX,NRHS)
  115: *     On entry, the solution matrix X, as computed by DGETRS.
  116: *     On exit, the improved solution matrix X.
  117: *
  118: *     LDX     (input) INTEGER
  119: *     The leading dimension of the array X.  LDX >= max(1,N).
  120: *
  121: *     RCOND   (output) DOUBLE PRECISION
  122: *     Reciprocal scaled condition number.  This is an estimate of the
  123: *     reciprocal Skeel condition number of the matrix A after
  124: *     equilibration (if done).  If this is less than the machine
  125: *     precision (in particular, if it is zero), the matrix is singular
  126: *     to working precision.  Note that the error may still be small even
  127: *     if this number is very small and the matrix appears ill-
  128: *     conditioned.
  129: *
  130: *     BERR    (output) DOUBLE PRECISION array, dimension (NRHS)
  131: *     Componentwise relative backward error.  This is the
  132: *     componentwise relative backward error of each solution vector X(j)
  133: *     (i.e., the smallest relative change in any element of A or B that
  134: *     makes X(j) an exact solution).
  135: *
  136: *     N_ERR_BNDS (input) INTEGER
  137: *     Number of error bounds to return for each right hand side
  138: *     and each type (normwise or componentwise).  See ERR_BNDS_NORM and
  139: *     ERR_BNDS_COMP below.
  140: *
  141: *     ERR_BNDS_NORM  (output) DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS)
  142: *     For each right-hand side, this array contains information about
  143: *     various error bounds and condition numbers corresponding to the
  144: *     normwise relative error, which is defined as follows:
  145: *
  146: *     Normwise relative error in the ith solution vector:
  147: *             max_j (abs(XTRUE(j,i) - X(j,i)))
  148: *            ------------------------------
  149: *                  max_j abs(X(j,i))
  150: *
  151: *     The array is indexed by the type of error information as described
  152: *     below. There currently are up to three pieces of information
  153: *     returned.
  154: *
  155: *     The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
  156: *     right-hand side.
  157: *
  158: *     The second index in ERR_BNDS_NORM(:,err) contains the following
  159: *     three fields:
  160: *     err = 1 "Trust/don't trust" boolean. Trust the answer if the
  161: *              reciprocal condition number is less than the threshold
  162: *              sqrt(n) * dlamch('Epsilon').
  163: *
  164: *     err = 2 "Guaranteed" error bound: The estimated forward error,
  165: *              almost certainly within a factor of 10 of the true error
  166: *              so long as the next entry is greater than the threshold
  167: *              sqrt(n) * dlamch('Epsilon'). This error bound should only
  168: *              be trusted if the previous boolean is true.
  169: *
  170: *     err = 3  Reciprocal condition number: Estimated normwise
  171: *              reciprocal condition number.  Compared with the threshold
  172: *              sqrt(n) * dlamch('Epsilon') to determine if the error
  173: *              estimate is "guaranteed". These reciprocal condition
  174: *              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
  175: *              appropriately scaled matrix Z.
  176: *              Let Z = S*A, where S scales each row by a power of the
  177: *              radix so all absolute row sums of Z are approximately 1.
  178: *
  179: *     See Lapack Working Note 165 for further details and extra
  180: *     cautions.
  181: *
  182: *     ERR_BNDS_COMP  (output) DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS)
  183: *     For each right-hand side, this array contains information about
  184: *     various error bounds and condition numbers corresponding to the
  185: *     componentwise relative error, which is defined as follows:
  186: *
  187: *     Componentwise relative error in the ith solution vector:
  188: *                    abs(XTRUE(j,i) - X(j,i))
  189: *             max_j ----------------------
  190: *                         abs(X(j,i))
  191: *
  192: *     The array is indexed by the right-hand side i (on which the
  193: *     componentwise relative error depends), and the type of error
  194: *     information as described below. There currently are up to three
  195: *     pieces of information returned for each right-hand side. If
  196: *     componentwise accuracy is not requested (PARAMS(3) = 0.0), then
  197: *     ERR_BNDS_COMP is not accessed.  If N_ERR_BNDS .LT. 3, then at most
  198: *     the first (:,N_ERR_BNDS) entries are returned.
  199: *
  200: *     The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
  201: *     right-hand side.
  202: *
  203: *     The second index in ERR_BNDS_COMP(:,err) contains the following
  204: *     three fields:
  205: *     err = 1 "Trust/don't trust" boolean. Trust the answer if the
  206: *              reciprocal condition number is less than the threshold
  207: *              sqrt(n) * dlamch('Epsilon').
  208: *
  209: *     err = 2 "Guaranteed" error bound: The estimated forward error,
  210: *              almost certainly within a factor of 10 of the true error
  211: *              so long as the next entry is greater than the threshold
  212: *              sqrt(n) * dlamch('Epsilon'). This error bound should only
  213: *              be trusted if the previous boolean is true.
  214: *
  215: *     err = 3  Reciprocal condition number: Estimated componentwise
  216: *              reciprocal condition number.  Compared with the threshold
  217: *              sqrt(n) * dlamch('Epsilon') to determine if the error
  218: *              estimate is "guaranteed". These reciprocal condition
  219: *              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
  220: *              appropriately scaled matrix Z.
  221: *              Let Z = S*(A*diag(x)), where x is the solution for the
  222: *              current right-hand side and S scales each row of
  223: *              A*diag(x) by a power of the radix so all absolute row
  224: *              sums of Z are approximately 1.
  225: *
  226: *     See Lapack Working Note 165 for further details and extra
  227: *     cautions.
  228: *
  229: *     NPARAMS (input) INTEGER
  230: *     Specifies the number of parameters set in PARAMS.  If .LE. 0, the
  231: *     PARAMS array is never referenced and default values are used.
  232: *
  233: *     PARAMS  (input / output) DOUBLE PRECISION array, dimension (NPARAMS)
  234: *     Specifies algorithm parameters.  If an entry is .LT. 0.0, then
  235: *     that entry will be filled with default value used for that
  236: *     parameter.  Only positions up to NPARAMS are accessed; defaults
  237: *     are used for higher-numbered parameters.
  238: *
  239: *       PARAMS(LA_LINRX_ITREF_I = 1) : Whether to perform iterative
  240: *            refinement or not.
  241: *         Default: 1.0D+0
  242: *            = 0.0 : No refinement is performed, and no error bounds are
  243: *                    computed.
  244: *            = 1.0 : Use the double-precision refinement algorithm,
  245: *                    possibly with doubled-single computations if the
  246: *                    compilation environment does not support DOUBLE
  247: *                    PRECISION.
  248: *              (other values are reserved for future use)
  249: *
  250: *       PARAMS(LA_LINRX_ITHRESH_I = 2) : Maximum number of residual
  251: *            computations allowed for refinement.
  252: *         Default: 10
  253: *         Aggressive: Set to 100 to permit convergence using approximate
  254: *                     factorizations or factorizations other than LU. If
  255: *                     the factorization uses a technique other than
  256: *                     Gaussian elimination, the guarantees in
  257: *                     err_bnds_norm and err_bnds_comp may no longer be
  258: *                     trustworthy.
  259: *
  260: *       PARAMS(LA_LINRX_CWISE_I = 3) : Flag determining if the code
  261: *            will attempt to find a solution with small componentwise
  262: *            relative error in the double-precision algorithm.  Positive
  263: *            is true, 0.0 is false.
  264: *         Default: 1.0 (attempt componentwise convergence)
  265: *
  266: *     WORK    (workspace) DOUBLE PRECISION array, dimension (4*N)
  267: *
  268: *     IWORK   (workspace) INTEGER array, dimension (N)
  269: *
  270: *     INFO    (output) INTEGER
  271: *       = 0:  Successful exit. The solution to every right-hand side is
  272: *         guaranteed.
  273: *       < 0:  If INFO = -i, the i-th argument had an illegal value
  274: *       > 0 and <= N:  U(INFO,INFO) is exactly zero.  The factorization
  275: *         has been completed, but the factor U is exactly singular, so
  276: *         the solution and error bounds could not be computed. RCOND = 0
  277: *         is returned.
  278: *       = N+J: The solution corresponding to the Jth right-hand side is
  279: *         not guaranteed. The solutions corresponding to other right-
  280: *         hand sides K with K > J may not be guaranteed as well, but
  281: *         only the first such right-hand side is reported. If a small
  282: *         componentwise error is not requested (PARAMS(3) = 0.0) then
  283: *         the Jth right-hand side is the first with a normwise error
  284: *         bound that is not guaranteed (the smallest J such
  285: *         that ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0)
  286: *         the Jth right-hand side is the first with either a normwise or
  287: *         componentwise error bound that is not guaranteed (the smallest
  288: *         J such that either ERR_BNDS_NORM(J,1) = 0.0 or
  289: *         ERR_BNDS_COMP(J,1) = 0.0). See the definition of
  290: *         ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information
  291: *         about all of the right-hand sides check ERR_BNDS_NORM or
  292: *         ERR_BNDS_COMP.
  293: *
  294: *     ==================================================================
  295: *
  296: *     .. Parameters ..
  297:       DOUBLE PRECISION   ZERO, ONE
  298:       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
  299:       DOUBLE PRECISION   ITREF_DEFAULT, ITHRESH_DEFAULT
  300:       DOUBLE PRECISION   COMPONENTWISE_DEFAULT, RTHRESH_DEFAULT
  301:       DOUBLE PRECISION   DZTHRESH_DEFAULT
  302:       PARAMETER          ( ITREF_DEFAULT = 1.0D+0 )
  303:       PARAMETER          ( ITHRESH_DEFAULT = 10.0D+0 )
  304:       PARAMETER          ( COMPONENTWISE_DEFAULT = 1.0D+0 )
  305:       PARAMETER          ( RTHRESH_DEFAULT = 0.5D+0 )
  306:       PARAMETER          ( DZTHRESH_DEFAULT = 0.25D+0 )
  307:       INTEGER            LA_LINRX_ITREF_I, LA_LINRX_ITHRESH_I,
  308:      $                   LA_LINRX_CWISE_I
  309:       PARAMETER          ( LA_LINRX_ITREF_I = 1,
  310:      $                   LA_LINRX_ITHRESH_I = 2 )
  311:       PARAMETER          ( LA_LINRX_CWISE_I = 3 )
  312:       INTEGER            LA_LINRX_TRUST_I, LA_LINRX_ERR_I,
  313:      $                   LA_LINRX_RCOND_I
  314:       PARAMETER          ( LA_LINRX_TRUST_I = 1, LA_LINRX_ERR_I = 2 )
  315:       PARAMETER          ( LA_LINRX_RCOND_I = 3 )
  316: *     ..
  317: *     .. Local Scalars ..
  318:       CHARACTER(1)       NORM
  319:       LOGICAL            RCEQU
  320:       INTEGER            J, PREC_TYPE, REF_TYPE
  321:       INTEGER            N_NORMS
  322:       DOUBLE PRECISION   ANORM, RCOND_TMP
  323:       DOUBLE PRECISION   ILLRCOND_THRESH, ERR_LBND, CWISE_WRONG
  324:       LOGICAL            IGNORE_CWISE
  325:       INTEGER            ITHRESH
  326:       DOUBLE PRECISION   RTHRESH, UNSTABLE_THRESH
  327: *     ..
  328: *     .. External Subroutines ..
  329:       EXTERNAL           XERBLA, DPOCON, DLA_PORFSX_EXTENDED
  330: *     ..
  331: *     .. Intrinsic Functions ..
  332:       INTRINSIC          MAX, SQRT
  333: *     ..
  334: *     .. External Functions ..
  335:       EXTERNAL           LSAME, BLAS_FPINFO_X, ILATRANS, ILAPREC
  336:       EXTERNAL           DLAMCH, DLANSY, DLA_PORCOND
  337:       DOUBLE PRECISION   DLAMCH, DLANSY, DLA_PORCOND
  338:       LOGICAL            LSAME
  339:       INTEGER            BLAS_FPINFO_X
  340:       INTEGER            ILATRANS, ILAPREC
  341: *     ..
  342: *     .. Executable Statements ..
  343: *
  344: *     Check the input parameters.
  345: *
  346:       INFO = 0
  347:       REF_TYPE = INT( ITREF_DEFAULT )
  348:       IF ( NPARAMS .GE. LA_LINRX_ITREF_I ) THEN
  349:          IF ( PARAMS( LA_LINRX_ITREF_I ) .LT. 0.0D+0 ) THEN
  350:             PARAMS( LA_LINRX_ITREF_I ) = ITREF_DEFAULT
  351:          ELSE
  352:             REF_TYPE = PARAMS( LA_LINRX_ITREF_I )
  353:          END IF
  354:       END IF
  355: *
  356: *     Set default parameters.
  357: *
  358:       ILLRCOND_THRESH = DBLE( N ) * DLAMCH( 'Epsilon' )
  359:       ITHRESH = INT( ITHRESH_DEFAULT )
  360:       RTHRESH = RTHRESH_DEFAULT
  361:       UNSTABLE_THRESH = DZTHRESH_DEFAULT
  362:       IGNORE_CWISE = COMPONENTWISE_DEFAULT .EQ. 0.0D+0
  363: *
  364:       IF ( NPARAMS.GE.LA_LINRX_ITHRESH_I ) THEN
  365:          IF ( PARAMS( LA_LINRX_ITHRESH_I ).LT.0.0D+0 ) THEN
  366:             PARAMS( LA_LINRX_ITHRESH_I ) = ITHRESH
  367:          ELSE
  368:             ITHRESH = INT( PARAMS( LA_LINRX_ITHRESH_I ) )
  369:          END IF
  370:       END IF
  371:       IF ( NPARAMS.GE.LA_LINRX_CWISE_I ) THEN
  372:          IF ( PARAMS( LA_LINRX_CWISE_I ).LT.0.0D+0 ) THEN
  373:             IF ( IGNORE_CWISE ) THEN
  374:                PARAMS( LA_LINRX_CWISE_I ) = 0.0D+0
  375:             ELSE
  376:                PARAMS( LA_LINRX_CWISE_I ) = 1.0D+0
  377:             END IF
  378:          ELSE
  379:             IGNORE_CWISE = PARAMS( LA_LINRX_CWISE_I ) .EQ. 0.0D+0
  380:          END IF
  381:       END IF
  382:       IF ( REF_TYPE .EQ. 0 .OR. N_ERR_BNDS .EQ. 0 ) THEN
  383:          N_NORMS = 0
  384:       ELSE IF ( IGNORE_CWISE ) THEN
  385:          N_NORMS = 1
  386:       ELSE
  387:          N_NORMS = 2
  388:       END IF
  389: *
  390:       RCEQU = LSAME( EQUED, 'Y' )
  391: *
  392: *     Test input parameters.
  393: *
  394:       IF (.NOT.LSAME(UPLO, 'U') .AND. .NOT.LSAME(UPLO, 'L')) THEN
  395:         INFO = -1
  396:       ELSE IF( .NOT.RCEQU .AND. .NOT.LSAME( EQUED, 'N' ) ) THEN
  397:         INFO = -2
  398:       ELSE IF( N.LT.0 ) THEN
  399:         INFO = -3
  400:       ELSE IF( NRHS.LT.0 ) THEN
  401:         INFO = -4
  402:       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
  403:         INFO = -6
  404:       ELSE IF( LDAF.LT.MAX( 1, N ) ) THEN
  405:         INFO = -8
  406:       ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
  407:         INFO = -11
  408:       ELSE IF( LDX.LT.MAX( 1, N ) ) THEN
  409:         INFO = -13
  410:       END IF
  411:       IF( INFO.NE.0 ) THEN
  412:         CALL XERBLA( 'DPORFSX', -INFO )
  413:         RETURN
  414:       END IF
  415: *
  416: *     Quick return if possible.
  417: *
  418:       IF( N.EQ.0 .OR. NRHS.EQ.0 ) THEN
  419:          RCOND = 1.0D+0
  420:          DO J = 1, NRHS
  421:             BERR( J ) = 0.0D+0
  422:             IF ( N_ERR_BNDS .GE. 1 ) THEN
  423:                ERR_BNDS_NORM( J, LA_LINRX_TRUST_I ) = 1.0D+0
  424:                ERR_BNDS_COMP( J, LA_LINRX_TRUST_I ) = 1.0D+0
  425:             END IF
  426:             IF ( N_ERR_BNDS .GE. 2 ) THEN
  427:                ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) = 0.0D+0
  428:                ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) = 0.0D+0
  429:             END IF
  430:             IF ( N_ERR_BNDS .GE. 3 ) THEN
  431:                ERR_BNDS_NORM( J, LA_LINRX_RCOND_I ) = 1.0D+0
  432:                ERR_BNDS_COMP( J, LA_LINRX_RCOND_I ) = 1.0D+0
  433:             END IF
  434:          END DO
  435:          RETURN
  436:       END IF
  437: *
  438: *     Default to failure.
  439: *
  440:       RCOND = 0.0D+0
  441:       DO J = 1, NRHS
  442:          BERR( J ) = 1.0D+0
  443:          IF ( N_ERR_BNDS .GE. 1 ) THEN
  444:             ERR_BNDS_NORM( J, LA_LINRX_TRUST_I ) = 1.0D+0
  445:             ERR_BNDS_COMP( J, LA_LINRX_TRUST_I ) = 1.0D+0
  446:          END IF
  447:          IF ( N_ERR_BNDS .GE. 2 ) THEN
  448:             ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) = 1.0D+0
  449:             ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) = 1.0D+0
  450:          END IF
  451:          IF ( N_ERR_BNDS .GE. 3 ) THEN
  452:             ERR_BNDS_NORM( J, LA_LINRX_RCOND_I ) = 0.0D+0
  453:             ERR_BNDS_COMP( J, LA_LINRX_RCOND_I ) = 0.0D+0
  454:          END IF
  455:       END DO
  456: *
  457: *     Compute the norm of A and the reciprocal of the condition
  458: *     number of A.
  459: *
  460:       NORM = 'I'
  461:       ANORM = DLANSY( NORM, UPLO, N, A, LDA, WORK )
  462:       CALL DPOCON( UPLO, N, AF, LDAF, ANORM, RCOND, WORK,
  463:      $     IWORK, INFO )
  464: *
  465: *     Perform refinement on each right-hand side
  466: *
  467:       IF ( REF_TYPE .NE. 0 ) THEN
  468: 
  469:          PREC_TYPE = ILAPREC( 'E' )
  470: 
  471:          CALL DLA_PORFSX_EXTENDED( PREC_TYPE, UPLO,  N,
  472:      $        NRHS, A, LDA, AF, LDAF, RCEQU, S, B,
  473:      $        LDB, X, LDX, BERR, N_NORMS, ERR_BNDS_NORM, ERR_BNDS_COMP,
  474:      $        WORK( N+1 ), WORK( 1 ), WORK( 2*N+1 ), WORK( 1 ), RCOND,
  475:      $        ITHRESH, RTHRESH, UNSTABLE_THRESH, IGNORE_CWISE,
  476:      $        INFO )
  477:       END IF
  478: 
  479:       ERR_LBND = MAX( 10.0D+0, SQRT( DBLE( N ) ) ) * DLAMCH( 'Epsilon' )
  480:       IF ( N_ERR_BNDS .GE. 1 .AND. N_NORMS .GE. 1 ) THEN
  481: *
  482: *     Compute scaled normwise condition number cond(A*C).
  483: *
  484:          IF ( RCEQU ) THEN
  485:             RCOND_TMP = DLA_PORCOND( UPLO, N, A, LDA, AF, LDAF,
  486:      $           -1, S, INFO, WORK, IWORK )
  487:          ELSE
  488:             RCOND_TMP = DLA_PORCOND( UPLO, N, A, LDA, AF, LDAF,
  489:      $           0, S, INFO, WORK, IWORK )
  490:          END IF
  491:          DO J = 1, NRHS
  492: *
  493: *     Cap the error at 1.0.
  494: *
  495:             IF ( N_ERR_BNDS .GE. LA_LINRX_ERR_I
  496:      $           .AND. ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) .GT. 1.0D+0 )
  497:      $           ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) = 1.0D+0
  498: *
  499: *     Threshold the error (see LAWN).
  500: *
  501:             IF ( RCOND_TMP .LT. ILLRCOND_THRESH ) THEN
  502:                ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) = 1.0D+0
  503:                ERR_BNDS_NORM( J, LA_LINRX_TRUST_I ) = 0.0D+0
  504:                IF ( INFO .LE. N ) INFO = N + J
  505:             ELSE IF ( ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) .LT. ERR_LBND )
  506:      $              THEN
  507:                ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) = ERR_LBND
  508:                ERR_BNDS_NORM( J, LA_LINRX_TRUST_I ) = 1.0D+0
  509:             END IF
  510: *
  511: *     Save the condition number.
  512: *
  513:             IF (N_ERR_BNDS .GE. LA_LINRX_RCOND_I) THEN
  514:                ERR_BNDS_NORM( J, LA_LINRX_RCOND_I ) = RCOND_TMP
  515:             END IF
  516:          END DO
  517:       END IF
  518: 
  519:       IF ( N_ERR_BNDS .GE. 1 .AND. N_NORMS .GE. 2 ) THEN
  520: *
  521: *     Compute componentwise condition number cond(A*diag(Y(:,J))) for
  522: *     each right-hand side using the current solution as an estimate of
  523: *     the true solution.  If the componentwise error estimate is too
  524: *     large, then the solution is a lousy estimate of truth and the
  525: *     estimated RCOND may be too optimistic.  To avoid misleading users,
  526: *     the inverse condition number is set to 0.0 when the estimated
  527: *     cwise error is at least CWISE_WRONG.
  528: *
  529:          CWISE_WRONG = SQRT( DLAMCH( 'Epsilon' ) )
  530:          DO J = 1, NRHS
  531:             IF (ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) .LT. CWISE_WRONG )
  532:      $     THEN
  533:                RCOND_TMP = DLA_PORCOND( UPLO, N, A, LDA, AF, LDAF, 1,
  534:      $              X( 1, J ), INFO, WORK, IWORK )
  535:             ELSE
  536:                RCOND_TMP = 0.0D+0
  537:             END IF
  538: *
  539: *     Cap the error at 1.0.
  540: *
  541:             IF ( N_ERR_BNDS .GE. LA_LINRX_ERR_I
  542:      $           .AND. ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) .GT. 1.0D+0 )
  543:      $           ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) = 1.0D+0
  544: *
  545: *     Threshold the error (see LAWN).
  546: *
  547:             IF ( RCOND_TMP .LT. ILLRCOND_THRESH ) THEN
  548:                ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) = 1.0D+0
  549:                ERR_BNDS_COMP( J, LA_LINRX_TRUST_I ) = 0.0D+0
  550:                IF ( PARAMS( LA_LINRX_CWISE_I ) .EQ. 1.0D+0
  551:      $              .AND. INFO.LT.N + J ) INFO = N + J
  552:             ELSE IF ( ERR_BNDS_COMP( J, LA_LINRX_ERR_I )
  553:      $              .LT. ERR_LBND ) THEN
  554:                ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) = ERR_LBND
  555:                ERR_BNDS_COMP( J, LA_LINRX_TRUST_I ) = 1.0D+0
  556:             END IF
  557: *
  558: *     Save the condition number.
  559: *
  560:             IF ( N_ERR_BNDS .GE. LA_LINRX_RCOND_I ) THEN
  561:                ERR_BNDS_COMP( J, LA_LINRX_RCOND_I ) = RCOND_TMP
  562:             END IF
  563: 
  564:          END DO
  565:       END IF
  566: *
  567:       RETURN
  568: *
  569: *     End of DPORFSX
  570: *
  571:       END

CVSweb interface <joel.bertrand@systella.fr>