File:  [local] / rpl / lapack / lapack / zla_syrfsx_extended.f
Revision 1.4: download - view: text, annotated - select for diffs - revision graph
Tue Dec 21 13:53:48 2010 UTC (13 years, 4 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 ZLA_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:       COMPLEX*16         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: *  ZLA_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 ZSYRFSX 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) COMPLEX*16 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) COMPLEX*16 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 ZSYTRF.
   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 ZSYTRF.
   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) COMPLEX*16 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) COMPLEX*16 array, dimension
  110: *                    (LDY,NRHS)
  111: *     On entry, the solution matrix X, as computed by ZSYTRS.
  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 ZLA_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) COMPLEX*16 array, dimension (N)
  225: *     Workspace to hold the intermediate residual.
  226: *
  227: *     AYB            (input) DOUBLE PRECISION array, dimension (N)
  228: *     Workspace.
  229: *
  230: *     DY             (input) COMPLEX*16 array, dimension (N)
  231: *     Workspace to hold the intermediate solution.
  232: *
  233: *     Y_TAIL         (input) COMPLEX*16 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 ZSYTRS had an illegal
  277: *             value
  278: *
  279: *  =====================================================================
  280: *
  281: *     .. Local Scalars ..
  282:       INTEGER            UPLO2, CNT, I, J, X_STATE, Z_STATE,
  283:      $                   Y_PREC_STATE
  284:       DOUBLE PRECISION   YK, DYK, YMIN, NORMY, NORMX, NORMDX, DXRAT,
  285:      $                   DZRAT, PREVNORMDX, PREV_DZ_Z, DXRATMAX,
  286:      $                   DZRATMAX, DX_X, DZ_Z, FINAL_DX_X, FINAL_DZ_Z,
  287:      $                   EPS, HUGEVAL, INCR_THRESH
  288:       LOGICAL            INCR_PREC
  289:       COMPLEX*16         ZDUM
  290: *     ..
  291: *     .. Parameters ..
  292:       INTEGER            UNSTABLE_STATE, WORKING_STATE, CONV_STATE,
  293:      $                   NOPROG_STATE, BASE_RESIDUAL, EXTRA_RESIDUAL,
  294:      $                   EXTRA_Y
  295:       PARAMETER          ( UNSTABLE_STATE = 0, WORKING_STATE = 1,
  296:      $                   CONV_STATE = 2, NOPROG_STATE = 3 )
  297:       PARAMETER          ( BASE_RESIDUAL = 0, EXTRA_RESIDUAL = 1,
  298:      $                   EXTRA_Y = 2 )
  299:       INTEGER            FINAL_NRM_ERR_I, FINAL_CMP_ERR_I, BERR_I
  300:       INTEGER            RCOND_I, NRM_RCOND_I, NRM_ERR_I, CMP_RCOND_I
  301:       INTEGER            CMP_ERR_I, PIV_GROWTH_I
  302:       PARAMETER          ( FINAL_NRM_ERR_I = 1, FINAL_CMP_ERR_I = 2,
  303:      $                   BERR_I = 3 )
  304:       PARAMETER          ( RCOND_I = 4, NRM_RCOND_I = 5, NRM_ERR_I = 6 )
  305:       PARAMETER          ( CMP_RCOND_I = 7, CMP_ERR_I = 8,
  306:      $                   PIV_GROWTH_I = 9 )
  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: *     .. External Functions ..
  318:       LOGICAL            LSAME
  319:       EXTERNAL           ILAUPLO
  320:       INTEGER            ILAUPLO
  321: *     ..
  322: *     .. External Subroutines ..
  323:       EXTERNAL           ZAXPY, ZCOPY, ZSYTRS, ZSYMV, BLAS_ZSYMV_X,
  324:      $                   BLAS_ZSYMV2_X, ZLA_SYAMV, ZLA_WWADDW,
  325:      $                   ZLA_LIN_BERR
  326:       DOUBLE PRECISION   DLAMCH
  327: *     ..
  328: *     .. Intrinsic Functions ..
  329:       INTRINSIC          ABS, REAL, DIMAG, MAX, MIN
  330: *     ..
  331: *     .. Statement Functions ..
  332:       DOUBLE PRECISION   CABS1
  333: *     ..
  334: *     .. Statement Function Definitions ..
  335:       CABS1( ZDUM ) = ABS( DBLE( ZDUM ) ) + ABS( DIMAG( ZDUM ) )
  336: *     ..
  337: *     .. Executable Statements ..
  338: *
  339:       IF ( INFO.NE.0 ) RETURN
  340:       EPS = DLAMCH( 'Epsilon' )
  341:       HUGEVAL = DLAMCH( 'Overflow' )
  342: *     Force HUGEVAL to Inf
  343:       HUGEVAL = HUGEVAL * HUGEVAL
  344: *     Using HUGEVAL may lead to spurious underflows.
  345:       INCR_THRESH = DBLE( N ) * EPS
  346: 
  347:       IF ( LSAME ( UPLO, 'L' ) ) THEN
  348:          UPLO2 = ILAUPLO( 'L' )
  349:       ELSE
  350:          UPLO2 = ILAUPLO( 'U' )
  351:       ENDIF
  352: 
  353:       DO J = 1, NRHS
  354:          Y_PREC_STATE = EXTRA_RESIDUAL
  355:          IF ( Y_PREC_STATE .EQ. EXTRA_Y ) THEN
  356:             DO I = 1, N
  357:                Y_TAIL( I ) = 0.0D+0
  358:             END DO
  359:          END IF
  360: 
  361:          DXRAT = 0.0D+0
  362:          DXRATMAX = 0.0D+0
  363:          DZRAT = 0.0D+0
  364:          DZRATMAX = 0.0D+0
  365:          FINAL_DX_X = HUGEVAL
  366:          FINAL_DZ_Z = HUGEVAL
  367:          PREVNORMDX = HUGEVAL
  368:          PREV_DZ_Z = HUGEVAL
  369:          DZ_Z = HUGEVAL
  370:          DX_X = HUGEVAL
  371: 
  372:          X_STATE = WORKING_STATE
  373:          Z_STATE = UNSTABLE_STATE
  374:          INCR_PREC = .FALSE.
  375: 
  376:          DO CNT = 1, ITHRESH
  377: *
  378: *         Compute residual RES = B_s - op(A_s) * Y,
  379: *             op(A) = A, A**T, or A**H depending on TRANS (and type).
  380: *
  381:             CALL ZCOPY( N, B( 1, J ), 1, RES, 1 )
  382:             IF ( Y_PREC_STATE .EQ. BASE_RESIDUAL ) THEN
  383:                CALL ZSYMV( UPLO, N, DCMPLX(-1.0D+0), A, LDA, Y(1,J), 1,
  384:      $              DCMPLX(1.0D+0), RES, 1 )
  385:             ELSE IF ( Y_PREC_STATE .EQ. EXTRA_RESIDUAL ) THEN
  386:                CALL BLAS_ZSYMV_X( UPLO2, N, DCMPLX(-1.0D+0), A, LDA,
  387:      $              Y( 1, J ), 1, DCMPLX(1.0D+0), RES, 1, PREC_TYPE )
  388:             ELSE
  389:                CALL BLAS_ZSYMV2_X(UPLO2, N, DCMPLX(-1.0D+0), A, LDA,
  390:      $              Y(1, J), Y_TAIL, 1, DCMPLX(1.0D+0), RES, 1,
  391:      $     PREC_TYPE)
  392:             END IF
  393: 
  394: !         XXX: RES is no longer needed.
  395:             CALL ZCOPY( N, RES, 1, DY, 1 )
  396:             CALL ZSYTRS( UPLO, N, 1, AF, LDAF, IPIV, DY, N, INFO )
  397: *
  398: *         Calculate relative changes DX_X, DZ_Z and ratios DXRAT, DZRAT.
  399: *
  400:             NORMX = 0.0D+0
  401:             NORMY = 0.0D+0
  402:             NORMDX = 0.0D+0
  403:             DZ_Z = 0.0D+0
  404:             YMIN = HUGEVAL
  405: 
  406:             DO I = 1, N
  407:                YK = CABS1( Y( I, J ) )
  408:                DYK = CABS1( DY( I ) )
  409: 
  410:                IF ( YK .NE. 0.0D+0 ) THEN
  411:                   DZ_Z = MAX( DZ_Z, DYK / YK )
  412:                ELSE IF ( DYK .NE. 0.0D+0 ) THEN
  413:                   DZ_Z = HUGEVAL
  414:                END IF
  415: 
  416:                YMIN = MIN( YMIN, YK )
  417: 
  418:                NORMY = MAX( NORMY, YK )
  419: 
  420:                IF ( COLEQU ) THEN
  421:                   NORMX = MAX( NORMX, YK * C( I ) )
  422:                   NORMDX = MAX( NORMDX, DYK * C( I ) )
  423:                ELSE
  424:                   NORMX = NORMY
  425:                   NORMDX = MAX( NORMDX, DYK )
  426:                END IF
  427:             END DO
  428: 
  429:             IF ( NORMX .NE. 0.0D+0 ) THEN
  430:                DX_X = NORMDX / NORMX
  431:             ELSE IF ( NORMDX .EQ. 0.0D+0 ) THEN
  432:                DX_X = 0.0D+0
  433:             ELSE
  434:                DX_X = HUGEVAL
  435:             END IF
  436: 
  437:             DXRAT = NORMDX / PREVNORMDX
  438:             DZRAT = DZ_Z / PREV_DZ_Z
  439: *
  440: *         Check termination criteria.
  441: *
  442:             IF ( YMIN*RCOND .LT. INCR_THRESH*NORMY
  443:      $           .AND. Y_PREC_STATE .LT. EXTRA_Y )
  444:      $           INCR_PREC = .TRUE.
  445: 
  446:             IF ( X_STATE .EQ. NOPROG_STATE .AND. DXRAT .LE. RTHRESH )
  447:      $           X_STATE = WORKING_STATE
  448:             IF ( X_STATE .EQ. WORKING_STATE ) THEN
  449:                IF ( DX_X .LE. EPS ) THEN
  450:                   X_STATE = CONV_STATE
  451:                ELSE IF ( DXRAT .GT. RTHRESH ) THEN
  452:                   IF ( Y_PREC_STATE .NE. EXTRA_Y ) THEN
  453:                      INCR_PREC = .TRUE.
  454:                   ELSE
  455:                      X_STATE = NOPROG_STATE
  456:                   END IF
  457:                ELSE
  458:                   IF (DXRAT .GT. DXRATMAX) DXRATMAX = DXRAT
  459:                END IF
  460:                IF ( X_STATE .GT. WORKING_STATE ) FINAL_DX_X = DX_X
  461:             END IF
  462: 
  463:             IF ( Z_STATE .EQ. UNSTABLE_STATE .AND. DZ_Z .LE. DZ_UB )
  464:      $           Z_STATE = WORKING_STATE
  465:             IF ( Z_STATE .EQ. NOPROG_STATE .AND. DZRAT .LE. RTHRESH )
  466:      $           Z_STATE = WORKING_STATE
  467:             IF ( Z_STATE .EQ. WORKING_STATE ) THEN
  468:                IF ( DZ_Z .LE. EPS ) THEN
  469:                   Z_STATE = CONV_STATE
  470:                ELSE IF ( DZ_Z .GT. DZ_UB ) THEN
  471:                   Z_STATE = UNSTABLE_STATE
  472:                   DZRATMAX = 0.0D+0
  473:                   FINAL_DZ_Z = HUGEVAL
  474:                ELSE IF ( DZRAT .GT. RTHRESH ) THEN
  475:                   IF ( Y_PREC_STATE .NE. EXTRA_Y ) THEN
  476:                      INCR_PREC = .TRUE.
  477:                   ELSE
  478:                      Z_STATE = NOPROG_STATE
  479:                   END IF
  480:                ELSE
  481:                   IF ( DZRAT .GT. DZRATMAX ) DZRATMAX = DZRAT
  482:                END IF
  483:                IF ( Z_STATE .GT. WORKING_STATE ) FINAL_DZ_Z = DZ_Z
  484:             END IF
  485: 
  486:             IF ( X_STATE.NE.WORKING_STATE.AND.
  487:      $           ( IGNORE_CWISE.OR.Z_STATE.NE.WORKING_STATE ) )
  488:      $           GOTO 666
  489: 
  490:             IF ( INCR_PREC ) THEN
  491:                INCR_PREC = .FALSE.
  492:                Y_PREC_STATE = Y_PREC_STATE + 1
  493:                DO I = 1, N
  494:                   Y_TAIL( I ) = 0.0D+0
  495:                END DO
  496:             END IF
  497: 
  498:             PREVNORMDX = NORMDX
  499:             PREV_DZ_Z = DZ_Z
  500: *
  501: *           Update soluton.
  502: *
  503:             IF ( Y_PREC_STATE .LT. EXTRA_Y ) THEN
  504:                CALL ZAXPY( N, DCMPLX(1.0D+0), DY, 1, Y(1,J), 1 )
  505:             ELSE
  506:                CALL ZLA_WWADDW( N, Y(1,J), Y_TAIL, DY )
  507:             END IF
  508: 
  509:          END DO
  510: *        Target of "IF (Z_STOP .AND. X_STOP)".  Sun's f77 won't EXIT.
  511:  666     CONTINUE
  512: *
  513: *     Set final_* when cnt hits ithresh.
  514: *
  515:          IF ( X_STATE .EQ. WORKING_STATE ) FINAL_DX_X = DX_X
  516:          IF ( Z_STATE .EQ. WORKING_STATE ) FINAL_DZ_Z = DZ_Z
  517: *
  518: *     Compute error bounds.
  519: *
  520:          IF ( N_NORMS .GE. 1 ) THEN
  521:             ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) =
  522:      $           FINAL_DX_X / (1 - DXRATMAX)
  523:          END IF
  524:          IF ( N_NORMS .GE. 2 ) THEN
  525:             ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) =
  526:      $           FINAL_DZ_Z / (1 - DZRATMAX)
  527:          END IF
  528: *
  529: *     Compute componentwise relative backward error from formula
  530: *         max(i) ( abs(R(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
  531: *     where abs(Z) is the componentwise absolute value of the matrix
  532: *     or vector Z.
  533: *
  534: *        Compute residual RES = B_s - op(A_s) * Y,
  535: *            op(A) = A, A**T, or A**H depending on TRANS (and type).
  536: *
  537:          CALL ZCOPY( N, B( 1, J ), 1, RES, 1 )
  538:          CALL ZSYMV( UPLO, N, DCMPLX(-1.0D+0), A, LDA, Y(1,J), 1,
  539:      $        DCMPLX(1.0D+0), RES, 1 )
  540: 
  541:          DO I = 1, N
  542:             AYB( I ) = CABS1( B( I, J ) )
  543:          END DO
  544: *
  545: *     Compute abs(op(A_s))*abs(Y) + abs(B_s).
  546: *
  547:          CALL ZLA_SYAMV ( UPLO2, N, 1.0D+0,
  548:      $        A, LDA, Y(1, J), 1, 1.0D+0, AYB, 1 )
  549: 
  550:          CALL ZLA_LIN_BERR ( N, N, 1, RES, AYB, BERR_OUT( J ) )
  551: *
  552: *     End of loop for each RHS.
  553: *
  554:       END DO
  555: *
  556:       RETURN
  557:       END

CVSweb interface <joel.bertrand@systella.fr>