LAPACK 3.3.0

sla_syrfsx_extended.f

Go to the documentation of this file.
00001       SUBROUTINE SLA_SYRFSX_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       REAL               RTHRESH, DZ_UB
00025 *     ..
00026 *     .. Array Arguments ..
00027       INTEGER            IPIV( * )
00028       REAL               A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
00029      $                   Y( LDY, * ), RES( * ), DY( * ), Y_TAIL( * )
00030       REAL               C( * ), AYB( * ), RCOND, BERR_OUT( * ),
00031      $                   ERR_BNDS_NORM( NRHS, * ),
00032      $                   ERR_BNDS_COMP( NRHS, * )
00033 *     ..
00034 *
00035 *  Purpose
00036 *  =======
00037 * 
00038 *  SLA_SYRFSX_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 SSYRFSX 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) REAL 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) REAL 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 SSYTRF.
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 SSYTRF.
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) REAL 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) REAL 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) REAL array, dimension (LDY,NRHS)
00110 *     On entry, the solution matrix X, as computed by SSYTRS.
00111 *     On exit, the improved solution matrix Y.
00112 *
00113 *     LDY            (input) INTEGER
00114 *     The leading dimension of the array Y.  LDY >= max(1,N).
00115 *
00116 *     BERR_OUT       (output) REAL array, dimension (NRHS)
00117 *     On exit, BERR_OUT(j) contains the componentwise relative backward
00118 *     error for right-hand-side j from the formula
00119 *         max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
00120 *     where abs(Z) is the componentwise absolute value of the matrix
00121 *     or vector Z. This is computed by SLA_LIN_BERR.
00122 *
00123 *     N_NORMS        (input) INTEGER
00124 *     Determines which error bounds to return (see ERR_BNDS_NORM
00125 *     and ERR_BNDS_COMP).
00126 *     If N_NORMS >= 1 return normwise error bounds.
00127 *     If N_NORMS >= 2 return componentwise error bounds.
00128 *
00129 *     ERR_BNDS_NORM  (input/output) REAL array, dimension (NRHS, N_ERR_BNDS)
00130 *     For each right-hand side, this array contains information about
00131 *     various error bounds and condition numbers corresponding to the
00132 *     normwise relative error, which is defined as follows:
00133 *
00134 *     Normwise relative error in the ith solution vector:
00135 *             max_j (abs(XTRUE(j,i) - X(j,i)))
00136 *            ------------------------------
00137 *                  max_j abs(X(j,i))
00138 *
00139 *     The array is indexed by the type of error information as described
00140 *     below. There currently are up to three pieces of information
00141 *     returned.
00142 *
00143 *     The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
00144 *     right-hand side.
00145 *
00146 *     The second index in ERR_BNDS_NORM(:,err) contains the following
00147 *     three fields:
00148 *     err = 1 "Trust/don't trust" boolean. Trust the answer if the
00149 *              reciprocal condition number is less than the threshold
00150 *              sqrt(n) * slamch('Epsilon').
00151 *
00152 *     err = 2 "Guaranteed" error bound: The estimated forward error,
00153 *              almost certainly within a factor of 10 of the true error
00154 *              so long as the next entry is greater than the threshold
00155 *              sqrt(n) * slamch('Epsilon'). This error bound should only
00156 *              be trusted if the previous boolean is true.
00157 *
00158 *     err = 3  Reciprocal condition number: Estimated normwise
00159 *              reciprocal condition number.  Compared with the threshold
00160 *              sqrt(n) * slamch('Epsilon') to determine if the error
00161 *              estimate is "guaranteed". These reciprocal condition
00162 *              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
00163 *              appropriately scaled matrix Z.
00164 *              Let Z = S*A, where S scales each row by a power of the
00165 *              radix so all absolute row sums of Z are approximately 1.
00166 *
00167 *     This subroutine is only responsible for setting the second field
00168 *     above.
00169 *     See Lapack Working Note 165 for further details and extra
00170 *     cautions.
00171 *
00172 *     ERR_BNDS_COMP  (input/output) REAL array, dimension (NRHS, N_ERR_BNDS)
00173 *     For each right-hand side, this array contains information about
00174 *     various error bounds and condition numbers corresponding to the
00175 *     componentwise relative error, which is defined as follows:
00176 *
00177 *     Componentwise relative error in the ith solution vector:
00178 *                    abs(XTRUE(j,i) - X(j,i))
00179 *             max_j ----------------------
00180 *                         abs(X(j,i))
00181 *
00182 *     The array is indexed by the right-hand side i (on which the
00183 *     componentwise relative error depends), and the type of error
00184 *     information as described below. There currently are up to three
00185 *     pieces of information returned for each right-hand side. If
00186 *     componentwise accuracy is not requested (PARAMS(3) = 0.0), then
00187 *     ERR_BNDS_COMP is not accessed.  If N_ERR_BNDS .LT. 3, then at most
00188 *     the first (:,N_ERR_BNDS) entries are returned.
00189 *
00190 *     The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
00191 *     right-hand side.
00192 *
00193 *     The second index in ERR_BNDS_COMP(:,err) contains the following
00194 *     three fields:
00195 *     err = 1 "Trust/don't trust" boolean. Trust the answer if the
00196 *              reciprocal condition number is less than the threshold
00197 *              sqrt(n) * slamch('Epsilon').
00198 *
00199 *     err = 2 "Guaranteed" error bound: The estimated forward error,
00200 *              almost certainly within a factor of 10 of the true error
00201 *              so long as the next entry is greater than the threshold
00202 *              sqrt(n) * slamch('Epsilon'). This error bound should only
00203 *              be trusted if the previous boolean is true.
00204 *
00205 *     err = 3  Reciprocal condition number: Estimated componentwise
00206 *              reciprocal condition number.  Compared with the threshold
00207 *              sqrt(n) * slamch('Epsilon') to determine if the error
00208 *              estimate is "guaranteed". These reciprocal condition
00209 *              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
00210 *              appropriately scaled matrix Z.
00211 *              Let Z = S*(A*diag(x)), where x is the solution for the
00212 *              current right-hand side and S scales each row of
00213 *              A*diag(x) by a power of the radix so all absolute row
00214 *              sums of Z are approximately 1.
00215 *
00216 *     This subroutine is only responsible for setting the second field
00217 *     above.
00218 *     See Lapack Working Note 165 for further details and extra
00219 *     cautions.
00220 *
00221 *     RES            (input) REAL array, dimension (N)
00222 *     Workspace to hold the intermediate residual.
00223 *
00224 *     AYB            (input) REAL array, dimension (N)
00225 *     Workspace. This can be the same workspace passed for Y_TAIL.
00226 *
00227 *     DY             (input) REAL array, dimension (N)
00228 *     Workspace to hold the intermediate solution.
00229 *
00230 *     Y_TAIL         (input) REAL array, dimension (N)
00231 *     Workspace to hold the trailing bits of the intermediate solution.
00232 *
00233 *     RCOND          (input) REAL
00234 *     Reciprocal scaled condition number.  This is an estimate of the
00235 *     reciprocal Skeel condition number of the matrix A after
00236 *     equilibration (if done).  If this is less than the machine
00237 *     precision (in particular, if it is zero), the matrix is singular
00238 *     to working precision.  Note that the error may still be small even
00239 *     if this number is very small and the matrix appears ill-
00240 *     conditioned.
00241 *
00242 *     ITHRESH        (input) INTEGER
00243 *     The maximum number of residual computations allowed for
00244 *     refinement. The default is 10. For 'aggressive' set to 100 to
00245 *     permit convergence using approximate factorizations or
00246 *     factorizations other than LU. If the factorization uses a
00247 *     technique other than Gaussian elimination, the guarantees in
00248 *     ERR_BNDS_NORM and ERR_BNDS_COMP may no longer be trustworthy.
00249 *
00250 *     RTHRESH        (input) REAL
00251 *     Determines when to stop refinement if the error estimate stops
00252 *     decreasing. Refinement will stop when the next solution no longer
00253 *     satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
00254 *     the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
00255 *     default value is 0.5. For 'aggressive' set to 0.9 to permit
00256 *     convergence on extremely ill-conditioned matrices. See LAWN 165
00257 *     for more details.
00258 *
00259 *     DZ_UB          (input) REAL
00260 *     Determines when to start considering componentwise convergence.
00261 *     Componentwise convergence is only considered after each component
00262 *     of the solution Y is stable, which we definte as the relative
00263 *     change in each component being less than DZ_UB. The default value
00264 *     is 0.25, requiring the first bit to be stable. See LAWN 165 for
00265 *     more details.
00266 *
00267 *     IGNORE_CWISE   (input) LOGICAL
00268 *     If .TRUE. then ignore componentwise convergence. Default value
00269 *     is .FALSE..
00270 *
00271 *     INFO           (output) INTEGER
00272 *       = 0:  Successful exit.
00273 *       < 0:  if INFO = -i, the ith argument to SSYTRS had an illegal
00274 *             value
00275 *
00276 *  =====================================================================
00277 *
00278 *     .. Local Scalars ..
00279       INTEGER            UPLO2, CNT, I, J, X_STATE, Z_STATE
00280       REAL               YK, DYK, YMIN, NORMY, NORMX, NORMDX, DXRAT,
00281      $                   DZRAT, PREVNORMDX, PREV_DZ_Z, DXRATMAX,
00282      $                   DZRATMAX, DX_X, DZ_Z, FINAL_DX_X, FINAL_DZ_Z,
00283      $                   EPS, HUGEVAL, INCR_THRESH
00284       LOGICAL            INCR_PREC
00285 *     ..
00286 *     .. Parameters ..
00287       INTEGER            UNSTABLE_STATE, WORKING_STATE, CONV_STATE,
00288      $                   NOPROG_STATE, Y_PREC_STATE, BASE_RESIDUAL,
00289      $                   EXTRA_RESIDUAL, EXTRA_Y
00290       PARAMETER          ( UNSTABLE_STATE = 0, WORKING_STATE = 1,
00291      $                   CONV_STATE = 2, NOPROG_STATE = 3 )
00292       PARAMETER          ( BASE_RESIDUAL = 0, EXTRA_RESIDUAL = 1,
00293      $                   EXTRA_Y = 2 )
00294       INTEGER            FINAL_NRM_ERR_I, FINAL_CMP_ERR_I, BERR_I
00295       INTEGER            RCOND_I, NRM_RCOND_I, NRM_ERR_I, CMP_RCOND_I
00296       INTEGER            CMP_ERR_I, PIV_GROWTH_I
00297       PARAMETER          ( FINAL_NRM_ERR_I = 1, FINAL_CMP_ERR_I = 2,
00298      $                   BERR_I = 3 )
00299       PARAMETER          ( RCOND_I = 4, NRM_RCOND_I = 5, NRM_ERR_I = 6 )
00300       PARAMETER          ( CMP_RCOND_I = 7, CMP_ERR_I = 8,
00301      $                   PIV_GROWTH_I = 9 )
00302       INTEGER            LA_LINRX_ITREF_I, LA_LINRX_ITHRESH_I,
00303      $                   LA_LINRX_CWISE_I
00304       PARAMETER          ( LA_LINRX_ITREF_I = 1,
00305      $                   LA_LINRX_ITHRESH_I = 2 )
00306       PARAMETER          ( LA_LINRX_CWISE_I = 3 )
00307       INTEGER            LA_LINRX_TRUST_I, LA_LINRX_ERR_I,
00308      $                   LA_LINRX_RCOND_I
00309       PARAMETER          ( LA_LINRX_TRUST_I = 1, LA_LINRX_ERR_I = 2 )
00310       PARAMETER          ( LA_LINRX_RCOND_I = 3 )
00311 *     ..
00312 *     .. External Functions ..
00313       LOGICAL            LSAME
00314       EXTERNAL           ILAUPLO
00315       INTEGER            ILAUPLO
00316 *     ..
00317 *     .. External Subroutines ..
00318       EXTERNAL           SAXPY, SCOPY, SSYTRS, SSYMV, BLAS_SSYMV_X,
00319      $                   BLAS_SSYMV2_X, SLA_SYAMV, SLA_WWADDW,
00320      $                   SLA_LIN_BERR
00321       REAL               SLAMCH
00322 *     ..
00323 *     .. Intrinsic Functions ..
00324       INTRINSIC          ABS, MAX, MIN
00325 *     ..
00326 *     .. Executable Statements ..
00327 *
00328       IF ( INFO.NE.0 ) RETURN
00329       EPS = SLAMCH( 'Epsilon' )
00330       HUGEVAL = SLAMCH( 'Overflow' )
00331 *     Force HUGEVAL to Inf
00332       HUGEVAL = HUGEVAL * HUGEVAL
00333 *     Using HUGEVAL may lead to spurious underflows.
00334       INCR_THRESH = REAL( N )*EPS
00335 
00336       IF ( LSAME ( UPLO, 'L' ) ) THEN
00337          UPLO2 = ILAUPLO( 'L' )
00338       ELSE
00339          UPLO2 = ILAUPLO( 'U' )
00340       ENDIF
00341 
00342       DO J = 1, NRHS
00343          Y_PREC_STATE = EXTRA_RESIDUAL
00344          IF ( Y_PREC_STATE .EQ. EXTRA_Y ) THEN
00345             DO I = 1, N
00346                Y_TAIL( I ) = 0.0
00347             END DO
00348          END IF
00349 
00350          DXRAT = 0.0
00351          DXRATMAX = 0.0
00352          DZRAT = 0.0
00353          DZRATMAX = 0.0
00354          FINAL_DX_X = HUGEVAL
00355          FINAL_DZ_Z = HUGEVAL
00356          PREVNORMDX = HUGEVAL
00357          PREV_DZ_Z = HUGEVAL
00358          DZ_Z = HUGEVAL
00359          DX_X = HUGEVAL
00360 
00361          X_STATE = WORKING_STATE
00362          Z_STATE = UNSTABLE_STATE
00363          INCR_PREC = .FALSE.
00364 
00365          DO CNT = 1, ITHRESH
00366 *
00367 *        Compute residual RES = B_s - op(A_s) * Y,
00368 *            op(A) = A, A**T, or A**H depending on TRANS (and type).
00369 *
00370             CALL SCOPY( N, B( 1, J ), 1, RES, 1 )
00371             IF (Y_PREC_STATE .EQ. BASE_RESIDUAL) THEN
00372                CALL SSYMV( UPLO, N, -1.0, A, LDA, Y(1,J), 1,
00373      $              1.0, RES, 1 )
00374             ELSE IF (Y_PREC_STATE .EQ. EXTRA_RESIDUAL) THEN
00375                CALL BLAS_SSYMV_X( UPLO2, N, -1.0, A, LDA,
00376      $              Y( 1, J ), 1, 1.0, RES, 1, PREC_TYPE )
00377             ELSE
00378                CALL BLAS_SSYMV2_X(UPLO2, N, -1.0, A, LDA,
00379      $              Y(1, J), Y_TAIL, 1, 1.0, RES, 1, PREC_TYPE)
00380             END IF
00381             
00382 !         XXX: RES is no longer needed.
00383             CALL SCOPY( N, RES, 1, DY, 1 )
00384             CALL SSYTRS( UPLO, N, 1, AF, LDAF, IPIV, DY, N, INFO )
00385 *
00386 *         Calculate relative changes DX_X, DZ_Z and ratios DXRAT, DZRAT.
00387 *
00388             NORMX = 0.0
00389             NORMY = 0.0
00390             NORMDX = 0.0
00391             DZ_Z = 0.0
00392             YMIN = HUGEVAL
00393             
00394             DO I = 1, N
00395                YK = ABS( Y( I, J ) )
00396                DYK = ABS( DY( I ) )
00397                
00398                IF ( YK .NE. 0.0 ) THEN
00399                   DZ_Z = MAX( DZ_Z, DYK / YK )
00400                ELSE IF ( DYK .NE. 0.0 ) THEN
00401                   DZ_Z = HUGEVAL
00402                END IF
00403 
00404                YMIN = MIN( YMIN, YK )
00405 
00406                NORMY = MAX( NORMY, YK )
00407 
00408                IF ( COLEQU ) THEN
00409                   NORMX = MAX( NORMX, YK * C( I ) )
00410                   NORMDX = MAX( NORMDX, DYK * C( I ) )
00411                ELSE
00412                   NORMX = NORMY
00413                   NORMDX = MAX(NORMDX, DYK)
00414                END IF
00415             END DO
00416 
00417             IF ( NORMX .NE. 0.0 ) THEN
00418                DX_X = NORMDX / NORMX
00419             ELSE IF ( NORMDX .EQ. 0.0 ) THEN
00420                DX_X = 0.0
00421             ELSE
00422                DX_X = HUGEVAL
00423             END IF
00424 
00425             DXRAT = NORMDX / PREVNORMDX
00426             DZRAT = DZ_Z / PREV_DZ_Z
00427 *
00428 *         Check termination criteria.
00429 *
00430             IF ( YMIN*RCOND .LT. INCR_THRESH*NORMY
00431      $           .AND. Y_PREC_STATE .LT. EXTRA_Y )
00432      $           INCR_PREC = .TRUE.
00433 
00434             IF ( X_STATE .EQ. NOPROG_STATE .AND. DXRAT .LE. RTHRESH )
00435      $           X_STATE = WORKING_STATE
00436             IF ( X_STATE .EQ. WORKING_STATE ) THEN
00437                IF ( DX_X .LE. EPS ) THEN
00438                   X_STATE = CONV_STATE
00439                ELSE IF ( DXRAT .GT. RTHRESH ) THEN
00440                   IF ( Y_PREC_STATE .NE. EXTRA_Y ) THEN
00441                      INCR_PREC = .TRUE.
00442                   ELSE
00443                      X_STATE = NOPROG_STATE
00444                   END IF
00445                ELSE
00446                   IF ( DXRAT .GT. DXRATMAX ) DXRATMAX = DXRAT
00447                END IF
00448                IF ( X_STATE .GT. WORKING_STATE ) FINAL_DX_X = DX_X
00449             END IF
00450 
00451             IF ( Z_STATE .EQ. UNSTABLE_STATE .AND. DZ_Z .LE. DZ_UB )
00452      $           Z_STATE = WORKING_STATE
00453             IF ( Z_STATE .EQ. NOPROG_STATE .AND. DZRAT .LE. RTHRESH )
00454      $           Z_STATE = WORKING_STATE
00455             IF ( Z_STATE .EQ. WORKING_STATE ) THEN
00456                IF ( DZ_Z .LE. EPS ) THEN
00457                   Z_STATE = CONV_STATE
00458                ELSE IF ( DZ_Z .GT. DZ_UB ) THEN
00459                   Z_STATE = UNSTABLE_STATE
00460                   DZRATMAX = 0.0
00461                   FINAL_DZ_Z = HUGEVAL
00462                ELSE IF ( DZRAT .GT. RTHRESH ) THEN
00463                   IF ( Y_PREC_STATE .NE. EXTRA_Y ) THEN
00464                      INCR_PREC = .TRUE.
00465                   ELSE
00466                      Z_STATE = NOPROG_STATE
00467                   END IF
00468                ELSE
00469                   IF ( DZRAT .GT. DZRATMAX ) DZRATMAX = DZRAT
00470                END IF
00471                IF ( Z_STATE .GT. WORKING_STATE ) FINAL_DZ_Z = DZ_Z
00472             END IF
00473 
00474             IF ( X_STATE.NE.WORKING_STATE.AND.
00475      $           ( IGNORE_CWISE.OR.Z_STATE.NE.WORKING_STATE ) )
00476      $           GOTO 666
00477 
00478             IF ( INCR_PREC ) THEN
00479                INCR_PREC = .FALSE.
00480                Y_PREC_STATE = Y_PREC_STATE + 1
00481                DO I = 1, N
00482                   Y_TAIL( I ) = 0.0
00483                END DO
00484             END IF
00485 
00486             PREVNORMDX = NORMDX
00487             PREV_DZ_Z = DZ_Z
00488 *
00489 *           Update soluton.
00490 *
00491             IF (Y_PREC_STATE .LT. EXTRA_Y) THEN
00492                CALL SAXPY( N, 1.0, DY, 1, Y(1,J), 1 )
00493             ELSE
00494                CALL SLA_WWADDW( N, Y(1,J), Y_TAIL, DY )
00495             END IF
00496             
00497          END DO
00498 *        Target of "IF (Z_STOP .AND. X_STOP)".  Sun's f77 won't EXIT.
00499  666     CONTINUE
00500 *
00501 *     Set final_* when cnt hits ithresh.
00502 *
00503          IF ( X_STATE .EQ. WORKING_STATE ) FINAL_DX_X = DX_X
00504          IF ( Z_STATE .EQ. WORKING_STATE ) FINAL_DZ_Z = DZ_Z
00505 *
00506 *     Compute error bounds.
00507 *
00508          IF ( N_NORMS .GE. 1 ) THEN
00509             ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) =
00510      $           FINAL_DX_X / (1 - DXRATMAX)
00511          END IF
00512          IF ( N_NORMS .GE. 2 ) THEN
00513             ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) =
00514      $           FINAL_DZ_Z / (1 - DZRATMAX)
00515          END IF
00516 *
00517 *     Compute componentwise relative backward error from formula
00518 *         max(i) ( abs(R(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
00519 *     where abs(Z) is the componentwise absolute value of the matrix
00520 *     or vector Z.
00521 *
00522 *        Compute residual RES = B_s - op(A_s) * Y,
00523 *            op(A) = A, A**T, or A**H depending on TRANS (and type).
00524          CALL SCOPY( N, B( 1, J ), 1, RES, 1 )
00525          CALL SSYMV( UPLO, N, -1.0, A, LDA, Y(1,J), 1, 1.0, RES, 1 )
00526          
00527          DO I = 1, N
00528             AYB( I ) = ABS( B( I, J ) )
00529          END DO
00530 *
00531 *     Compute abs(op(A_s))*abs(Y) + abs(B_s).
00532 *
00533          CALL SLA_SYAMV( UPLO2, N, 1.0,
00534      $        A, LDA, Y(1, J), 1, 1.0, AYB, 1 )
00535          
00536          CALL SLA_LIN_BERR( N, N, 1, RES, AYB, BERR_OUT( J ) )
00537 *
00538 *     End of loop for each RHS.
00539 *
00540       END DO
00541 *
00542       RETURN
00543       END
 All Files Functions