sgesvx.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 504 行 · 第 1/3 页
HTML
504 行
</span><span class="comment">*</span><span class="comment"> diag(R).
</span><span class="comment">*</span><span class="comment"> = 'C': Column equilibration, i.e., A has been postmultiplied
</span><span class="comment">*</span><span class="comment"> by diag(C).
</span><span class="comment">*</span><span class="comment"> = 'B': Both row and column equilibration, i.e., A has been
</span><span class="comment">*</span><span class="comment"> replaced by diag(R) * A * diag(C).
</span><span class="comment">*</span><span class="comment"> EQUED is an input argument if FACT = 'F'; otherwise, it is an
</span><span class="comment">*</span><span class="comment"> output argument.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> R (input or output) REAL array, dimension (N)
</span><span class="comment">*</span><span class="comment"> The row scale factors for A. If EQUED = 'R' or 'B', A is
</span><span class="comment">*</span><span class="comment"> multiplied on the left by diag(R); if EQUED = 'N' or 'C', R
</span><span class="comment">*</span><span class="comment"> is not accessed. R is an input argument if FACT = 'F';
</span><span class="comment">*</span><span class="comment"> otherwise, R is an output argument. If FACT = 'F' and
</span><span class="comment">*</span><span class="comment"> EQUED = 'R' or 'B', each element of R must be positive.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> C (input or output) REAL array, dimension (N)
</span><span class="comment">*</span><span class="comment"> The column scale factors for A. If EQUED = 'C' or 'B', A is
</span><span class="comment">*</span><span class="comment"> multiplied on the right by diag(C); if EQUED = 'N' or 'R', C
</span><span class="comment">*</span><span class="comment"> is not accessed. C is an input argument if FACT = 'F';
</span><span class="comment">*</span><span class="comment"> otherwise, C is an output argument. If FACT = 'F' and
</span><span class="comment">*</span><span class="comment"> EQUED = 'C' or 'B', each element of C must be positive.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> B (input/output) REAL array, dimension (LDB,NRHS)
</span><span class="comment">*</span><span class="comment"> On entry, the N-by-NRHS right hand side matrix B.
</span><span class="comment">*</span><span class="comment"> On exit,
</span><span class="comment">*</span><span class="comment"> if EQUED = 'N', B is not modified;
</span><span class="comment">*</span><span class="comment"> if TRANS = 'N' and EQUED = 'R' or 'B', B is overwritten by
</span><span class="comment">*</span><span class="comment"> diag(R)*B;
</span><span class="comment">*</span><span class="comment"> if TRANS = 'T' or 'C' and EQUED = 'C' or 'B', B is
</span><span class="comment">*</span><span class="comment"> overwritten by diag(C)*B.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDB (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The leading dimension of the array B. LDB >= max(1,N).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> X (output) REAL array, dimension (LDX,NRHS)
</span><span class="comment">*</span><span class="comment"> If INFO = 0 or INFO = N+1, the N-by-NRHS solution matrix X
</span><span class="comment">*</span><span class="comment"> to the original system of equations. Note that A and B are
</span><span class="comment">*</span><span class="comment"> modified on exit if EQUED .ne. 'N', and the solution to the
</span><span class="comment">*</span><span class="comment"> equilibrated system is inv(diag(C))*X if TRANS = 'N' and
</span><span class="comment">*</span><span class="comment"> EQUED = 'C' or 'B', or inv(diag(R))*X if TRANS = 'T' or 'C'
</span><span class="comment">*</span><span class="comment"> and EQUED = 'R' or 'B'.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDX (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The leading dimension of the array X. LDX >= max(1,N).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> RCOND (output) REAL
</span><span class="comment">*</span><span class="comment"> The estimate of the reciprocal condition number of the matrix
</span><span class="comment">*</span><span class="comment"> A after equilibration (if done). If RCOND is less than the
</span><span class="comment">*</span><span class="comment"> machine precision (in particular, if RCOND = 0), the matrix
</span><span class="comment">*</span><span class="comment"> is singular to working precision. This condition is
</span><span class="comment">*</span><span class="comment"> indicated by a return code of INFO > 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> FERR (output) REAL array, dimension (NRHS)
</span><span class="comment">*</span><span class="comment"> The estimated forward error bound for each solution vector
</span><span class="comment">*</span><span class="comment"> X(j) (the j-th column of the solution matrix X).
</span><span class="comment">*</span><span class="comment"> If XTRUE is the true solution corresponding to X(j), FERR(j)
</span><span class="comment">*</span><span class="comment"> is an estimated upper bound for the magnitude of the largest
</span><span class="comment">*</span><span class="comment"> element in (X(j) - XTRUE) divided by the magnitude of the
</span><span class="comment">*</span><span class="comment"> largest element in X(j). The estimate is as reliable as
</span><span class="comment">*</span><span class="comment"> the estimate for RCOND, and is almost always a slight
</span><span class="comment">*</span><span class="comment"> overestimate of the true error.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> BERR (output) REAL array, dimension (NRHS)
</span><span class="comment">*</span><span class="comment"> The componentwise relative backward error of each solution
</span><span class="comment">*</span><span class="comment"> vector X(j) (i.e., the smallest relative change in
</span><span class="comment">*</span><span class="comment"> any element of A or B that makes X(j) an exact solution).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> WORK (workspace/output) REAL array, dimension (4*N)
</span><span class="comment">*</span><span class="comment"> On exit, WORK(1) contains the reciprocal pivot growth
</span><span class="comment">*</span><span class="comment"> factor norm(A)/norm(U). The "max absolute element" norm is
</span><span class="comment">*</span><span class="comment"> used. If WORK(1) is much less than 1, then the stability
</span><span class="comment">*</span><span class="comment"> of the LU factorization of the (equilibrated) matrix A
</span><span class="comment">*</span><span class="comment"> could be poor. This also means that the solution X, condition
</span><span class="comment">*</span><span class="comment"> estimator RCOND, and forward error bound FERR could be
</span><span class="comment">*</span><span class="comment"> unreliable. If factorization fails with 0<INFO<=N, then
</span><span class="comment">*</span><span class="comment"> WORK(1) contains the reciprocal pivot growth factor for the
</span><span class="comment">*</span><span class="comment"> leading INFO columns of A.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> IWORK (workspace) INTEGER array, dimension (N)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> INFO (output) INTEGER
</span><span class="comment">*</span><span class="comment"> = 0: successful exit
</span><span class="comment">*</span><span class="comment"> < 0: if INFO = -i, the i-th argument had an illegal value
</span><span class="comment">*</span><span class="comment"> > 0: if INFO = i, and i is
</span><span class="comment">*</span><span class="comment"> <= N: U(i,i) is exactly zero. The factorization has
</span><span class="comment">*</span><span class="comment"> been completed, but the factor U is exactly
</span><span class="comment">*</span><span class="comment"> singular, so the solution and error bounds
</span><span class="comment">*</span><span class="comment"> could not be computed. RCOND = 0 is returned.
</span><span class="comment">*</span><span class="comment"> = N+1: U is nonsingular, but RCOND is less than machine
</span><span class="comment">*</span><span class="comment"> precision, meaning that the matrix is singular
</span><span class="comment">*</span><span class="comment"> to working precision. Nevertheless, the
</span><span class="comment">*</span><span class="comment"> solution and error bounds are computed because
</span><span class="comment">*</span><span class="comment"> there are a number of situations where the
</span><span class="comment">*</span><span class="comment"> computed solution can be more accurate than the
</span><span class="comment">*</span><span class="comment"> value of RCOND would suggest.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> =====================================================================
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> .. Parameters ..
</span> REAL ZERO, ONE
PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> LOGICAL COLEQU, EQUIL, NOFACT, NOTRAN, ROWEQU
CHARACTER NORM
INTEGER I, INFEQU, J
REAL AMAX, ANORM, BIGNUM, COLCND, RCMAX, RCMIN,
$ ROWCND, RPVGRW, SMLNUM
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Functions ..
</span> LOGICAL <a name="LSAME.260"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
REAL <a name="SLAMCH.261"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>, <a name="SLANGE.261"></a><a href="slange.f.html#SLANGE.1">SLANGE</a>, <a name="SLANTR.261"></a><a href="slantr.f.html#SLANTR.1">SLANTR</a>
EXTERNAL <a name="LSAME.262"></a><a href="lsame.f.html#LSAME.1">LSAME</a>, <a name="SLAMCH.262"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>, <a name="SLANGE.262"></a><a href="slange.f.html#SLANGE.1">SLANGE</a>, <a name="SLANTR.262"></a><a href="slantr.f.html#SLANTR.1">SLANTR</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL <a name="SGECON.265"></a><a href="sgecon.f.html#SGECON.1">SGECON</a>, <a name="SGEEQU.265"></a><a href="sgeequ.f.html#SGEEQU.1">SGEEQU</a>, <a name="SGERFS.265"></a><a href="sgerfs.f.html#SGERFS.1">SGERFS</a>, <a name="SGETRF.265"></a><a href="sgetrf.f.html#SGETRF.1">SGETRF</a>, <a name="SGETRS.265"></a><a href="sgetrs.f.html#SGETRS.1">SGETRS</a>, <a name="SLACPY.265"></a><a href="slacpy.f.html#SLACPY.1">SLACPY</a>,
$ <a name="SLAQGE.266"></a><a href="slaqge.f.html#SLAQGE.1">SLAQGE</a>, <a name="XERBLA.266"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Intrinsic Functions ..
</span> INTRINSIC MAX, MIN
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Executable Statements ..
</span><span class="comment">*</span><span class="comment">
</span> INFO = 0
NOFACT = <a name="LSAME.274"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( FACT, <span class="string">'N'</span> )
EQUIL = <a name="LSAME.275"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( FACT, <span class="string">'E'</span> )
NOTRAN = <a name="LSAME.276"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( TRANS, <span class="string">'N'</span> )
IF( NOFACT .OR. EQUIL ) THEN
EQUED = <span class="string">'N'</span>
ROWEQU = .FALSE.
COLEQU = .FALSE.
ELSE
ROWEQU = <a name="LSAME.282"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( EQUED, <span class="string">'R'</span> ) .OR. <a name="LSAME.282"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( EQUED, <span class="string">'B'</span> )
COLEQU = <a name="LSAME.283"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( EQUED, <span class="string">'C'</span> ) .OR. <a name="LSAME.283"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( EQUED, <span class="string">'B'</span> )
SMLNUM = <a name="SLAMCH.284"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>( <span class="string">'Safe minimum'</span> )
BIGNUM = ONE / SMLNUM
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Test the input parameters.
</span><span class="comment">*</span><span class="comment">
</span> IF( .NOT.NOFACT .AND. .NOT.EQUIL .AND. .NOT.<a name="LSAME.290"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( FACT, <span class="string">'F'</span> ) )
$ THEN
INFO = -1
ELSE IF( .NOT.NOTRAN .AND. .NOT.<a name="LSAME.293"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( TRANS, <span class="string">'T'</span> ) .AND. .NOT.
$ <a name="LSAME.294"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( TRANS, <span class="string">'C'</span> ) ) THEN
INFO = -2
ELSE IF( N.LT.0 ) THEN
INFO = -3
ELSE IF( NRHS.LT.0 ) THEN
INFO = -4
ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
INFO = -6
ELSE IF( LDAF.LT.MAX( 1, N ) ) THEN
INFO = -8
ELSE IF( <a name="LSAME.304"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( FACT, <span class="string">'F'</span> ) .AND. .NOT.
$ ( ROWEQU .OR. COLEQU .OR. <a name="LSAME.305"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( EQUED, <span class="string">'N'</span> ) ) ) THEN
INFO = -10
ELSE
IF( ROWEQU ) THEN
RCMIN = BIGNUM
RCMAX = ZERO
DO 10 J = 1, N
RCMIN = MIN( RCMIN, R( J ) )
RCMAX = MAX( RCMAX, R( J ) )
10 CONTINUE
IF( RCMIN.LE.ZERO ) THEN
INFO = -11
ELSE IF( N.GT.0 ) THEN
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?