LAPACK 3.3.0

dla_gerfsx_extended.f

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