LAPACK 3.3.1
Linear Algebra PACKage

ssyrfsx.f

Go to the documentation of this file.
00001       SUBROUTINE SSYRFSX( UPLO, EQUED, N, NRHS, A, LDA, AF, LDAF, IPIV,
00002      $                    S, B, LDB, X, LDX, RCOND, BERR, N_ERR_BNDS,
00003      $                    ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS,
00004      $                    WORK, IWORK, INFO )
00005 *
00006 *     -- LAPACK routine (version 3.2.2)                                 --
00007 *     -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
00008 *     -- Jason Riedy of Univ. of California Berkeley.                 --
00009 *     -- June 2010                                                    --
00010 *
00011 *     -- LAPACK is a software package provided by Univ. of Tennessee, --
00012 *     -- Univ. of California Berkeley and NAG Ltd.                    --
00013 *
00014       IMPLICIT NONE
00015 *     ..
00016 *     .. Scalar Arguments ..
00017       CHARACTER          UPLO, EQUED
00018       INTEGER            INFO, LDA, LDAF, LDB, LDX, N, NRHS, NPARAMS,
00019      $                   N_ERR_BNDS
00020       REAL               RCOND
00021 *     ..
00022 *     .. Array Arguments ..
00023       INTEGER            IPIV( * ), IWORK( * )
00024       REAL               A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
00025      $                   X( LDX, * ), WORK( * )
00026       REAL               S( * ), PARAMS( * ), BERR( * ),
00027      $                   ERR_BNDS_NORM( NRHS, * ),
00028      $                   ERR_BNDS_COMP( NRHS, * )
00029 *     ..
00030 *
00031 *     Purpose
00032 *     =======
00033 *
00034 *     SSYRFSX improves the computed solution to a system of linear
00035 *     equations when the coefficient matrix is symmetric indefinite, and
00036 *     provides error bounds and backward error estimates for the
00037 *     solution.  In addition to normwise error bound, the code provides
00038 *     maximum componentwise error bound if possible.  See comments for
00039 *     ERR_BNDS_NORM and ERR_BNDS_COMP for details of the error bounds.
00040 *
00041 *     The original system of linear equations may have been equilibrated
00042 *     before calling this routine, as described by arguments EQUED and S
00043 *     below. In this case, the solution and error bounds returned are
00044 *     for the original unequilibrated system.
00045 *
00046 *     Arguments
00047 *     =========
00048 *
00049 *     Some optional parameters are bundled in the PARAMS array.  These
00050 *     settings determine how refinement is performed, but often the
00051 *     defaults are acceptable.  If the defaults are acceptable, users
00052 *     can pass NPARAMS = 0 which prevents the source code from accessing
00053 *     the PARAMS argument.
00054 *
00055 *     UPLO    (input) CHARACTER*1
00056 *       = 'U':  Upper triangle of A is stored;
00057 *       = 'L':  Lower triangle of A is stored.
00058 *
00059 *     EQUED   (input) CHARACTER*1
00060 *     Specifies the form of equilibration that was done to A
00061 *     before calling this routine. This is needed to compute
00062 *     the solution and error bounds correctly.
00063 *       = 'N':  No equilibration
00064 *       = 'Y':  Both row and column equilibration, i.e., A has been
00065 *               replaced by diag(S) * A * diag(S).
00066 *               The right hand side B has been changed accordingly.
00067 *
00068 *     N       (input) INTEGER
00069 *     The order of the matrix A.  N >= 0.
00070 *
00071 *     NRHS    (input) INTEGER
00072 *     The number of right hand sides, i.e., the number of columns
00073 *     of the matrices B and X.  NRHS >= 0.
00074 *
00075 *     A       (input) REAL array, dimension (LDA,N)
00076 *     The symmetric matrix A.  If UPLO = 'U', the leading N-by-N
00077 *     upper triangular part of A contains the upper triangular
00078 *     part of the matrix A, and the strictly lower triangular
00079 *     part of A is not referenced.  If UPLO = 'L', the leading
00080 *     N-by-N lower triangular part of A contains the lower
00081 *     triangular part of the matrix A, and the strictly upper
00082 *     triangular part of A is not referenced.
00083 *
00084 *     LDA     (input) INTEGER
00085 *     The leading dimension of the array A.  LDA >= max(1,N).
00086 *
00087 *     AF      (input) REAL array, dimension (LDAF,N)
00088 *     The factored form of the matrix A.  AF contains the block
00089 *     diagonal matrix D and the multipliers used to obtain the
00090 *     factor U or L from the factorization A = U*D*U**T or A =
00091 *     L*D*L**T as computed by SSYTRF.
00092 *
00093 *     LDAF    (input) INTEGER
00094 *     The leading dimension of the array AF.  LDAF >= max(1,N).
00095 *
00096 *     IPIV    (input) INTEGER array, dimension (N)
00097 *     Details of the interchanges and the block structure of D
00098 *     as determined by SSYTRF.
00099 *
00100 *     S       (input or output) REAL array, dimension (N)
00101 *     The scale factors for A.  If EQUED = 'Y', A is multiplied on
00102 *     the left and right by diag(S).  S is an input argument if FACT =
00103 *     'F'; otherwise, S is an output argument.  If FACT = 'F' and EQUED
00104 *     = 'Y', each element of S must be positive.  If S is output, each
00105 *     element of S is a power of the radix. If S is input, each element
00106 *     of S should be a power of the radix to ensure a reliable solution
00107 *     and error estimates. Scaling by powers of the radix does not cause
00108 *     rounding errors unless the result underflows or overflows.
00109 *     Rounding errors during scaling lead to refining with a matrix that
00110 *     is not equivalent to the input matrix, producing error estimates
00111 *     that may not be reliable.
00112 *
00113 *     B       (input) REAL array, dimension (LDB,NRHS)
00114 *     The right hand side matrix B.
00115 *
00116 *     LDB     (input) INTEGER
00117 *     The leading dimension of the array B.  LDB >= max(1,N).
00118 *
00119 *     X       (input/output) REAL array, dimension (LDX,NRHS)
00120 *     On entry, the solution matrix X, as computed by SGETRS.
00121 *     On exit, the improved solution matrix X.
00122 *
00123 *     LDX     (input) INTEGER
00124 *     The leading dimension of the array X.  LDX >= max(1,N).
00125 *
00126 *     RCOND   (output) REAL
00127 *     Reciprocal scaled condition number.  This is an estimate of the
00128 *     reciprocal Skeel condition number of the matrix A after
00129 *     equilibration (if done).  If this is less than the machine
00130 *     precision (in particular, if it is zero), the matrix is singular
00131 *     to working precision.  Note that the error may still be small even
00132 *     if this number is very small and the matrix appears ill-
00133 *     conditioned.
00134 *
00135 *     BERR    (output) REAL array, dimension (NRHS)
00136 *     Componentwise relative backward error.  This is the
00137 *     componentwise relative backward error of each solution vector X(j)
00138 *     (i.e., the smallest relative change in any element of A or B that
00139 *     makes X(j) an exact solution).
00140 *
00141 *     N_ERR_BNDS (input) INTEGER
00142 *     Number of error bounds to return for each right hand side
00143 *     and each type (normwise or componentwise).  See ERR_BNDS_NORM and
00144 *     ERR_BNDS_COMP below.
00145 *
00146 *     ERR_BNDS_NORM  (output) REAL array, dimension (NRHS, N_ERR_BNDS)
00147 *     For each right-hand side, this array contains information about
00148 *     various error bounds and condition numbers corresponding to the
00149 *     normwise relative error, which is defined as follows:
00150 *
00151 *     Normwise relative error in the ith solution vector:
00152 *             max_j (abs(XTRUE(j,i) - X(j,i)))
00153 *            ------------------------------
00154 *                  max_j abs(X(j,i))
00155 *
00156 *     The array is indexed by the type of error information as described
00157 *     below. There currently are up to three pieces of information
00158 *     returned.
00159 *
00160 *     The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
00161 *     right-hand side.
00162 *
00163 *     The second index in ERR_BNDS_NORM(:,err) contains the following
00164 *     three fields:
00165 *     err = 1 "Trust/don't trust" boolean. Trust the answer if the
00166 *              reciprocal condition number is less than the threshold
00167 *              sqrt(n) * slamch('Epsilon').
00168 *
00169 *     err = 2 "Guaranteed" error bound: The estimated forward error,
00170 *              almost certainly within a factor of 10 of the true error
00171 *              so long as the next entry is greater than the threshold
00172 *              sqrt(n) * slamch('Epsilon'). This error bound should only
00173 *              be trusted if the previous boolean is true.
00174 *
00175 *     err = 3  Reciprocal condition number: Estimated normwise
00176 *              reciprocal condition number.  Compared with the threshold
00177 *              sqrt(n) * slamch('Epsilon') to determine if the error
00178 *              estimate is "guaranteed". These reciprocal condition
00179 *              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
00180 *              appropriately scaled matrix Z.
00181 *              Let Z = S*A, where S scales each row by a power of the
00182 *              radix so all absolute row sums of Z are approximately 1.
00183 *
00184 *     See Lapack Working Note 165 for further details and extra
00185 *     cautions.
00186 *
00187 *     ERR_BNDS_COMP  (output) REAL array, dimension (NRHS, N_ERR_BNDS)
00188 *     For each right-hand side, this array contains information about
00189 *     various error bounds and condition numbers corresponding to the
00190 *     componentwise relative error, which is defined as follows:
00191 *
00192 *     Componentwise relative error in the ith solution vector:
00193 *                    abs(XTRUE(j,i) - X(j,i))
00194 *             max_j ----------------------
00195 *                         abs(X(j,i))
00196 *
00197 *     The array is indexed by the right-hand side i (on which the
00198 *     componentwise relative error depends), and the type of error
00199 *     information as described below. There currently are up to three
00200 *     pieces of information returned for each right-hand side. If
00201 *     componentwise accuracy is not requested (PARAMS(3) = 0.0), then
00202 *     ERR_BNDS_COMP is not accessed.  If N_ERR_BNDS .LT. 3, then at most
00203 *     the first (:,N_ERR_BNDS) entries are returned.
00204 *
00205 *     The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
00206 *     right-hand side.
00207 *
00208 *     The second index in ERR_BNDS_COMP(:,err) contains the following
00209 *     three fields:
00210 *     err = 1 "Trust/don't trust" boolean. Trust the answer if the
00211 *              reciprocal condition number is less than the threshold
00212 *              sqrt(n) * slamch('Epsilon').
00213 *
00214 *     err = 2 "Guaranteed" error bound: The estimated forward error,
00215 *              almost certainly within a factor of 10 of the true error
00216 *              so long as the next entry is greater than the threshold
00217 *              sqrt(n) * slamch('Epsilon'). This error bound should only
00218 *              be trusted if the previous boolean is true.
00219 *
00220 *     err = 3  Reciprocal condition number: Estimated componentwise
00221 *              reciprocal condition number.  Compared with the threshold
00222 *              sqrt(n) * slamch('Epsilon') to determine if the error
00223 *              estimate is "guaranteed". These reciprocal condition
00224 *              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
00225 *              appropriately scaled matrix Z.
00226 *              Let Z = S*(A*diag(x)), where x is the solution for the
00227 *              current right-hand side and S scales each row of
00228 *              A*diag(x) by a power of the radix so all absolute row
00229 *              sums of Z are approximately 1.
00230 *
00231 *     See Lapack Working Note 165 for further details and extra
00232 *     cautions.
00233 *
00234 *     NPARAMS (input) INTEGER
00235 *     Specifies the number of parameters set in PARAMS.  If .LE. 0, the
00236 *     PARAMS array is never referenced and default values are used.
00237 *
00238 *     PARAMS  (input / output) REAL array, dimension NPARAMS
00239 *     Specifies algorithm parameters.  If an entry is .LT. 0.0, then
00240 *     that entry will be filled with default value used for that
00241 *     parameter.  Only positions up to NPARAMS are accessed; defaults
00242 *     are used for higher-numbered parameters.
00243 *
00244 *       PARAMS(LA_LINRX_ITREF_I = 1) : Whether to perform iterative
00245 *            refinement or not.
00246 *         Default: 1.0
00247 *            = 0.0 : No refinement is performed, and no error bounds are
00248 *                    computed.
00249 *            = 1.0 : Use the double-precision refinement algorithm,
00250 *                    possibly with doubled-single computations if the
00251 *                    compilation environment does not support DOUBLE
00252 *                    PRECISION.
00253 *              (other values are reserved for future use)
00254 *
00255 *       PARAMS(LA_LINRX_ITHRESH_I = 2) : Maximum number of residual
00256 *            computations allowed for refinement.
00257 *         Default: 10
00258 *         Aggressive: Set to 100 to permit convergence using approximate
00259 *                     factorizations or factorizations other than LU. If
00260 *                     the factorization uses a technique other than
00261 *                     Gaussian elimination, the guarantees in
00262 *                     err_bnds_norm and err_bnds_comp may no longer be
00263 *                     trustworthy.
00264 *
00265 *       PARAMS(LA_LINRX_CWISE_I = 3) : Flag determining if the code
00266 *            will attempt to find a solution with small componentwise
00267 *            relative error in the double-precision algorithm.  Positive
00268 *            is true, 0.0 is false.
00269 *         Default: 1.0 (attempt componentwise convergence)
00270 *
00271 *     WORK    (workspace) REAL array, dimension (4*N)
00272 *
00273 *     IWORK   (workspace) INTEGER array, dimension (N)
00274 *
00275 *     INFO    (output) INTEGER
00276 *       = 0:  Successful exit. The solution to every right-hand side is
00277 *         guaranteed.
00278 *       < 0:  If INFO = -i, the i-th argument had an illegal value
00279 *       > 0 and <= N:  U(INFO,INFO) is exactly zero.  The factorization
00280 *         has been completed, but the factor U is exactly singular, so
00281 *         the solution and error bounds could not be computed. RCOND = 0
00282 *         is returned.
00283 *       = N+J: The solution corresponding to the Jth right-hand side is
00284 *         not guaranteed. The solutions corresponding to other right-
00285 *         hand sides K with K > J may not be guaranteed as well, but
00286 *         only the first such right-hand side is reported. If a small
00287 *         componentwise error is not requested (PARAMS(3) = 0.0) then
00288 *         the Jth right-hand side is the first with a normwise error
00289 *         bound that is not guaranteed (the smallest J such
00290 *         that ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0)
00291 *         the Jth right-hand side is the first with either a normwise or
00292 *         componentwise error bound that is not guaranteed (the smallest
00293 *         J such that either ERR_BNDS_NORM(J,1) = 0.0 or
00294 *         ERR_BNDS_COMP(J,1) = 0.0). See the definition of
00295 *         ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information
00296 *         about all of the right-hand sides check ERR_BNDS_NORM or
00297 *         ERR_BNDS_COMP.
00298 *
00299 *     ==================================================================
00300 *
00301 *     .. Parameters ..
00302       REAL               ZERO, ONE
00303       PARAMETER          ( ZERO = 0.0E+0, ONE = 1.0E+0 )
00304       REAL               ITREF_DEFAULT, ITHRESH_DEFAULT,
00305      $                   COMPONENTWISE_DEFAULT
00306       REAL               RTHRESH_DEFAULT, DZTHRESH_DEFAULT
00307       PARAMETER          ( ITREF_DEFAULT = 1.0 )
00308       PARAMETER          ( ITHRESH_DEFAULT = 10.0 )
00309       PARAMETER          ( COMPONENTWISE_DEFAULT = 1.0 )
00310       PARAMETER          ( RTHRESH_DEFAULT = 0.5 )
00311       PARAMETER          ( DZTHRESH_DEFAULT = 0.25 )
00312       INTEGER            LA_LINRX_ITREF_I, LA_LINRX_ITHRESH_I,
00313      $                   LA_LINRX_CWISE_I
00314       PARAMETER          ( LA_LINRX_ITREF_I = 1,
00315      $                   LA_LINRX_ITHRESH_I = 2 )
00316       PARAMETER          ( LA_LINRX_CWISE_I = 3 )
00317       INTEGER            LA_LINRX_TRUST_I, LA_LINRX_ERR_I,
00318      $                   LA_LINRX_RCOND_I
00319       PARAMETER          ( LA_LINRX_TRUST_I = 1, LA_LINRX_ERR_I = 2 )
00320       PARAMETER          ( LA_LINRX_RCOND_I = 3 )
00321 *     ..
00322 *     .. Local Scalars ..
00323       CHARACTER(1)       NORM
00324       LOGICAL            RCEQU
00325       INTEGER            J, PREC_TYPE, REF_TYPE, N_NORMS
00326       REAL               ANORM, RCOND_TMP
00327       REAL               ILLRCOND_THRESH, ERR_LBND, CWISE_WRONG
00328       LOGICAL            IGNORE_CWISE
00329       INTEGER            ITHRESH
00330       REAL               RTHRESH, UNSTABLE_THRESH
00331 *     ..
00332 *     .. External Subroutines ..
00333       EXTERNAL           XERBLA, SSYCON, SLA_SYRFSX_EXTENDED
00334 *     ..
00335 *     .. Intrinsic Functions ..
00336       INTRINSIC          MAX, SQRT
00337 *     ..
00338 *     .. External Functions ..
00339       EXTERNAL           LSAME, BLAS_FPINFO_X, ILATRANS, ILAPREC
00340       EXTERNAL           SLAMCH, SLANSY, SLA_SYRCOND
00341       REAL               SLAMCH, SLANSY, SLA_SYRCOND
00342       LOGICAL            LSAME
00343       INTEGER            BLAS_FPINFO_X
00344       INTEGER            ILATRANS, ILAPREC
00345 *     ..
00346 *     .. Executable Statements ..
00347 *
00348 *     Check the input parameters.
00349 *
00350       INFO = 0
00351       REF_TYPE = INT( ITREF_DEFAULT )
00352       IF ( NPARAMS .GE. LA_LINRX_ITREF_I ) THEN
00353          IF ( PARAMS( LA_LINRX_ITREF_I ) .LT. 0.0 ) THEN
00354             PARAMS( LA_LINRX_ITREF_I ) = ITREF_DEFAULT
00355          ELSE
00356             REF_TYPE = PARAMS( LA_LINRX_ITREF_I )
00357          END IF
00358       END IF
00359 *
00360 *     Set default parameters.
00361 *
00362       ILLRCOND_THRESH = REAL( N )*SLAMCH( 'Epsilon' )
00363       ITHRESH = INT( ITHRESH_DEFAULT )
00364       RTHRESH = RTHRESH_DEFAULT
00365       UNSTABLE_THRESH = DZTHRESH_DEFAULT
00366       IGNORE_CWISE = COMPONENTWISE_DEFAULT .EQ. 0.0
00367 *
00368       IF ( NPARAMS.GE.LA_LINRX_ITHRESH_I ) THEN
00369          IF ( PARAMS( LA_LINRX_ITHRESH_I ).LT.0.0 ) THEN
00370             PARAMS( LA_LINRX_ITHRESH_I ) = ITHRESH
00371          ELSE
00372             ITHRESH = INT( PARAMS( LA_LINRX_ITHRESH_I ) )
00373          END IF
00374       END IF
00375       IF ( NPARAMS.GE.LA_LINRX_CWISE_I ) THEN
00376          IF ( PARAMS( LA_LINRX_CWISE_I ).LT.0.0 ) THEN
00377             IF ( IGNORE_CWISE ) THEN
00378                PARAMS( LA_LINRX_CWISE_I ) = 0.0
00379             ELSE
00380                PARAMS( LA_LINRX_CWISE_I ) = 1.0
00381             END IF
00382          ELSE
00383             IGNORE_CWISE = PARAMS( LA_LINRX_CWISE_I ) .EQ. 0.0
00384          END IF
00385       END IF
00386       IF ( REF_TYPE .EQ. 0 .OR. N_ERR_BNDS .EQ. 0 ) THEN
00387          N_NORMS = 0
00388       ELSE IF ( IGNORE_CWISE ) THEN
00389          N_NORMS = 1
00390       ELSE
00391          N_NORMS = 2
00392       END IF
00393 *
00394       RCEQU = LSAME( EQUED, 'Y' )
00395 *
00396 *     Test input parameters.
00397 *
00398       IF ( .NOT.LSAME( UPLO, 'U' ) .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
00399         INFO = -1
00400       ELSE IF( .NOT.RCEQU .AND. .NOT.LSAME( EQUED, 'N' ) ) THEN
00401         INFO = -2
00402       ELSE IF( N.LT.0 ) THEN
00403         INFO = -3
00404       ELSE IF( NRHS.LT.0 ) THEN
00405         INFO = -4
00406       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
00407         INFO = -6
00408       ELSE IF( LDAF.LT.MAX( 1, N ) ) THEN
00409         INFO = -8
00410       ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
00411         INFO = -11
00412       ELSE IF( LDX.LT.MAX( 1, N ) ) THEN
00413         INFO = -13
00414       END IF
00415       IF( INFO.NE.0 ) THEN
00416         CALL XERBLA( 'SSYRFSX', -INFO )
00417         RETURN
00418       END IF
00419 *
00420 *     Quick return if possible.
00421 *
00422       IF( N.EQ.0 .OR. NRHS.EQ.0 ) THEN
00423          RCOND = 1.0
00424          DO J = 1, NRHS
00425             BERR( J ) = 0.0
00426             IF ( N_ERR_BNDS .GE. 1 ) THEN
00427                ERR_BNDS_NORM( J, LA_LINRX_TRUST_I ) = 1.0
00428                ERR_BNDS_COMP( J, LA_LINRX_TRUST_I ) = 1.0
00429             END IF
00430             IF ( N_ERR_BNDS .GE. 2 ) THEN
00431                ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) = 0.0
00432                ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) = 0.0
00433             END IF
00434             IF ( N_ERR_BNDS .GE. 3 ) THEN
00435                ERR_BNDS_NORM( J, LA_LINRX_RCOND_I ) = 1.0
00436                ERR_BNDS_COMP( J, LA_LINRX_RCOND_I ) = 1.0
00437             END IF
00438          END DO
00439          RETURN
00440       END IF
00441 *
00442 *     Default to failure.
00443 *
00444       RCOND = 0.0
00445       DO J = 1, NRHS
00446          BERR( J ) = 1.0
00447          IF ( N_ERR_BNDS .GE. 1 ) THEN
00448             ERR_BNDS_NORM( J, LA_LINRX_TRUST_I ) = 1.0
00449             ERR_BNDS_COMP( J, LA_LINRX_TRUST_I ) = 1.0
00450          END IF
00451          IF ( N_ERR_BNDS .GE. 2 ) THEN
00452             ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) = 1.0
00453             ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) = 1.0
00454          END IF
00455          IF ( N_ERR_BNDS .GE. 3 ) THEN
00456             ERR_BNDS_NORM( J, LA_LINRX_RCOND_I ) = 0.0
00457             ERR_BNDS_COMP( J, LA_LINRX_RCOND_I ) = 0.0
00458          END IF
00459       END DO
00460 *
00461 *     Compute the norm of A and the reciprocal of the condition
00462 *     number of A.
00463 *
00464       NORM = 'I'
00465       ANORM = SLANSY( NORM, UPLO, N, A, LDA, WORK )
00466       CALL SSYCON( UPLO, N, AF, LDAF, IPIV, ANORM, RCOND, WORK,
00467      $     IWORK, INFO )
00468 *
00469 *     Perform refinement on each right-hand side
00470 *
00471       IF ( REF_TYPE .NE. 0 ) THEN
00472 
00473          PREC_TYPE = ILAPREC( 'D' )
00474 
00475          CALL SLA_SYRFSX_EXTENDED( PREC_TYPE, UPLO,  N,
00476      $        NRHS, A, LDA, AF, LDAF, IPIV, RCEQU, S, B,
00477      $        LDB, X, LDX, BERR, N_NORMS, ERR_BNDS_NORM, ERR_BNDS_COMP,
00478      $        WORK( N+1 ), WORK( 1 ), WORK( 2*N+1 ), WORK( 1 ), RCOND,
00479      $        ITHRESH, RTHRESH, UNSTABLE_THRESH, IGNORE_CWISE,
00480      $        INFO )
00481       END IF
00482 
00483       ERR_LBND = MAX( 10.0, SQRT( REAL( N ) ) )*SLAMCH( 'Epsilon' )
00484       IF (N_ERR_BNDS .GE. 1 .AND. N_NORMS .GE. 1) THEN
00485 *
00486 *     Compute scaled normwise condition number cond(A*C).
00487 *
00488          IF ( RCEQU ) THEN
00489             RCOND_TMP = SLA_SYRCOND( UPLO, N, A, LDA, AF, LDAF, IPIV,
00490      $           -1, S, INFO, WORK, IWORK )
00491          ELSE
00492             RCOND_TMP = SLA_SYRCOND( UPLO, N, A, LDA, AF, LDAF, IPIV,
00493      $           0, S, INFO, WORK, IWORK )
00494          END IF
00495          DO J = 1, NRHS
00496 *
00497 *     Cap the error at 1.0.
00498 *
00499             IF (N_ERR_BNDS .GE. LA_LINRX_ERR_I
00500      $           .AND. ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) .GT. 1.0)
00501      $           ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) = 1.0
00502 *
00503 *     Threshold the error (see LAWN).
00504 *
00505             IF ( RCOND_TMP .LT. ILLRCOND_THRESH ) THEN
00506                ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) = 1.0
00507                ERR_BNDS_NORM( J, LA_LINRX_TRUST_I ) = 0.0
00508                IF ( INFO .LE. N ) INFO = N + J
00509             ELSE IF (ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) .LT. ERR_LBND)
00510      $              THEN
00511                ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) = ERR_LBND
00512                ERR_BNDS_NORM( J, LA_LINRX_TRUST_I ) = 1.0
00513             END IF
00514 *
00515 *     Save the condition number.
00516 *
00517             IF (N_ERR_BNDS .GE. LA_LINRX_RCOND_I) THEN
00518                ERR_BNDS_NORM( J, LA_LINRX_RCOND_I ) = RCOND_TMP
00519             END IF
00520          END DO
00521       END IF
00522 
00523       IF ( N_ERR_BNDS .GE. 1 .AND. N_NORMS .GE. 2 ) THEN
00524 *
00525 *     Compute componentwise condition number cond(A*diag(Y(:,J))) for
00526 *     each right-hand side using the current solution as an estimate of
00527 *     the true solution.  If the componentwise error estimate is too
00528 *     large, then the solution is a lousy estimate of truth and the
00529 *     estimated RCOND may be too optimistic.  To avoid misleading users,
00530 *     the inverse condition number is set to 0.0 when the estimated
00531 *     cwise error is at least CWISE_WRONG.
00532 *
00533          CWISE_WRONG = SQRT( SLAMCH( 'Epsilon' ) )
00534          DO J = 1, NRHS
00535             IF ( ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) .LT. CWISE_WRONG )
00536      $     THEN
00537                RCOND_TMP = SLA_SYRCOND( UPLO, N, A, LDA, AF, LDAF, IPIV,
00538      $              1, X(1,J), INFO, WORK, IWORK )
00539             ELSE
00540                RCOND_TMP = 0.0
00541             END IF
00542 *
00543 *     Cap the error at 1.0.
00544 *
00545             IF ( N_ERR_BNDS .GE. LA_LINRX_ERR_I
00546      $           .AND. ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) .GT. 1.0 )
00547      $           ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) = 1.0
00548 *
00549 *     Threshold the error (see LAWN).
00550 *
00551             IF ( RCOND_TMP .LT. ILLRCOND_THRESH ) THEN
00552                ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) = 1.0
00553                ERR_BNDS_COMP( J, LA_LINRX_TRUST_I ) = 0.0
00554                IF ( PARAMS( LA_LINRX_CWISE_I ) .EQ. 1.0
00555      $              .AND. INFO.LT.N + J ) INFO = N + J
00556             ELSE IF ( ERR_BNDS_COMP( J, LA_LINRX_ERR_I )
00557      $              .LT. ERR_LBND ) THEN
00558                ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) = ERR_LBND
00559                ERR_BNDS_COMP( J, LA_LINRX_TRUST_I ) = 1.0
00560             END IF
00561 *
00562 *     Save the condition number.
00563 *
00564             IF ( N_ERR_BNDS .GE. LA_LINRX_RCOND_I ) THEN
00565                ERR_BNDS_COMP( J, LA_LINRX_RCOND_I ) = RCOND_TMP
00566             END IF
00567 
00568          END DO
00569       END IF
00570 *
00571       RETURN
00572 *
00573 *     End of SSYRFSX
00574 *
00575       END
 All Files Functions