Annotation of rpl/lapack/lapack/dla_porfsx_extended.f, revision 1.4

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

CVSweb interface <joel.bertrand@systella.fr>