File:  [local] / rpl / lapack / lapack / zsyrfsx.f
Revision 1.4: download - view: text, annotated - select for diffs - revision graph
Tue Dec 21 13:53:56 2010 UTC (13 years, 5 months ago) by bertrand
Branches: MAIN
CVS tags: rpl-4_1_3, rpl-4_1_2, rpl-4_1_1, rpl-4_1_0, rpl-4_0_24, rpl-4_0_22, rpl-4_0_21, rpl-4_0_20, rpl-4_0, HEAD
Mise à jour de lapack vers la version 3.3.0.

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

CVSweb interface <joel.bertrand@systella.fr>