cgtsvx.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 317 行 · 第 1/2 页
HTML
317 行
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> X (output) COMPLEX 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">
</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. If RCOND is less than the machine precision (in
</span><span class="comment">*</span><span class="comment"> particular, if RCOND = 0), the matrix is singular to working
</span><span class="comment">*</span><span class="comment"> precision. This condition is indicated by a return code of
</span><span class="comment">*</span><span class="comment"> 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) COMPLEX array, dimension (2*N)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> RWORK (workspace) REAL 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
</span><span class="comment">*</span><span class="comment"> has not been completed unless i = N, but the
</span><span class="comment">*</span><span class="comment"> factor U is exactly singular, so the solution
</span><span class="comment">*</span><span class="comment"> and error bounds could not be computed.
</span><span class="comment">*</span><span class="comment"> 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
PARAMETER ( ZERO = 0.0E+0 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> LOGICAL NOFACT, NOTRAN
CHARACTER NORM
REAL ANORM
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Functions ..
</span> LOGICAL <a name="LSAME.203"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
REAL <a name="CLANGT.204"></a><a href="clangt.f.html#CLANGT.1">CLANGT</a>, <a name="SLAMCH.204"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>
EXTERNAL <a name="LSAME.205"></a><a href="lsame.f.html#LSAME.1">LSAME</a>, <a name="CLANGT.205"></a><a href="clangt.f.html#CLANGT.1">CLANGT</a>, <a name="SLAMCH.205"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL CCOPY, <a name="CGTCON.208"></a><a href="cgtcon.f.html#CGTCON.1">CGTCON</a>, <a name="CGTRFS.208"></a><a href="cgtrfs.f.html#CGTRFS.1">CGTRFS</a>, <a name="CGTTRF.208"></a><a href="cgttrf.f.html#CGTTRF.1">CGTTRF</a>, <a name="CGTTRS.208"></a><a href="cgttrs.f.html#CGTTRS.1">CGTTRS</a>, <a name="CLACPY.208"></a><a href="clacpy.f.html#CLACPY.1">CLACPY</a>,
$ <a name="XERBLA.209"></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
<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.217"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( FACT, <span class="string">'N'</span> )
NOTRAN = <a name="LSAME.218"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( TRANS, <span class="string">'N'</span> )
IF( .NOT.NOFACT .AND. .NOT.<a name="LSAME.219"></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.221"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( TRANS, <span class="string">'T'</span> ) .AND. .NOT.
$ <a name="LSAME.222"></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( LDB.LT.MAX( 1, N ) ) THEN
INFO = -14
ELSE IF( LDX.LT.MAX( 1, N ) ) THEN
INFO = -16
END IF
IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.234"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="CGTSVX.234"></a><a href="cgtsvx.f.html#CGTSVX.1">CGTSVX</a>'</span>, -INFO )
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span> IF( NOFACT ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute the LU factorization of A.
</span><span class="comment">*</span><span class="comment">
</span> CALL CCOPY( N, D, 1, DF, 1 )
IF( N.GT.1 ) THEN
CALL CCOPY( N-1, DL, 1, DLF, 1 )
CALL CCOPY( N-1, DU, 1, DUF, 1 )
END IF
CALL <a name="CGTTRF.247"></a><a href="cgttrf.f.html#CGTTRF.1">CGTTRF</a>( N, DLF, DF, DUF, DU2, IPIV, INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Return if INFO is non-zero.
</span><span class="comment">*</span><span class="comment">
</span> IF( INFO.GT.0 )THEN
RCOND = ZERO
RETURN
END IF
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute the norm of the matrix A.
</span><span class="comment">*</span><span class="comment">
</span> IF( NOTRAN ) THEN
NORM = <span class="string">'1'</span>
ELSE
NORM = <span class="string">'I'</span>
END IF
ANORM = <a name="CLANGT.264"></a><a href="clangt.f.html#CLANGT.1">CLANGT</a>( NORM, N, DL, D, DU )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute the reciprocal of the condition number of A.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="CGTCON.268"></a><a href="cgtcon.f.html#CGTCON.1">CGTCON</a>( NORM, N, DLF, DF, DUF, DU2, IPIV, ANORM, RCOND, WORK,
$ INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute the solution vectors X.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="CLACPY.273"></a><a href="clacpy.f.html#CLACPY.1">CLACPY</a>( <span class="string">'Full'</span>, N, NRHS, B, LDB, X, LDX )
CALL <a name="CGTTRS.274"></a><a href="cgttrs.f.html#CGTTRS.1">CGTTRS</a>( TRANS, N, NRHS, DLF, DF, DUF, DU2, IPIV, X, LDX,
$ INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Use iterative refinement to improve the computed solutions and
</span><span class="comment">*</span><span class="comment"> compute error bounds and backward error estimates for them.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="CGTRFS.280"></a><a href="cgtrfs.f.html#CGTRFS.1">CGTRFS</a>( TRANS, N, NRHS, DL, D, DU, DLF, DF, DUF, DU2, IPIV,
$ B, LDB, X, LDX, FERR, BERR, WORK, RWORK, INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Set INFO = N+1 if the matrix is singular to working precision.
</span><span class="comment">*</span><span class="comment">
</span> IF( RCOND.LT.<a name="SLAMCH.285"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>( <span class="string">'Epsilon'</span> ) )
$ INFO = N + 1
<span class="comment">*</span><span class="comment">
</span> RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> End of <a name="CGTSVX.290"></a><a href="cgtsvx.f.html#CGTSVX.1">CGTSVX</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?