LAPACK 3.3.1
Linear Algebra PACKage

dla_gbrfsx_extended.f

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