LAPACK 3.3.0

zla_herfsx_extended.f

Go to the documentation of this file.
00001       SUBROUTINE ZLA_HERFSX_EXTENDED( PREC_TYPE, UPLO, N, NRHS, A, LDA,
00002      $                                AF, LDAF, IPIV, COLEQU, C, B, LDB,
00003      $                                Y, LDY, BERR_OUT, N_NORMS,
00004      $                                ERR_BNDS_NORM, ERR_BNDS_COMP, RES,
00005      $                                AYB, DY, Y_TAIL, RCOND, ITHRESH,
00006      $                                RTHRESH, DZ_UB, IGNORE_CWISE,
00007      $                                INFO )
00008 *
00009 *     -- LAPACK routine (version 3.2.2)                                 --
00010 *     -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
00011 *     -- Jason Riedy of Univ. of California Berkeley.                 --
00012 *     -- June 2010                                                    --
00013 *
00014 *     -- LAPACK is a software package provided by Univ. of Tennessee, --
00015 *     -- Univ. of California Berkeley and NAG Ltd.                    --
00016 *
00017       IMPLICIT NONE
00018 *     ..
00019 *     .. Scalar Arguments ..
00020       INTEGER            INFO, LDA, LDAF, LDB, LDY, N, NRHS, PREC_TYPE,
00021      $                   N_NORMS, ITHRESH
00022       CHARACTER          UPLO
00023       LOGICAL            COLEQU, IGNORE_CWISE
00024       DOUBLE PRECISION   RTHRESH, DZ_UB
00025 *     ..
00026 *     .. Array Arguments ..
00027       INTEGER            IPIV( * )
00028       COMPLEX*16         A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
00029      $                   Y( LDY, * ), RES( * ), DY( * ), Y_TAIL( * )
00030       DOUBLE PRECISION   C( * ), AYB( * ), RCOND, BERR_OUT( * ),
00031      $                   ERR_BNDS_NORM( NRHS, * ),
00032      $                   ERR_BNDS_COMP( NRHS, * )
00033 *     ..
00034 *
00035 *  Purpose
00036 *  =======
00037 *
00038 *  ZLA_HERFSX_EXTENDED improves the computed solution to a system of
00039 *  linear equations by performing extra-precise iterative refinement
00040 *  and provides error bounds and backward error estimates for the solution.
00041 *  This subroutine is called by ZHERFSX to perform iterative refinement.
00042 *  In addition to normwise error bound, the code provides maximum
00043 *  componentwise error bound if possible. See comments for ERR_BNDS_NORM
00044 *  and ERR_BNDS_COMP for details of the error bounds. Note that this
00045 *  subroutine is only resonsible for setting the second fields of
00046 *  ERR_BNDS_NORM and ERR_BNDS_COMP.
00047 *
00048 *  Arguments
00049 *  =========
00050 *
00051 *     PREC_TYPE      (input) INTEGER
00052 *     Specifies the intermediate precision to be used in refinement.
00053 *     The value is defined by ILAPREC(P) where P is a CHARACTER and
00054 *     P    = 'S':  Single
00055 *          = 'D':  Double
00056 *          = 'I':  Indigenous
00057 *          = 'X', 'E':  Extra
00058 *
00059 *     UPLO    (input) CHARACTER*1
00060 *       = 'U':  Upper triangle of A is stored;
00061 *       = 'L':  Lower triangle of A is stored.
00062 *
00063 *     N              (input) INTEGER
00064 *     The number of linear equations, i.e., the order of the
00065 *     matrix A.  N >= 0.
00066 *
00067 *     NRHS           (input) INTEGER
00068 *     The number of right-hand-sides, i.e., the number of columns of the
00069 *     matrix B.
00070 *
00071 *     A              (input) COMPLEX*16 array, dimension (LDA,N)
00072 *     On entry, the N-by-N matrix A.
00073 *
00074 *     LDA            (input) INTEGER
00075 *     The leading dimension of the array A.  LDA >= max(1,N).
00076 *
00077 *     AF             (input) COMPLEX*16 array, dimension (LDAF,N)
00078 *     The block diagonal matrix D and the multipliers used to
00079 *     obtain the factor U or L as computed by ZHETRF.
00080 *
00081 *     LDAF           (input) INTEGER
00082 *     The leading dimension of the array AF.  LDAF >= max(1,N).
00083 *
00084 *     IPIV           (input) INTEGER array, dimension (N)
00085 *     Details of the interchanges and the block structure of D
00086 *     as determined by ZHETRF.
00087 *
00088 *     COLEQU         (input) LOGICAL
00089 *     If .TRUE. then column equilibration was done to A before calling
00090 *     this routine. This is needed to compute the solution and error
00091 *     bounds correctly.
00092 *
00093 *     C              (input) DOUBLE PRECISION array, dimension (N)
00094 *     The column scale factors for A. If COLEQU = .FALSE., C
00095 *     is not accessed. If C is input, each element of C should be a power
00096 *     of the radix to ensure a reliable solution and error estimates.
00097 *     Scaling by powers of the radix does not cause rounding errors unless
00098 *     the result underflows or overflows. Rounding errors during scaling
00099 *     lead to refining with a matrix that is not equivalent to the
00100 *     input matrix, producing error estimates that may not be
00101 *     reliable.
00102 *
00103 *     B              (input) COMPLEX*16 array, dimension (LDB,NRHS)
00104 *     The right-hand-side matrix B.
00105 *
00106 *     LDB            (input) INTEGER
00107 *     The leading dimension of the array B.  LDB >= max(1,N).
00108 *
00109 *     Y              (input/output) COMPLEX*16 array, dimension
00110 *                    (LDY,NRHS)
00111 *     On entry, the solution matrix X, as computed by ZHETRS.
00112 *     On exit, the improved solution matrix Y.
00113 *
00114 *     LDY            (input) INTEGER
00115 *     The leading dimension of the array Y.  LDY >= max(1,N).
00116 *
00117 *     BERR_OUT       (output) DOUBLE PRECISION array, dimension (NRHS)
00118 *     On exit, BERR_OUT(j) contains the componentwise relative backward
00119 *     error for right-hand-side j from the formula
00120 *         max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
00121 *     where abs(Z) is the componentwise absolute value of the matrix
00122 *     or vector Z. This is computed by ZLA_LIN_BERR.
00123 *
00124 *     N_NORMS        (input) INTEGER
00125 *     Determines which error bounds to return (see ERR_BNDS_NORM
00126 *     and ERR_BNDS_COMP).
00127 *     If N_NORMS >= 1 return normwise error bounds.
00128 *     If N_NORMS >= 2 return componentwise error bounds.
00129 *
00130 *     ERR_BNDS_NORM  (input/output) DOUBLE PRECISION array, dimension
00131 *                    (NRHS, N_ERR_BNDS)
00132 *     For each right-hand side, this array contains information about
00133 *     various error bounds and condition numbers corresponding to the
00134 *     normwise relative error, which is defined as follows:
00135 *
00136 *     Normwise relative error in the ith solution vector:
00137 *             max_j (abs(XTRUE(j,i) - X(j,i)))
00138 *            ------------------------------
00139 *                  max_j abs(X(j,i))
00140 *
00141 *     The array is indexed by the type of error information as described
00142 *     below. There currently are up to three pieces of information
00143 *     returned.
00144 *
00145 *     The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
00146 *     right-hand side.
00147 *
00148 *     The second index in ERR_BNDS_NORM(:,err) contains the following
00149 *     three fields:
00150 *     err = 1 "Trust/don't trust" boolean. Trust the answer if the
00151 *              reciprocal condition number is less than the threshold
00152 *              sqrt(n) * slamch('Epsilon').
00153 *
00154 *     err = 2 "Guaranteed" error bound: The estimated forward error,
00155 *              almost certainly within a factor of 10 of the true error
00156 *              so long as the next entry is greater than the threshold
00157 *              sqrt(n) * slamch('Epsilon'). This error bound should only
00158 *              be trusted if the previous boolean is true.
00159 *
00160 *     err = 3  Reciprocal condition number: Estimated normwise
00161 *              reciprocal condition number.  Compared with the threshold
00162 *              sqrt(n) * slamch('Epsilon') to determine if the error
00163 *              estimate is "guaranteed". These reciprocal condition
00164 *              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
00165 *              appropriately scaled matrix Z.
00166 *              Let Z = S*A, where S scales each row by a power of the
00167 *              radix so all absolute row sums of Z are approximately 1.
00168 *
00169 *     This subroutine is only responsible for setting the second field
00170 *     above.
00171 *     See Lapack Working Note 165 for further details and extra
00172 *     cautions.
00173 *
00174 *     ERR_BNDS_COMP  (input/output) DOUBLE PRECISION array, dimension
00175 *                    (NRHS, N_ERR_BNDS)
00176 *     For each right-hand side, this array contains information about
00177 *     various error bounds and condition numbers corresponding to the
00178 *     componentwise relative error, which is defined as follows:
00179 *
00180 *     Componentwise relative error in the ith solution vector:
00181 *                    abs(XTRUE(j,i) - X(j,i))
00182 *             max_j ----------------------
00183 *                         abs(X(j,i))
00184 *
00185 *     The array is indexed by the right-hand side i (on which the
00186 *     componentwise relative error depends), and the type of error
00187 *     information as described below. There currently are up to three
00188 *     pieces of information returned for each right-hand side. If
00189 *     componentwise accuracy is not requested (PARAMS(3) = 0.0), then
00190 *     ERR_BNDS_COMP is not accessed.  If N_ERR_BNDS .LT. 3, then at most
00191 *     the first (:,N_ERR_BNDS) entries are returned.
00192 *
00193 *     The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
00194 *     right-hand side.
00195 *
00196 *     The second index in ERR_BNDS_COMP(:,err) contains the following
00197 *     three fields:
00198 *     err = 1 "Trust/don't trust" boolean. Trust the answer if the
00199 *              reciprocal condition number is less than the threshold
00200 *              sqrt(n) * slamch('Epsilon').
00201 *
00202 *     err = 2 "Guaranteed" error bound: The estimated forward error,
00203 *              almost certainly within a factor of 10 of the true error
00204 *              so long as the next entry is greater than the threshold
00205 *              sqrt(n) * slamch('Epsilon'). This error bound should only
00206 *              be trusted if the previous boolean is true.
00207 *
00208 *     err = 3  Reciprocal condition number: Estimated componentwise
00209 *              reciprocal condition number.  Compared with the threshold
00210 *              sqrt(n) * slamch('Epsilon') to determine if the error
00211 *              estimate is "guaranteed". These reciprocal condition
00212 *              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
00213 *              appropriately scaled matrix Z.
00214 *              Let Z = S*(A*diag(x)), where x is the solution for the
00215 *              current right-hand side and S scales each row of
00216 *              A*diag(x) by a power of the radix so all absolute row
00217 *              sums of Z are approximately 1.
00218 *
00219 *     This subroutine is only responsible for setting the second field
00220 *     above.
00221 *     See Lapack Working Note 165 for further details and extra
00222 *     cautions.
00223 *
00224 *     RES            (input) COMPLEX*16 array, dimension (N)
00225 *     Workspace to hold the intermediate residual.
00226 *
00227 *     AYB            (input) DOUBLE PRECISION array, dimension (N)
00228 *     Workspace.
00229 *
00230 *     DY             (input) COMPLEX*16 array, dimension (N)
00231 *     Workspace to hold the intermediate solution.
00232 *
00233 *     Y_TAIL         (input) COMPLEX*16 array, dimension (N)
00234 *     Workspace to hold the trailing bits of the intermediate solution.
00235 *
00236 *     RCOND          (input) DOUBLE PRECISION
00237 *     Reciprocal scaled condition number.  This is an estimate of the
00238 *     reciprocal Skeel condition number of the matrix A after
00239 *     equilibration (if done).  If this is less than the machine
00240 *     precision (in particular, if it is zero), the matrix is singular
00241 *     to working precision.  Note that the error may still be small even
00242 *     if this number is very small and the matrix appears ill-
00243 *     conditioned.
00244 *
00245 *     ITHRESH        (input) INTEGER
00246 *     The maximum number of residual computations allowed for
00247 *     refinement. The default is 10. For 'aggressive' set to 100 to
00248 *     permit convergence using approximate factorizations or
00249 *     factorizations other than LU. If the factorization uses a
00250 *     technique other than Gaussian elimination, the guarantees in
00251 *     ERR_BNDS_NORM and ERR_BNDS_COMP may no longer be trustworthy.
00252 *
00253 *     RTHRESH        (input) DOUBLE PRECISION
00254 *     Determines when to stop refinement if the error estimate stops
00255 *     decreasing. Refinement will stop when the next solution no longer
00256 *     satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
00257 *     the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
00258 *     default value is 0.5. For 'aggressive' set to 0.9 to permit
00259 *     convergence on extremely ill-conditioned matrices. See LAWN 165
00260 *     for more details.
00261 *
00262 *     DZ_UB          (input) DOUBLE PRECISION
00263 *     Determines when to start considering componentwise convergence.
00264 *     Componentwise convergence is only considered after each component
00265 *     of the solution Y is stable, which we definte as the relative
00266 *     change in each component being less than DZ_UB. The default value
00267 *     is 0.25, requiring the first bit to be stable. See LAWN 165 for
00268 *     more details.
00269 *
00270 *     IGNORE_CWISE   (input) LOGICAL
00271 *     If .TRUE. then ignore componentwise convergence. Default value
00272 *     is .FALSE..
00273 *
00274 *     INFO           (output) INTEGER
00275 *       = 0:  Successful exit.
00276 *       < 0:  if INFO = -i, the ith argument to ZHETRS had an illegal
00277 *             value
00278 *
00279 *  =====================================================================
00280 *
00281 *     .. Local Scalars ..
00282       INTEGER            UPLO2, CNT, I, J, X_STATE, Z_STATE,
00283      $                   Y_PREC_STATE
00284       DOUBLE PRECISION   YK, DYK, YMIN, NORMY, NORMX, NORMDX, DXRAT,
00285      $                   DZRAT, PREVNORMDX, PREV_DZ_Z, DXRATMAX,
00286      $                   DZRATMAX, DX_X, DZ_Z, FINAL_DX_X, FINAL_DZ_Z,
00287      $                   EPS, HUGEVAL, INCR_THRESH
00288       LOGICAL            INCR_PREC
00289       COMPLEX*16         ZDUM
00290 *     ..
00291 *     .. Parameters ..
00292       INTEGER            UNSTABLE_STATE, WORKING_STATE, CONV_STATE,
00293      $                   NOPROG_STATE, BASE_RESIDUAL, EXTRA_RESIDUAL,
00294      $                   EXTRA_Y
00295       PARAMETER          ( UNSTABLE_STATE = 0, WORKING_STATE = 1,
00296      $                   CONV_STATE = 2, NOPROG_STATE = 3 )
00297       PARAMETER          ( BASE_RESIDUAL = 0, EXTRA_RESIDUAL = 1,
00298      $                   EXTRA_Y = 2 )
00299       INTEGER            FINAL_NRM_ERR_I, FINAL_CMP_ERR_I, BERR_I
00300       INTEGER            RCOND_I, NRM_RCOND_I, NRM_ERR_I, CMP_RCOND_I
00301       INTEGER            CMP_ERR_I, PIV_GROWTH_I
00302       PARAMETER          ( FINAL_NRM_ERR_I = 1, FINAL_CMP_ERR_I = 2,
00303      $                   BERR_I = 3 )
00304       PARAMETER          ( RCOND_I = 4, NRM_RCOND_I = 5, NRM_ERR_I = 6 )
00305       PARAMETER          ( CMP_RCOND_I = 7, CMP_ERR_I = 8,
00306      $                   PIV_GROWTH_I = 9 )
00307       INTEGER            LA_LINRX_ITREF_I, LA_LINRX_ITHRESH_I,
00308      $                   LA_LINRX_CWISE_I
00309       PARAMETER          ( LA_LINRX_ITREF_I = 1,
00310      $                   LA_LINRX_ITHRESH_I = 2 )
00311       PARAMETER          ( LA_LINRX_CWISE_I = 3 )
00312       INTEGER            LA_LINRX_TRUST_I, LA_LINRX_ERR_I,
00313      $                   LA_LINRX_RCOND_I
00314       PARAMETER          ( LA_LINRX_TRUST_I = 1, LA_LINRX_ERR_I = 2 )
00315       PARAMETER          ( LA_LINRX_RCOND_I = 3 )
00316 *     ..
00317 *     .. External Functions ..
00318       LOGICAL            LSAME
00319       EXTERNAL           ILAUPLO
00320       INTEGER            ILAUPLO
00321 *     ..
00322 *     .. External Subroutines ..
00323       EXTERNAL           ZAXPY, ZCOPY, ZHETRS, ZHEMV, BLAS_ZHEMV_X,
00324      $                   BLAS_ZHEMV2_X, ZLA_HEAMV, ZLA_WWADDW,
00325      $                   ZLA_LIN_BERR
00326       DOUBLE PRECISION   DLAMCH
00327 *     ..
00328 *     .. Intrinsic Functions ..
00329       INTRINSIC          ABS, DBLE, DIMAG, MAX, MIN
00330 *     ..
00331 *     .. Statement Functions ..
00332       DOUBLE PRECISION   CABS1
00333 *     ..
00334 *     .. Statement Function Definitions ..
00335       CABS1( ZDUM ) = ABS( DBLE( ZDUM ) ) + ABS( DIMAG( ZDUM ) )
00336 *     ..
00337 *     .. Executable Statements ..
00338 *
00339       IF (INFO.NE.0) RETURN
00340       EPS = DLAMCH( 'Epsilon' )
00341       HUGEVAL = DLAMCH( 'Overflow' )
00342 *     Force HUGEVAL to Inf
00343       HUGEVAL = HUGEVAL * HUGEVAL
00344 *     Using HUGEVAL may lead to spurious underflows.
00345       INCR_THRESH = DBLE( N ) * EPS
00346 
00347       IF ( LSAME ( UPLO, 'L' ) ) THEN
00348          UPLO2 = ILAUPLO( 'L' )
00349       ELSE
00350          UPLO2 = ILAUPLO( 'U' )
00351       ENDIF
00352 
00353       DO J = 1, NRHS
00354          Y_PREC_STATE = EXTRA_RESIDUAL
00355          IF ( Y_PREC_STATE .EQ. EXTRA_Y ) THEN
00356             DO I = 1, N
00357                Y_TAIL( I ) = 0.0D+0
00358             END DO
00359          END IF
00360 
00361          DXRAT = 0.0D+0
00362          DXRATMAX = 0.0D+0
00363          DZRAT = 0.0D+0
00364          DZRATMAX = 0.0D+0
00365          FINAL_DX_X = HUGEVAL
00366          FINAL_DZ_Z = HUGEVAL
00367          PREVNORMDX = HUGEVAL
00368          PREV_DZ_Z = HUGEVAL
00369          DZ_Z = HUGEVAL
00370          DX_X = HUGEVAL
00371 
00372          X_STATE = WORKING_STATE
00373          Z_STATE = UNSTABLE_STATE
00374          INCR_PREC = .FALSE.
00375 
00376          DO CNT = 1, ITHRESH
00377 *
00378 *         Compute residual RES = B_s - op(A_s) * Y,
00379 *             op(A) = A, A**T, or A**H depending on TRANS (and type).
00380 *
00381             CALL ZCOPY( N, B( 1, J ), 1, RES, 1 )
00382             IF ( Y_PREC_STATE .EQ. BASE_RESIDUAL ) THEN
00383                CALL ZHEMV( UPLO, N, DCMPLX(-1.0D+0), A, LDA, Y( 1, J ),
00384      $              1, DCMPLX(1.0D+0), RES, 1 )
00385             ELSE IF ( Y_PREC_STATE .EQ. EXTRA_RESIDUAL ) THEN
00386                CALL BLAS_ZHEMV_X( UPLO2, N, DCMPLX(-1.0D+0), A, LDA,
00387      $              Y( 1, J ), 1, DCMPLX(1.0D+0), RES, 1, PREC_TYPE)
00388             ELSE
00389                CALL BLAS_ZHEMV2_X(UPLO2, N, DCMPLX(-1.0D+0), A, LDA,
00390      $              Y(1, J), Y_TAIL, 1, DCMPLX(1.0D+0), RES, 1,
00391      $     PREC_TYPE)
00392             END IF
00393 
00394 !         XXX: RES is no longer needed.
00395             CALL ZCOPY( N, RES, 1, DY, 1 )
00396             CALL ZHETRS( UPLO, N, 1, AF, LDAF, IPIV, DY, N, INFO )
00397 *
00398 *         Calculate relative changes DX_X, DZ_Z and ratios DXRAT, DZRAT.
00399 *
00400             NORMX = 0.0D+0
00401             NORMY = 0.0D+0
00402             NORMDX = 0.0D+0
00403             DZ_Z = 0.0D+0
00404             YMIN = HUGEVAL
00405 
00406             DO I = 1, N
00407                YK = CABS1( Y( I, J ) )
00408                DYK = CABS1( DY( I ) )
00409 
00410                IF (YK .NE. 0.0D+0) THEN
00411                   DZ_Z = MAX( DZ_Z, DYK / YK )
00412                ELSE IF ( DYK .NE. 0.0D+0 ) THEN
00413                   DZ_Z = HUGEVAL
00414                END IF
00415 
00416                YMIN = MIN( YMIN, YK )
00417 
00418                NORMY = MAX( NORMY, YK )
00419 
00420                IF ( COLEQU ) THEN
00421                   NORMX = MAX( NORMX, YK * C( I ) )
00422                   NORMDX = MAX( NORMDX, DYK * C( I ) )
00423                ELSE
00424                   NORMX = NORMY
00425                   NORMDX = MAX( NORMDX, DYK )
00426                END IF
00427             END DO
00428 
00429             IF ( NORMX .NE. 0.0D+0 ) THEN
00430                DX_X = NORMDX / NORMX
00431             ELSE IF ( NORMDX .EQ. 0.0D+0 ) THEN
00432                DX_X = 0.0D+0
00433             ELSE
00434                DX_X = HUGEVAL
00435             END IF
00436 
00437             DXRAT = NORMDX / PREVNORMDX
00438             DZRAT = DZ_Z / PREV_DZ_Z
00439 *
00440 *         Check termination criteria.
00441 *
00442             IF ( YMIN*RCOND .LT. INCR_THRESH*NORMY
00443      $           .AND. Y_PREC_STATE .LT. EXTRA_Y )
00444      $           INCR_PREC = .TRUE.
00445 
00446             IF ( X_STATE .EQ. NOPROG_STATE .AND. DXRAT .LE. RTHRESH )
00447      $           X_STATE = WORKING_STATE
00448             IF ( X_STATE .EQ. WORKING_STATE ) THEN
00449                IF ( DX_X .LE. EPS ) THEN
00450                   X_STATE = CONV_STATE
00451                ELSE IF ( DXRAT .GT. RTHRESH ) THEN
00452                   IF ( Y_PREC_STATE .NE. EXTRA_Y ) THEN
00453                      INCR_PREC = .TRUE.
00454                   ELSE
00455                      X_STATE = NOPROG_STATE
00456                   END IF
00457                ELSE
00458                   IF (DXRAT .GT. DXRATMAX) DXRATMAX = DXRAT
00459                END IF
00460                IF ( X_STATE .GT. WORKING_STATE ) FINAL_DX_X = DX_X
00461             END IF
00462 
00463             IF ( Z_STATE .EQ. UNSTABLE_STATE .AND. DZ_Z .LE. DZ_UB )
00464      $           Z_STATE = WORKING_STATE
00465             IF ( Z_STATE .EQ. NOPROG_STATE .AND. DZRAT .LE. RTHRESH )
00466      $           Z_STATE = WORKING_STATE
00467             IF ( Z_STATE .EQ. WORKING_STATE ) THEN
00468                IF ( DZ_Z .LE. EPS ) THEN
00469                   Z_STATE = CONV_STATE
00470                ELSE IF ( DZ_Z .GT. DZ_UB ) THEN
00471                   Z_STATE = UNSTABLE_STATE
00472                   DZRATMAX = 0.0D+0
00473                   FINAL_DZ_Z = HUGEVAL
00474                ELSE IF ( DZRAT .GT. RTHRESH ) THEN
00475                   IF ( Y_PREC_STATE .NE. EXTRA_Y ) THEN
00476                      INCR_PREC = .TRUE.
00477                   ELSE
00478                      Z_STATE = NOPROG_STATE
00479                   END IF
00480                ELSE
00481                   IF ( DZRAT .GT. DZRATMAX ) DZRATMAX = DZRAT
00482                END IF
00483                IF ( Z_STATE .GT. WORKING_STATE ) FINAL_DZ_Z = DZ_Z
00484             END IF
00485 
00486             IF ( X_STATE.NE.WORKING_STATE.AND.
00487      $           ( IGNORE_CWISE.OR.Z_STATE.NE.WORKING_STATE ) )
00488      $           GOTO 666
00489 
00490             IF ( INCR_PREC ) THEN
00491                INCR_PREC = .FALSE.
00492                Y_PREC_STATE = Y_PREC_STATE + 1
00493                DO I = 1, N
00494                   Y_TAIL( I ) = 0.0D+0
00495                END DO
00496             END IF
00497 
00498             PREVNORMDX = NORMDX
00499             PREV_DZ_Z = DZ_Z
00500 *
00501 *           Update soluton.
00502 *
00503             IF ( Y_PREC_STATE .LT. EXTRA_Y ) THEN
00504                CALL ZAXPY( N, DCMPLX(1.0D+0), DY, 1, Y(1,J), 1 )
00505             ELSE
00506                CALL ZLA_WWADDW( N, Y(1,J), Y_TAIL, DY )
00507             END IF
00508 
00509          END DO
00510 *        Target of "IF (Z_STOP .AND. X_STOP)".  Sun's f77 won't EXIT.
00511  666     CONTINUE
00512 *
00513 *     Set final_* when cnt hits ithresh.
00514 *
00515          IF ( X_STATE .EQ. WORKING_STATE ) FINAL_DX_X = DX_X
00516          IF ( Z_STATE .EQ. WORKING_STATE ) FINAL_DZ_Z = DZ_Z
00517 *
00518 *     Compute error bounds.
00519 *
00520          IF ( N_NORMS .GE. 1 ) THEN
00521             ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) =
00522      $           FINAL_DX_X / (1 - DXRATMAX)
00523          END IF
00524          IF (N_NORMS .GE. 2) THEN
00525             ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) =
00526      $           FINAL_DZ_Z / (1 - DZRATMAX)
00527          END IF
00528 *
00529 *     Compute componentwise relative backward error from formula
00530 *         max(i) ( abs(R(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
00531 *     where abs(Z) is the componentwise absolute value of the matrix
00532 *     or vector Z.
00533 *
00534 *         Compute residual RES = B_s - op(A_s) * Y,
00535 *             op(A) = A, A**T, or A**H depending on TRANS (and type).
00536 *
00537          CALL ZCOPY( N, B( 1, J ), 1, RES, 1 )
00538          CALL ZHEMV( UPLO, N, DCMPLX(-1.0D+0), A, LDA, Y(1,J), 1,
00539      $        DCMPLX(1.0D+0), RES, 1 )
00540 
00541          DO I = 1, N
00542             AYB( I ) = CABS1( B( I, J ) )
00543          END DO
00544 *
00545 *     Compute abs(op(A_s))*abs(Y) + abs(B_s).
00546 *
00547          CALL ZLA_HEAMV( UPLO2, N, 1.0D+0,
00548      $        A, LDA, Y(1, J), 1, 1.0D+0, AYB, 1 )
00549 
00550          CALL ZLA_LIN_BERR( N, N, 1, RES, AYB, BERR_OUT( J ) )
00551 *
00552 *     End of loop for each RHS.
00553 *
00554       END DO
00555 *
00556       RETURN
00557       END
 All Files Functions