LAPACK 3.3.0

sla_porfsx_extended.f

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