LAPACK 3.3.0

cla_porfsx_extended.f

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