LAPACK 3.3.1
Linear Algebra PACKage

csyrfsx.f

Go to the documentation of this file.
00001       SUBROUTINE CSYRFSX( 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, RWORK, 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( * )
00024       COMPLEX            A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
00025      $                   X( LDX, * ), WORK( * )
00026       REAL               S( * ), PARAMS( * ), BERR( * ), RWORK( * ),
00027      $                   ERR_BNDS_NORM( NRHS, * ),
00028      $                   ERR_BNDS_COMP( NRHS, * )
00029 *     ..
00030 *
00031 *     Purpose
00032 *     =======
00033 *
00034 *     CSYRFSX 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) COMPLEX 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) COMPLEX 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) COMPLEX 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) COMPLEX 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) COMPLEX array, dimension (2*N)
00272 *
00273 *     RWORK   (workspace) REAL array, dimension (2*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
00326       INTEGER            N_NORMS
00327       REAL               ANORM, RCOND_TMP
00328       REAL               ILLRCOND_THRESH, ERR_LBND, CWISE_WRONG
00329       LOGICAL            IGNORE_CWISE
00330       INTEGER            ITHRESH
00331       REAL               RTHRESH, UNSTABLE_THRESH
00332 *     ..
00333 *     .. External Subroutines ..
00334       EXTERNAL           XERBLA, CSYCON, CLA_SYRFSX_EXTENDED
00335 *     ..
00336 *     .. Intrinsic Functions ..
00337       INTRINSIC          MAX, SQRT, TRANSFER
00338 *     ..
00339 *     .. External Functions ..
00340       EXTERNAL           LSAME, BLAS_FPINFO_X, ILATRANS, ILAPREC
00341       EXTERNAL           SLAMCH, CLANSY, CLA_SYRCOND_X, CLA_SYRCOND_C
00342       REAL               SLAMCH, CLANSY, CLA_SYRCOND_X, CLA_SYRCOND_C
00343       LOGICAL            LSAME
00344       INTEGER            BLAS_FPINFO_X
00345       INTEGER            ILATRANS, ILAPREC
00346 *     ..
00347 *     .. Executable Statements ..
00348 *
00349 *     Check the input parameters.
00350 *
00351       INFO = 0
00352       REF_TYPE = INT( ITREF_DEFAULT )
00353       IF ( NPARAMS .GE. LA_LINRX_ITREF_I ) THEN
00354          IF ( PARAMS( LA_LINRX_ITREF_I ) .LT. 0.0 ) THEN
00355             PARAMS( LA_LINRX_ITREF_I ) = ITREF_DEFAULT
00356          ELSE
00357             REF_TYPE = PARAMS( LA_LINRX_ITREF_I )
00358          END IF
00359       END IF
00360 *
00361 *     Set default parameters.
00362 *
00363       ILLRCOND_THRESH = REAL( N ) * SLAMCH( 'Epsilon' )
00364       ITHRESH = INT( ITHRESH_DEFAULT )
00365       RTHRESH = RTHRESH_DEFAULT
00366       UNSTABLE_THRESH = DZTHRESH_DEFAULT
00367       IGNORE_CWISE = COMPONENTWISE_DEFAULT .EQ. 0.0
00368 *
00369       IF ( NPARAMS.GE.LA_LINRX_ITHRESH_I ) THEN
00370          IF ( PARAMS( LA_LINRX_ITHRESH_I ).LT.0.0 ) THEN
00371             PARAMS( LA_LINRX_ITHRESH_I ) = ITHRESH
00372          ELSE
00373             ITHRESH = INT( PARAMS( LA_LINRX_ITHRESH_I ) )
00374          END IF
00375       END IF
00376       IF ( NPARAMS.GE.LA_LINRX_CWISE_I ) THEN
00377          IF ( PARAMS( LA_LINRX_CWISE_I ).LT.0.0 ) THEN
00378             IF ( IGNORE_CWISE ) THEN
00379                PARAMS( LA_LINRX_CWISE_I ) = 0.0
00380             ELSE
00381                PARAMS( LA_LINRX_CWISE_I ) = 1.0
00382             END IF
00383          ELSE
00384             IGNORE_CWISE = PARAMS( LA_LINRX_CWISE_I ) .EQ. 0.0
00385          END IF
00386       END IF
00387       IF ( REF_TYPE .EQ. 0 .OR. N_ERR_BNDS .EQ. 0 ) THEN
00388          N_NORMS = 0
00389       ELSE IF ( IGNORE_CWISE ) THEN
00390          N_NORMS = 1
00391       ELSE
00392          N_NORMS = 2
00393       END IF
00394 *
00395       RCEQU = LSAME( EQUED, 'Y' )
00396 *
00397 *     Test input parameters.
00398 *
00399       IF ( .NOT.LSAME( UPLO, 'U' ) .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
00400         INFO = -1
00401       ELSE IF( .NOT.RCEQU .AND. .NOT.LSAME( EQUED, 'N' ) ) THEN
00402         INFO = -2
00403       ELSE IF( N.LT.0 ) THEN
00404         INFO = -3
00405       ELSE IF( NRHS.LT.0 ) THEN
00406         INFO = -4
00407       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
00408         INFO = -6
00409       ELSE IF( LDAF.LT.MAX( 1, N ) ) THEN
00410         INFO = -8
00411       ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
00412         INFO = -11
00413       ELSE IF( LDX.LT.MAX( 1, N ) ) THEN
00414         INFO = -13
00415       END IF
00416       IF( INFO.NE.0 ) THEN
00417         CALL XERBLA( 'CSYRFSX', -INFO )
00418         RETURN
00419       END IF
00420 *
00421 *     Quick return if possible.
00422 *
00423       IF( N.EQ.0 .OR. NRHS.EQ.0 ) THEN
00424          RCOND = 1.0
00425          DO J = 1, NRHS
00426             BERR( J ) = 0.0
00427             IF ( N_ERR_BNDS .GE. 1 ) THEN
00428                ERR_BNDS_NORM( J, LA_LINRX_TRUST_I ) = 1.0
00429                ERR_BNDS_COMP( J, LA_LINRX_TRUST_I ) = 1.0
00430             END IF
00431             IF ( N_ERR_BNDS .GE. 2 ) THEN
00432                ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) = 0.0
00433                ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) = 0.0
00434             END IF
00435             IF ( N_ERR_BNDS .GE. 3 ) THEN
00436                ERR_BNDS_NORM( J, LA_LINRX_RCOND_I ) = 1.0
00437                ERR_BNDS_COMP( J, LA_LINRX_RCOND_I ) = 1.0
00438             END IF
00439          END DO
00440          RETURN
00441       END IF
00442 *
00443 *     Default to failure.
00444 *
00445       RCOND = 0.0
00446       DO J = 1, NRHS
00447          BERR( J ) = 1.0
00448          IF ( N_ERR_BNDS .GE. 1 ) THEN
00449             ERR_BNDS_NORM( J, LA_LINRX_TRUST_I ) = 1.0
00450             ERR_BNDS_COMP( J, LA_LINRX_TRUST_I ) = 1.0
00451          END IF
00452          IF ( N_ERR_BNDS .GE. 2 ) THEN
00453             ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) = 1.0
00454             ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) = 1.0
00455          END IF
00456          IF ( N_ERR_BNDS .GE. 3 ) THEN
00457             ERR_BNDS_NORM( J, LA_LINRX_RCOND_I ) = 0.0
00458             ERR_BNDS_COMP( J, LA_LINRX_RCOND_I ) = 0.0
00459          END IF
00460       END DO
00461 *
00462 *     Compute the norm of A and the reciprocal of the condition
00463 *     number of A.
00464 *
00465       NORM = 'I'
00466       ANORM = CLANSY( NORM, UPLO, N, A, LDA, RWORK )
00467       CALL CSYCON( UPLO, N, AF, LDAF, IPIV, ANORM, RCOND, WORK,
00468      $     INFO )
00469 *
00470 *     Perform refinement on each right-hand side
00471 *
00472       IF ( REF_TYPE .NE. 0 ) THEN
00473 
00474          PREC_TYPE = ILAPREC( 'D' )
00475 
00476          CALL CLA_SYRFSX_EXTENDED( PREC_TYPE, UPLO,  N,
00477      $        NRHS, A, LDA, AF, LDAF, IPIV, RCEQU, S, B,
00478      $        LDB, X, LDX, BERR, N_NORMS, ERR_BNDS_NORM, ERR_BNDS_COMP,
00479      $        WORK, RWORK, WORK(N+1),
00480      $        TRANSFER (RWORK(1:2*N), (/ (ZERO, ZERO) /), N), RCOND,
00481      $        ITHRESH, RTHRESH, UNSTABLE_THRESH, IGNORE_CWISE,
00482      $        INFO )
00483       END IF
00484 
00485       ERR_LBND = MAX( 10.0, SQRT( REAL( N ) ) ) * SLAMCH( 'Epsilon' )
00486       IF (N_ERR_BNDS .GE. 1 .AND. N_NORMS .GE. 1) THEN
00487 *
00488 *     Compute scaled normwise condition number cond(A*C).
00489 *
00490          IF ( RCEQU ) THEN
00491             RCOND_TMP = CLA_SYRCOND_C( UPLO, N, A, LDA, AF, LDAF, IPIV,
00492      $           S, .TRUE., INFO, WORK, RWORK )
00493          ELSE
00494             RCOND_TMP = CLA_SYRCOND_C( UPLO, N, A, LDA, AF, LDAF, IPIV,
00495      $           S, .FALSE., INFO, WORK, RWORK )
00496          END IF
00497          DO J = 1, NRHS
00498 *
00499 *     Cap the error at 1.0.
00500 *
00501             IF ( N_ERR_BNDS .GE. LA_LINRX_ERR_I
00502      $           .AND. ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) .GT. 1.0 )
00503      $           ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) = 1.0
00504 *
00505 *     Threshold the error (see LAWN).
00506 *
00507             IF ( RCOND_TMP .LT. ILLRCOND_THRESH ) THEN
00508                ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) = 1.0
00509                ERR_BNDS_NORM( J, LA_LINRX_TRUST_I ) = 0.0
00510                IF ( INFO .LE. N ) INFO = N + J
00511             ELSE IF ( ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) .LT. ERR_LBND )
00512      $              THEN
00513                ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) = ERR_LBND
00514                ERR_BNDS_NORM( J, LA_LINRX_TRUST_I ) = 1.0
00515             END IF
00516 *
00517 *     Save the condition number.
00518 *
00519             IF ( N_ERR_BNDS .GE. LA_LINRX_RCOND_I ) THEN
00520                ERR_BNDS_NORM( J, LA_LINRX_RCOND_I ) = RCOND_TMP
00521             END IF
00522          END DO
00523       END IF
00524 
00525       IF ( N_ERR_BNDS .GE. 1 .AND. N_NORMS .GE. 2 ) THEN
00526 *
00527 *     Compute componentwise condition number cond(A*diag(Y(:,J))) for
00528 *     each right-hand side using the current solution as an estimate of
00529 *     the true solution.  If the componentwise error estimate is too
00530 *     large, then the solution is a lousy estimate of truth and the
00531 *     estimated RCOND may be too optimistic.  To avoid misleading users,
00532 *     the inverse condition number is set to 0.0 when the estimated
00533 *     cwise error is at least CWISE_WRONG.
00534 *
00535          CWISE_WRONG = SQRT( SLAMCH( 'Epsilon' ) )
00536          DO J = 1, NRHS
00537             IF ( ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) .LT. CWISE_WRONG )
00538      $     THEN
00539                RCOND_TMP = CLA_SYRCOND_X( UPLO, N, A, LDA, AF, LDAF,
00540      $         IPIV, X(1,J), INFO, WORK, RWORK )
00541             ELSE
00542                RCOND_TMP = 0.0
00543             END IF
00544 *
00545 *     Cap the error at 1.0.
00546 *
00547             IF ( N_ERR_BNDS .GE. LA_LINRX_ERR_I
00548      $           .AND. ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) .GT. 1.0 )
00549      $           ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) = 1.0
00550 
00551 *
00552 *     Threshold the error (see LAWN).
00553 *
00554             IF ( RCOND_TMP .LT. ILLRCOND_THRESH ) THEN
00555                ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) = 1.0
00556                ERR_BNDS_COMP( J, LA_LINRX_TRUST_I ) = 0.0
00557                IF ( PARAMS( LA_LINRX_CWISE_I ) .EQ. 1.0
00558      $              .AND. INFO.LT.N + J ) INFO = N + J
00559             ELSE IF ( ERR_BNDS_COMP( J, LA_LINRX_ERR_I )
00560      $              .LT. ERR_LBND ) THEN
00561                ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) = ERR_LBND
00562                ERR_BNDS_COMP( J, LA_LINRX_TRUST_I ) = 1.0
00563             END IF
00564 *
00565 *     Save the condition number.
00566 *
00567             IF ( N_ERR_BNDS .GE. LA_LINRX_RCOND_I ) THEN
00568                ERR_BNDS_COMP( J, LA_LINRX_RCOND_I ) = RCOND_TMP
00569             END IF
00570 
00571          END DO
00572       END IF
00573 *
00574       RETURN
00575 *
00576 *     End of CSYRFSX
00577 *
00578       END
 All Files Functions