File:  [local] / rpl / lapack / lapack / dla_syrfsx_extended.f
Revision 1.2: download - view: text, annotated - select for diffs - revision graph
Sat Aug 7 13:22:16 2010 UTC (13 years, 9 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
Mise à jour globale de Lapack 3.2.2.

    1:       SUBROUTINE DLA_SYRFSX_EXTENDED( PREC_TYPE, UPLO, N, NRHS, A, LDA,
    2:      $                                AF, LDAF, IPIV, COLEQU, C, B, LDB,
    3:      $                                Y, LDY, BERR_OUT, N_NORMS,
    4:      $                                ERR_BNDS_NORM, ERR_BNDS_COMP, RES,
    5:      $                                AYB, DY, Y_TAIL, RCOND, ITHRESH,
    6:      $                                RTHRESH, DZ_UB, IGNORE_CWISE,
    7:      $                                INFO )
    8: *
    9: *     -- LAPACK routine (version 3.2.2)                                 --
   10: *     -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
   11: *     -- Jason Riedy of Univ. of California Berkeley.                 --
   12: *     -- June 2010                                                    --
   13: *
   14: *     -- LAPACK is a software package provided by Univ. of Tennessee, --
   15: *     -- Univ. of California Berkeley and NAG Ltd.                    --
   16: *
   17:       IMPLICIT NONE
   18: *     ..
   19: *     .. Scalar Arguments ..
   20:       INTEGER            INFO, LDA, LDAF, LDB, LDY, N, NRHS, PREC_TYPE,
   21:      $                   N_NORMS, ITHRESH
   22:       CHARACTER          UPLO
   23:       LOGICAL            COLEQU, IGNORE_CWISE
   24:       DOUBLE PRECISION   RTHRESH, DZ_UB
   25: *     ..
   26: *     .. Array Arguments ..
   27:       INTEGER            IPIV( * )
   28:       DOUBLE PRECISION   A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
   29:      $                   Y( LDY, * ), RES( * ), DY( * ), Y_TAIL( * )
   30:       DOUBLE PRECISION   C( * ), AYB( * ), RCOND, BERR_OUT( * ),
   31:      $                   ERR_BNDS_NORM( NRHS, * ),
   32:      $                   ERR_BNDS_COMP( NRHS, * )
   33: *     ..
   34: *
   35: *  Purpose
   36: *  =======
   37:    38: *  DLA_SYRFSX_EXTENDED improves the computed solution to a system of
   39: *  linear equations by performing extra-precise iterative refinement
   40: *  and provides error bounds and backward error estimates for the solution.
   41: *  This subroutine is called by DSYRFSX to perform iterative refinement.
   42: *  In addition to normwise error bound, the code provides maximum
   43: *  componentwise error bound if possible. See comments for ERR_BNDS_NORM
   44: *  and ERR_BNDS_COMP for details of the error bounds. Note that this
   45: *  subroutine is only resonsible for setting the second fields of
   46: *  ERR_BNDS_NORM and ERR_BNDS_COMP.
   47: *
   48: *  Arguments
   49: *  =========
   50: *
   51: *     PREC_TYPE      (input) INTEGER
   52: *     Specifies the intermediate precision to be used in refinement.
   53: *     The value is defined by ILAPREC(P) where P is a CHARACTER and
   54: *     P    = 'S':  Single
   55: *          = 'D':  Double
   56: *          = 'I':  Indigenous
   57: *          = 'X', 'E':  Extra
   58: *
   59: *     UPLO    (input) CHARACTER*1
   60: *       = 'U':  Upper triangle of A is stored;
   61: *       = 'L':  Lower triangle of A is stored.
   62: *
   63: *     N              (input) INTEGER
   64: *     The number of linear equations, i.e., the order of the
   65: *     matrix A.  N >= 0.
   66: *
   67: *     NRHS           (input) INTEGER
   68: *     The number of right-hand-sides, i.e., the number of columns of the
   69: *     matrix B.
   70: *
   71: *     A              (input) DOUBLE PRECISION array, dimension (LDA,N)
   72: *     On entry, the N-by-N matrix A.
   73: *
   74: *     LDA            (input) INTEGER
   75: *     The leading dimension of the array A.  LDA >= max(1,N).
   76: *
   77: *     AF             (input) DOUBLE PRECISION array, dimension (LDAF,N)
   78: *     The block diagonal matrix D and the multipliers used to
   79: *     obtain the factor U or L as computed by DSYTRF.
   80: *
   81: *     LDAF           (input) INTEGER
   82: *     The leading dimension of the array AF.  LDAF >= max(1,N).
   83: *
   84: *     IPIV           (input) INTEGER array, dimension (N)
   85: *     Details of the interchanges and the block structure of D
   86: *     as determined by DSYTRF.
   87: *
   88: *     COLEQU         (input) LOGICAL
   89: *     If .TRUE. then column equilibration was done to A before calling
   90: *     this routine. This is needed to compute the solution and error
   91: *     bounds correctly.
   92: *
   93: *     C              (input) DOUBLE PRECISION array, dimension (N)
   94: *     The column scale factors for A. If COLEQU = .FALSE., C
   95: *     is not accessed. If C is input, each element of C should be a power
   96: *     of the radix to ensure a reliable solution and error estimates.
   97: *     Scaling by powers of the radix does not cause rounding errors unless
   98: *     the result underflows or overflows. Rounding errors during scaling
   99: *     lead to refining with a matrix that is not equivalent to the
  100: *     input matrix, producing error estimates that may not be
  101: *     reliable.
  102: *
  103: *     B              (input) DOUBLE PRECISION array, dimension (LDB,NRHS)
  104: *     The right-hand-side matrix B.
  105: *
  106: *     LDB            (input) INTEGER
  107: *     The leading dimension of the array B.  LDB >= max(1,N).
  108: *
  109: *     Y              (input/output) DOUBLE PRECISION array, dimension
  110: *                    (LDY,NRHS)
  111: *     On entry, the solution matrix X, as computed by DSYTRS.
  112: *     On exit, the improved solution matrix Y.
  113: *
  114: *     LDY            (input) INTEGER
  115: *     The leading dimension of the array Y.  LDY >= max(1,N).
  116: *
  117: *     BERR_OUT       (output) DOUBLE PRECISION array, dimension (NRHS)
  118: *     On exit, BERR_OUT(j) contains the componentwise relative backward
  119: *     error for right-hand-side j from the formula
  120: *         max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
  121: *     where abs(Z) is the componentwise absolute value of the matrix
  122: *     or vector Z. This is computed by DLA_LIN_BERR.
  123: *
  124: *     N_NORMS        (input) INTEGER
  125: *     Determines which error bounds to return (see ERR_BNDS_NORM
  126: *     and ERR_BNDS_COMP).
  127: *     If N_NORMS >= 1 return normwise error bounds.
  128: *     If N_NORMS >= 2 return componentwise error bounds.
  129: *
  130: *     ERR_BNDS_NORM  (input/output) DOUBLE PRECISION array, dimension
  131: *                    (NRHS, N_ERR_BNDS)
  132: *     For each right-hand side, this array contains information about
  133: *     various error bounds and condition numbers corresponding to the
  134: *     normwise relative error, which is defined as follows:
  135: *
  136: *     Normwise relative error in the ith solution vector:
  137: *             max_j (abs(XTRUE(j,i) - X(j,i)))
  138: *            ------------------------------
  139: *                  max_j abs(X(j,i))
  140: *
  141: *     The array is indexed by the type of error information as described
  142: *     below. There currently are up to three pieces of information
  143: *     returned.
  144: *
  145: *     The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
  146: *     right-hand side.
  147: *
  148: *     The second index in ERR_BNDS_NORM(:,err) contains the following
  149: *     three fields:
  150: *     err = 1 "Trust/don't trust" boolean. Trust the answer if the
  151: *              reciprocal condition number is less than the threshold
  152: *              sqrt(n) * slamch('Epsilon').
  153: *
  154: *     err = 2 "Guaranteed" error bound: The estimated forward error,
  155: *              almost certainly within a factor of 10 of the true error
  156: *              so long as the next entry is greater than the threshold
  157: *              sqrt(n) * slamch('Epsilon'). This error bound should only
  158: *              be trusted if the previous boolean is true.
  159: *
  160: *     err = 3  Reciprocal condition number: Estimated normwise
  161: *              reciprocal condition number.  Compared with the threshold
  162: *              sqrt(n) * slamch('Epsilon') to determine if the error
  163: *              estimate is "guaranteed". These reciprocal condition
  164: *              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
  165: *              appropriately scaled matrix Z.
  166: *              Let Z = S*A, where S scales each row by a power of the
  167: *              radix so all absolute row sums of Z are approximately 1.
  168: *
  169: *     This subroutine is only responsible for setting the second field
  170: *     above.
  171: *     See Lapack Working Note 165 for further details and extra
  172: *     cautions.
  173: *
  174: *     ERR_BNDS_COMP  (input/output) DOUBLE PRECISION array, dimension
  175: *                    (NRHS, N_ERR_BNDS)
  176: *     For each right-hand side, this array contains information about
  177: *     various error bounds and condition numbers corresponding to the
  178: *     componentwise relative error, which is defined as follows:
  179: *
  180: *     Componentwise relative error in the ith solution vector:
  181: *                    abs(XTRUE(j,i) - X(j,i))
  182: *             max_j ----------------------
  183: *                         abs(X(j,i))
  184: *
  185: *     The array is indexed by the right-hand side i (on which the
  186: *     componentwise relative error depends), and the type of error
  187: *     information as described below. There currently are up to three
  188: *     pieces of information returned for each right-hand side. If
  189: *     componentwise accuracy is not requested (PARAMS(3) = 0.0), then
  190: *     ERR_BNDS_COMP is not accessed.  If N_ERR_BNDS .LT. 3, then at most
  191: *     the first (:,N_ERR_BNDS) entries are returned.
  192: *
  193: *     The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
  194: *     right-hand side.
  195: *
  196: *     The second index in ERR_BNDS_COMP(:,err) contains the following
  197: *     three fields:
  198: *     err = 1 "Trust/don't trust" boolean. Trust the answer if the
  199: *              reciprocal condition number is less than the threshold
  200: *              sqrt(n) * slamch('Epsilon').
  201: *
  202: *     err = 2 "Guaranteed" error bound: The estimated forward error,
  203: *              almost certainly within a factor of 10 of the true error
  204: *              so long as the next entry is greater than the threshold
  205: *              sqrt(n) * slamch('Epsilon'). This error bound should only
  206: *              be trusted if the previous boolean is true.
  207: *
  208: *     err = 3  Reciprocal condition number: Estimated componentwise
  209: *              reciprocal condition number.  Compared with the threshold
  210: *              sqrt(n) * slamch('Epsilon') to determine if the error
  211: *              estimate is "guaranteed". These reciprocal condition
  212: *              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
  213: *              appropriately scaled matrix Z.
  214: *              Let Z = S*(A*diag(x)), where x is the solution for the
  215: *              current right-hand side and S scales each row of
  216: *              A*diag(x) by a power of the radix so all absolute row
  217: *              sums of Z are approximately 1.
  218: *
  219: *     This subroutine is only responsible for setting the second field
  220: *     above.
  221: *     See Lapack Working Note 165 for further details and extra
  222: *     cautions.
  223: *
  224: *     RES            (input) DOUBLE PRECISION array, dimension (N)
  225: *     Workspace to hold the intermediate residual.
  226: *
  227: *     AYB            (input) DOUBLE PRECISION array, dimension (N)
  228: *     Workspace. This can be the same workspace passed for Y_TAIL.
  229: *
  230: *     DY             (input) DOUBLE PRECISION array, dimension (N)
  231: *     Workspace to hold the intermediate solution.
  232: *
  233: *     Y_TAIL         (input) DOUBLE PRECISION array, dimension (N)
  234: *     Workspace to hold the trailing bits of the intermediate solution.
  235: *
  236: *     RCOND          (input) DOUBLE PRECISION
  237: *     Reciprocal scaled condition number.  This is an estimate of the
  238: *     reciprocal Skeel condition number of the matrix A after
  239: *     equilibration (if done).  If this is less than the machine
  240: *     precision (in particular, if it is zero), the matrix is singular
  241: *     to working precision.  Note that the error may still be small even
  242: *     if this number is very small and the matrix appears ill-
  243: *     conditioned.
  244: *
  245: *     ITHRESH        (input) INTEGER
  246: *     The maximum number of residual computations allowed for
  247: *     refinement. The default is 10. For 'aggressive' set to 100 to
  248: *     permit convergence using approximate factorizations or
  249: *     factorizations other than LU. If the factorization uses a
  250: *     technique other than Gaussian elimination, the guarantees in
  251: *     ERR_BNDS_NORM and ERR_BNDS_COMP may no longer be trustworthy.
  252: *
  253: *     RTHRESH        (input) DOUBLE PRECISION
  254: *     Determines when to stop refinement if the error estimate stops
  255: *     decreasing. Refinement will stop when the next solution no longer
  256: *     satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
  257: *     the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
  258: *     default value is 0.5. For 'aggressive' set to 0.9 to permit
  259: *     convergence on extremely ill-conditioned matrices. See LAWN 165
  260: *     for more details.
  261: *
  262: *     DZ_UB          (input) DOUBLE PRECISION
  263: *     Determines when to start considering componentwise convergence.
  264: *     Componentwise convergence is only considered after each component
  265: *     of the solution Y is stable, which we definte as the relative
  266: *     change in each component being less than DZ_UB. The default value
  267: *     is 0.25, requiring the first bit to be stable. See LAWN 165 for
  268: *     more details.
  269: *
  270: *     IGNORE_CWISE   (input) LOGICAL
  271: *     If .TRUE. then ignore componentwise convergence. Default value
  272: *     is .FALSE..
  273: *
  274: *     INFO           (output) INTEGER
  275: *       = 0:  Successful exit.
  276: *       < 0:  if INFO = -i, the ith argument to DSYTRS had an illegal
  277: *             value
  278: *
  279: *  =====================================================================
  280: *
  281: *     .. Local Scalars ..
  282:       INTEGER            UPLO2, CNT, I, J, X_STATE, Z_STATE
  283:       DOUBLE PRECISION   YK, DYK, YMIN, NORMY, NORMX, NORMDX, DXRAT,
  284:      $                   DZRAT, PREVNORMDX, PREV_DZ_Z, DXRATMAX,
  285:      $                   DZRATMAX, DX_X, DZ_Z, FINAL_DX_X, FINAL_DZ_Z,
  286:      $                   EPS, HUGEVAL, INCR_THRESH
  287:       LOGICAL            INCR_PREC
  288: *     ..
  289: *     .. Parameters ..
  290:       INTEGER            UNSTABLE_STATE, WORKING_STATE, CONV_STATE,
  291:      $                   NOPROG_STATE, Y_PREC_STATE, BASE_RESIDUAL,
  292:      $                   EXTRA_RESIDUAL, EXTRA_Y
  293:       PARAMETER          ( UNSTABLE_STATE = 0, WORKING_STATE = 1,
  294:      $                   CONV_STATE = 2, NOPROG_STATE = 3 )
  295:       PARAMETER          ( BASE_RESIDUAL = 0, EXTRA_RESIDUAL = 1,
  296:      $                   EXTRA_Y = 2 )
  297:       INTEGER            FINAL_NRM_ERR_I, FINAL_CMP_ERR_I, BERR_I
  298:       INTEGER            RCOND_I, NRM_RCOND_I, NRM_ERR_I, CMP_RCOND_I
  299:       INTEGER            CMP_ERR_I, PIV_GROWTH_I
  300:       PARAMETER          ( FINAL_NRM_ERR_I = 1, FINAL_CMP_ERR_I = 2,
  301:      $                   BERR_I = 3 )
  302:       PARAMETER          ( RCOND_I = 4, NRM_RCOND_I = 5, NRM_ERR_I = 6 )
  303:       PARAMETER          ( CMP_RCOND_I = 7, CMP_ERR_I = 8,
  304:      $                   PIV_GROWTH_I = 9 )
  305:       INTEGER            LA_LINRX_ITREF_I, LA_LINRX_ITHRESH_I,
  306:      $                   LA_LINRX_CWISE_I
  307:       PARAMETER          ( LA_LINRX_ITREF_I = 1,
  308:      $                   LA_LINRX_ITHRESH_I = 2 )
  309:       PARAMETER          ( LA_LINRX_CWISE_I = 3 )
  310:       INTEGER            LA_LINRX_TRUST_I, LA_LINRX_ERR_I,
  311:      $                   LA_LINRX_RCOND_I
  312:       PARAMETER          ( LA_LINRX_TRUST_I = 1, LA_LINRX_ERR_I = 2 )
  313:       PARAMETER          ( LA_LINRX_RCOND_I = 3 )
  314: *     ..
  315: *     .. External Functions ..
  316:       LOGICAL            LSAME
  317:       EXTERNAL           ILAUPLO
  318:       INTEGER            ILAUPLO
  319: *     ..
  320: *     .. External Subroutines ..
  321:       EXTERNAL           DAXPY, DCOPY, DSYTRS, DSYMV, BLAS_DSYMV_X,
  322:      $                   BLAS_DSYMV2_X, DLA_SYAMV, DLA_WWADDW,
  323:      $                   DLA_LIN_BERR
  324:       DOUBLE PRECISION   DLAMCH
  325: *     ..
  326: *     .. Intrinsic Functions ..
  327:       INTRINSIC          ABS, MAX, MIN
  328: *     ..
  329: *     .. Executable Statements ..
  330: *
  331:       IF ( INFO.NE.0 ) RETURN
  332:       EPS = DLAMCH( 'Epsilon' )
  333:       HUGEVAL = DLAMCH( 'Overflow' )
  334: *     Force HUGEVAL to Inf
  335:       HUGEVAL = HUGEVAL * HUGEVAL
  336: *     Using HUGEVAL may lead to spurious underflows.
  337:       INCR_THRESH = DBLE( N )*EPS
  338: 
  339:       IF ( LSAME ( UPLO, 'L' ) ) THEN
  340:          UPLO2 = ILAUPLO( 'L' )
  341:       ELSE
  342:          UPLO2 = ILAUPLO( 'U' )
  343:       ENDIF
  344: 
  345:       DO J = 1, NRHS
  346:          Y_PREC_STATE = EXTRA_RESIDUAL
  347:          IF ( Y_PREC_STATE .EQ. EXTRA_Y ) THEN
  348:             DO I = 1, N
  349:                Y_TAIL( I ) = 0.0D+0
  350:             END DO
  351:          END IF
  352: 
  353:          DXRAT = 0.0D+0
  354:          DXRATMAX = 0.0D+0
  355:          DZRAT = 0.0D+0
  356:          DZRATMAX = 0.0D+0
  357:          FINAL_DX_X = HUGEVAL
  358:          FINAL_DZ_Z = HUGEVAL
  359:          PREVNORMDX = HUGEVAL
  360:          PREV_DZ_Z = HUGEVAL
  361:          DZ_Z = HUGEVAL
  362:          DX_X = HUGEVAL
  363: 
  364:          X_STATE = WORKING_STATE
  365:          Z_STATE = UNSTABLE_STATE
  366:          INCR_PREC = .FALSE.
  367: 
  368:          DO CNT = 1, ITHRESH
  369: *
  370: *        Compute residual RES = B_s - op(A_s) * Y,
  371: *            op(A) = A, A**T, or A**H depending on TRANS (and type).
  372: *
  373:             CALL DCOPY( N, B( 1, J ), 1, RES, 1 )
  374:             IF (Y_PREC_STATE .EQ. BASE_RESIDUAL) THEN
  375:                CALL DSYMV( UPLO, N, -1.0D+0, A, LDA, Y(1,J), 1,
  376:      $              1.0D+0, RES, 1 )
  377:             ELSE IF (Y_PREC_STATE .EQ. EXTRA_RESIDUAL) THEN
  378:                CALL BLAS_DSYMV_X( UPLO2, N, -1.0D+0, A, LDA,
  379:      $              Y( 1, J ), 1, 1.0D+0, RES, 1, PREC_TYPE )
  380:             ELSE
  381:                CALL BLAS_DSYMV2_X(UPLO2, N, -1.0D+0, A, LDA,
  382:      $              Y(1, J), Y_TAIL, 1, 1.0D+0, RES, 1, PREC_TYPE)
  383:             END IF
  384:             
  385: !         XXX: RES is no longer needed.
  386:             CALL DCOPY( N, RES, 1, DY, 1 )
  387:             CALL DSYTRS( UPLO, N, 1, AF, LDAF, IPIV, DY, N, INFO )
  388: *
  389: *         Calculate relative changes DX_X, DZ_Z and ratios DXRAT, DZRAT.
  390: *
  391:             NORMX = 0.0D+0
  392:             NORMY = 0.0D+0
  393:             NORMDX = 0.0D+0
  394:             DZ_Z = 0.0D+0
  395:             YMIN = HUGEVAL
  396:             
  397:             DO I = 1, N
  398:                YK = ABS( Y( I, J ) )
  399:                DYK = ABS( DY( I ) )
  400:                
  401:                IF ( YK .NE. 0.0D+0 ) THEN
  402:                   DZ_Z = MAX( DZ_Z, DYK / YK )
  403:                ELSE IF ( DYK .NE. 0.0D+0 ) THEN
  404:                   DZ_Z = HUGEVAL
  405:                END IF
  406: 
  407:                YMIN = MIN( YMIN, YK )
  408: 
  409:                NORMY = MAX( NORMY, YK )
  410: 
  411:                IF ( COLEQU ) THEN
  412:                   NORMX = MAX( NORMX, YK * C( I ) )
  413:                   NORMDX = MAX( NORMDX, DYK * C( I ) )
  414:                ELSE
  415:                   NORMX = NORMY
  416:                   NORMDX = MAX(NORMDX, DYK)
  417:                END IF
  418:             END DO
  419: 
  420:             IF ( NORMX .NE. 0.0D+0 ) THEN
  421:                DX_X = NORMDX / NORMX
  422:             ELSE IF ( NORMDX .EQ. 0.0D+0 ) THEN
  423:                DX_X = 0.0D+0
  424:             ELSE
  425:                DX_X = HUGEVAL
  426:             END IF
  427: 
  428:             DXRAT = NORMDX / PREVNORMDX
  429:             DZRAT = DZ_Z / PREV_DZ_Z
  430: *
  431: *         Check termination criteria.
  432: *
  433:             IF ( YMIN*RCOND .LT. INCR_THRESH*NORMY
  434:      $           .AND. Y_PREC_STATE .LT. EXTRA_Y )
  435:      $           INCR_PREC = .TRUE.
  436: 
  437:             IF ( X_STATE .EQ. NOPROG_STATE .AND. DXRAT .LE. RTHRESH )
  438:      $           X_STATE = WORKING_STATE
  439:             IF ( X_STATE .EQ. WORKING_STATE ) THEN
  440:                IF ( DX_X .LE. EPS ) THEN
  441:                   X_STATE = CONV_STATE
  442:                ELSE IF ( DXRAT .GT. RTHRESH ) THEN
  443:                   IF ( Y_PREC_STATE .NE. EXTRA_Y ) THEN
  444:                      INCR_PREC = .TRUE.
  445:                   ELSE
  446:                      X_STATE = NOPROG_STATE
  447:                   END IF
  448:                ELSE
  449:                   IF ( DXRAT .GT. DXRATMAX ) DXRATMAX = DXRAT
  450:                END IF
  451:                IF ( X_STATE .GT. WORKING_STATE ) FINAL_DX_X = DX_X
  452:             END IF
  453: 
  454:             IF ( Z_STATE .EQ. UNSTABLE_STATE .AND. DZ_Z .LE. DZ_UB )
  455:      $           Z_STATE = WORKING_STATE
  456:             IF ( Z_STATE .EQ. NOPROG_STATE .AND. DZRAT .LE. RTHRESH )
  457:      $           Z_STATE = WORKING_STATE
  458:             IF ( Z_STATE .EQ. WORKING_STATE ) THEN
  459:                IF ( DZ_Z .LE. EPS ) THEN
  460:                   Z_STATE = CONV_STATE
  461:                ELSE IF ( DZ_Z .GT. DZ_UB ) THEN
  462:                   Z_STATE = UNSTABLE_STATE
  463:                   DZRATMAX = 0.0D+0
  464:                   FINAL_DZ_Z = HUGEVAL
  465:                ELSE IF ( DZRAT .GT. RTHRESH ) THEN
  466:                   IF ( Y_PREC_STATE .NE. EXTRA_Y ) THEN
  467:                      INCR_PREC = .TRUE.
  468:                   ELSE
  469:                      Z_STATE = NOPROG_STATE
  470:                   END IF
  471:                ELSE
  472:                   IF ( DZRAT .GT. DZRATMAX ) DZRATMAX = DZRAT
  473:                END IF
  474:                IF ( Z_STATE .GT. WORKING_STATE ) FINAL_DZ_Z = DZ_Z
  475:             END IF
  476: 
  477:             IF ( X_STATE.NE.WORKING_STATE.AND.
  478:      $           ( IGNORE_CWISE.OR.Z_STATE.NE.WORKING_STATE ) )
  479:      $           GOTO 666
  480: 
  481:             IF ( INCR_PREC ) THEN
  482:                INCR_PREC = .FALSE.
  483:                Y_PREC_STATE = Y_PREC_STATE + 1
  484:                DO I = 1, N
  485:                   Y_TAIL( I ) = 0.0D+0
  486:                END DO
  487:             END IF
  488: 
  489:             PREVNORMDX = NORMDX
  490:             PREV_DZ_Z = DZ_Z
  491: *
  492: *           Update soluton.
  493: *
  494:             IF (Y_PREC_STATE .LT. EXTRA_Y) THEN
  495:                CALL DAXPY( N, 1.0D+0, DY, 1, Y(1,J), 1 )
  496:             ELSE
  497:                CALL DLA_WWADDW( N, Y(1,J), Y_TAIL, DY )
  498:             END IF
  499:             
  500:          END DO
  501: *        Target of "IF (Z_STOP .AND. X_STOP)".  Sun's f77 won't EXIT.
  502:  666     CONTINUE
  503: *
  504: *     Set final_* when cnt hits ithresh.
  505: *
  506:          IF ( X_STATE .EQ. WORKING_STATE ) FINAL_DX_X = DX_X
  507:          IF ( Z_STATE .EQ. WORKING_STATE ) FINAL_DZ_Z = DZ_Z
  508: *
  509: *     Compute error bounds.
  510: *
  511:          IF ( N_NORMS .GE. 1 ) THEN
  512:             ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) =
  513:      $           FINAL_DX_X / (1 - DXRATMAX)
  514:          END IF
  515:          IF ( N_NORMS .GE. 2 ) THEN
  516:             ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) =
  517:      $           FINAL_DZ_Z / (1 - DZRATMAX)
  518:          END IF
  519: *
  520: *     Compute componentwise relative backward error from formula
  521: *         max(i) ( abs(R(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
  522: *     where abs(Z) is the componentwise absolute value of the matrix
  523: *     or vector Z.
  524: *
  525: *        Compute residual RES = B_s - op(A_s) * Y,
  526: *            op(A) = A, A**T, or A**H depending on TRANS (and type).
  527:          CALL DCOPY( N, B( 1, J ), 1, RES, 1 )
  528:          CALL DSYMV( UPLO, N, -1.0D+0, A, LDA, Y(1,J), 1, 1.0D+0, RES, 
  529:      $     1 )
  530:          
  531:          DO I = 1, N
  532:             AYB( I ) = ABS( B( I, J ) )
  533:          END DO
  534: *
  535: *     Compute abs(op(A_s))*abs(Y) + abs(B_s).
  536: *
  537:          CALL DLA_SYAMV( UPLO2, N, 1.0D+0,
  538:      $        A, LDA, Y(1, J), 1, 1.0D+0, AYB, 1 )
  539:          
  540:          CALL DLA_LIN_BERR( N, N, 1, RES, AYB, BERR_OUT( J ) )
  541: *
  542: *     End of loop for each RHS.
  543: *
  544:       END DO
  545: *
  546:       RETURN
  547:       END

CVSweb interface <joel.bertrand@systella.fr>