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

CVSweb interface <joel.bertrand@systella.fr>