LAPACK 3.3.0

zla_porfsx_extended.f

Go to the documentation of this file.
00001       SUBROUTINE ZLA_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       DOUBLE PRECISION   RTHRESH, DZ_UB
00025 *     ..
00026 *     .. Array Arguments ..
00027       COMPLEX*16         A( LDA, * ), AF( LDAF, * ), 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 *  ZLA_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 ZPORFSX 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*16 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*16 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 ZPOTRF.
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) DOUBLE PRECISION 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*16 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*16 array, dimension
00105 *                    (LDY,NRHS)
00106 *     On entry, the solution matrix X, as computed by ZPOTRS.
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) DOUBLE PRECISION 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 ZLA_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) DOUBLE PRECISION 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) DOUBLE PRECISION 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*16 array, dimension (N)
00220 *     Workspace to hold the intermediate residual.
00221 *
00222 *     AYB            (input) DOUBLE PRECISION array, dimension (N)
00223 *     Workspace.
00224 *
00225 *     DY             (input) COMPLEX*16 PRECISION array, dimension (N)
00226 *     Workspace to hold the intermediate solution.
00227 *
00228 *     Y_TAIL         (input) COMPLEX*16 array, dimension (N)
00229 *     Workspace to hold the trailing bits of the intermediate solution.
00230 *
00231 *     RCOND          (input) DOUBLE PRECISION
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) DOUBLE PRECISION
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) DOUBLE PRECISION
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 ZPOTRS 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       DOUBLE PRECISION   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*16         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           ZAXPY, ZCOPY, ZPOTRS, ZHEMV, BLAS_ZHEMV_X,
00319      $                   BLAS_ZHEMV2_X, ZLA_HEAMV, ZLA_WWADDW,
00320      $                   ZLA_LIN_BERR, DLAMCH
00321       DOUBLE PRECISION   DLAMCH
00322 *     ..
00323 *     .. Intrinsic Functions ..
00324       INTRINSIC          ABS, DBLE, DIMAG, MAX, MIN
00325 *     ..
00326 *     .. Statement Functions ..
00327       DOUBLE PRECISION   CABS1
00328 *     ..
00329 *     .. Statement Function Definitions ..
00330       CABS1( ZDUM ) = ABS( DBLE( ZDUM ) ) + ABS( DIMAG( ZDUM ) )
00331 *     ..
00332 *     .. Executable Statements ..
00333 *
00334       IF (INFO.NE.0) RETURN
00335       EPS = DLAMCH( 'Epsilon' )
00336       HUGEVAL = DLAMCH( 'Overflow' )
00337 *     Force HUGEVAL to Inf
00338       HUGEVAL = HUGEVAL * HUGEVAL
00339 *     Using HUGEVAL may lead to spurious underflows.
00340       INCR_THRESH = DBLE(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.0D+0
00353             END DO
00354          END IF
00355 
00356          DXRAT = 0.0D+0
00357          DXRATMAX = 0.0D+0
00358          DZRAT = 0.0D+0
00359          DZRATMAX = 0.0D+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 ZCOPY( N, B( 1, J ), 1, RES, 1 )
00377             IF (Y_PREC_STATE .EQ. BASE_RESIDUAL) THEN
00378                CALL ZHEMV(UPLO, N, DCMPLX(-1.0D+0), A, LDA, Y(1,J), 1,
00379      $              DCMPLX(1.0D+0), RES, 1)
00380             ELSE IF (Y_PREC_STATE .EQ. EXTRA_RESIDUAL) THEN
00381                CALL BLAS_ZHEMV_X(UPLO2, N, DCMPLX(-1.0D+0), A, LDA,
00382      $              Y( 1, J ), 1, DCMPLX(1.0D+0), RES, 1, PREC_TYPE)
00383             ELSE
00384                CALL BLAS_ZHEMV2_X(UPLO2, N, DCMPLX(-1.0D+0), A, LDA,
00385      $              Y(1, J), Y_TAIL, 1, DCMPLX(1.0D+0), RES, 1,
00386      $     PREC_TYPE)
00387             END IF
00388 
00389 !         XXX: RES is no longer needed.
00390             CALL ZCOPY( N, RES, 1, DY, 1 )
00391             CALL ZPOTRS( UPLO, N, 1, AF, LDAF, DY, N, INFO)
00392 *
00393 *         Calculate relative changes DX_X, DZ_Z and ratios DXRAT, DZRAT.
00394 *
00395             NORMX = 0.0D+0
00396             NORMY = 0.0D+0
00397             NORMDX = 0.0D+0
00398             DZ_Z = 0.0D+0
00399             YMIN = HUGEVAL
00400 
00401             DO I = 1, N
00402                YK = CABS1(Y(I, J))
00403                DYK = CABS1(DY(I))
00404 
00405                IF (YK .NE. 0.0D+0) THEN
00406                   DZ_Z = MAX( DZ_Z, DYK / YK )
00407                ELSE IF (DYK .NE. 0.0D+0) THEN
00408                   DZ_Z = HUGEVAL
00409                END IF
00410 
00411                YMIN = MIN( YMIN, YK )
00412 
00413                NORMY = MAX( NORMY, YK )
00414 
00415                IF ( COLEQU ) THEN
00416                   NORMX = MAX(NORMX, YK * C(I))
00417                   NORMDX = MAX(NORMDX, DYK * C(I))
00418                ELSE
00419                   NORMX = NORMY
00420                   NORMDX = MAX(NORMDX, DYK)
00421                END IF
00422             END DO
00423 
00424             IF (NORMX .NE. 0.0D+0) THEN
00425                DX_X = NORMDX / NORMX
00426             ELSE IF (NORMDX .EQ. 0.0D+0) THEN
00427                DX_X = 0.0D+0
00428             ELSE
00429                DX_X = HUGEVAL
00430             END IF
00431 
00432             DXRAT = NORMDX / PREVNORMDX
00433             DZRAT = DZ_Z / PREV_DZ_Z
00434 *
00435 *         Check termination criteria.
00436 *
00437             IF (YMIN*RCOND .LT. INCR_THRESH*NORMY
00438      $           .AND. Y_PREC_STATE .LT. EXTRA_Y)
00439      $           INCR_PREC = .TRUE.
00440 
00441             IF (X_STATE .EQ. NOPROG_STATE .AND. DXRAT .LE. RTHRESH)
00442      $           X_STATE = WORKING_STATE
00443             IF (X_STATE .EQ. WORKING_STATE) THEN
00444                IF (DX_X .LE. EPS) THEN
00445                   X_STATE = CONV_STATE
00446                ELSE IF (DXRAT .GT. RTHRESH) THEN
00447                   IF (Y_PREC_STATE .NE. EXTRA_Y) THEN
00448                      INCR_PREC = .TRUE.
00449                   ELSE
00450                      X_STATE = NOPROG_STATE
00451                   END IF
00452                ELSE
00453                   IF (DXRAT .GT. DXRATMAX) DXRATMAX = DXRAT
00454                END IF
00455                IF (X_STATE .GT. WORKING_STATE) FINAL_DX_X = DX_X
00456             END IF
00457 
00458             IF (Z_STATE .EQ. UNSTABLE_STATE .AND. DZ_Z .LE. DZ_UB)
00459      $           Z_STATE = WORKING_STATE
00460             IF (Z_STATE .EQ. NOPROG_STATE .AND. DZRAT .LE. RTHRESH)
00461      $           Z_STATE = WORKING_STATE
00462             IF (Z_STATE .EQ. WORKING_STATE) THEN
00463                IF (DZ_Z .LE. EPS) THEN
00464                   Z_STATE = CONV_STATE
00465                ELSE IF (DZ_Z .GT. DZ_UB) THEN
00466                   Z_STATE = UNSTABLE_STATE
00467                   DZRATMAX = 0.0D+0
00468                   FINAL_DZ_Z = HUGEVAL
00469                ELSE IF (DZRAT .GT. RTHRESH) THEN
00470                   IF (Y_PREC_STATE .NE. EXTRA_Y) THEN
00471                      INCR_PREC = .TRUE.
00472                   ELSE
00473                      Z_STATE = NOPROG_STATE
00474                   END IF
00475                ELSE
00476                   IF (DZRAT .GT. DZRATMAX) DZRATMAX = DZRAT
00477                END IF
00478                IF (Z_STATE .GT. WORKING_STATE) FINAL_DZ_Z = DZ_Z
00479             END IF
00480 
00481             IF ( X_STATE.NE.WORKING_STATE.AND.
00482      $           (IGNORE_CWISE.OR.Z_STATE.NE.WORKING_STATE) )
00483      $           GOTO 666
00484 
00485             IF (INCR_PREC) THEN
00486                INCR_PREC = .FALSE.
00487                Y_PREC_STATE = Y_PREC_STATE + 1
00488                DO I = 1, N
00489                   Y_TAIL( I ) = 0.0D+0
00490                END DO
00491             END IF
00492 
00493             PREVNORMDX = NORMDX
00494             PREV_DZ_Z = DZ_Z
00495 *
00496 *           Update soluton.
00497 *
00498             IF (Y_PREC_STATE .LT. EXTRA_Y) THEN
00499                CALL ZAXPY( N, DCMPLX(1.0D+0), DY, 1, Y(1,J), 1 )
00500             ELSE
00501                CALL ZLA_WWADDW(N, Y(1,J), Y_TAIL, DY)
00502             END IF
00503 
00504          END DO
00505 *        Target of "IF (Z_STOP .AND. X_STOP)".  Sun's f77 won't EXIT.
00506  666     CONTINUE
00507 *
00508 *     Set final_* when cnt hits ithresh.
00509 *
00510          IF (X_STATE .EQ. WORKING_STATE) FINAL_DX_X = DX_X
00511          IF (Z_STATE .EQ. WORKING_STATE) FINAL_DZ_Z = DZ_Z
00512 *
00513 *     Compute error bounds.
00514 *
00515          IF (N_NORMS .GE. 1) THEN
00516             ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) =
00517      $           FINAL_DX_X / (1 - DXRATMAX)
00518          END IF
00519          IF (N_NORMS .GE. 2) THEN
00520             ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) =
00521      $           FINAL_DZ_Z / (1 - DZRATMAX)
00522          END IF
00523 *
00524 *     Compute componentwise relative backward error from formula
00525 *         max(i) ( abs(R(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
00526 *     where abs(Z) is the componentwise absolute value of the matrix
00527 *     or vector Z.
00528 *
00529 *        Compute residual RES = B_s - op(A_s) * Y,
00530 *            op(A) = A, A**T, or A**H depending on TRANS (and type).
00531 *
00532          CALL ZCOPY( N, B( 1, J ), 1, RES, 1 )
00533          CALL ZHEMV(UPLO, N, DCMPLX(-1.0D+0), A, LDA, Y(1,J), 1,
00534      $        DCMPLX(1.0D+0), RES, 1)
00535 
00536          DO I = 1, N
00537             AYB( I ) = CABS1( B( I, J ) )
00538          END DO
00539 *
00540 *     Compute abs(op(A_s))*abs(Y) + abs(B_s).
00541 *
00542          CALL ZLA_HEAMV (UPLO2, N, 1.0D+0,
00543      $        A, LDA, Y(1, J), 1, 1.0D+0, AYB, 1)
00544 
00545          CALL ZLA_LIN_BERR (N, N, 1, RES, AYB, BERR_OUT(J))
00546 *
00547 *     End of loop for each RHS.
00548 *
00549       END DO
00550 *
00551       RETURN
00552       END
 All Files Functions