cppsvx.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 406 行 · 第 1/3 页
HTML
406 行
<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.257"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( FACT, <span class="string">'F'</span> ) )
$ THEN
INFO = -1
ELSE IF( .NOT.<a name="LSAME.260"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'U'</span> ) .AND. .NOT.<a name="LSAME.260"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'L'</span> ) )
$ THEN
INFO = -2
ELSE IF( N.LT.0 ) THEN
INFO = -3
ELSE IF( NRHS.LT.0 ) THEN
INFO = -4
ELSE IF( <a name="LSAME.267"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( FACT, <span class="string">'F'</span> ) .AND. .NOT.
$ ( RCEQU .OR. <a name="LSAME.268"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( EQUED, <span class="string">'N'</span> ) ) ) THEN
INFO = -7
ELSE
IF( RCEQU ) THEN
SMIN = BIGNUM
SMAX = ZERO
DO 10 J = 1, N
SMIN = MIN( SMIN, S( J ) )
SMAX = MAX( SMAX, S( J ) )
10 CONTINUE
IF( SMIN.LE.ZERO ) THEN
INFO = -8
ELSE IF( N.GT.0 ) THEN
SCOND = MAX( SMIN, SMLNUM ) / MIN( SMAX, BIGNUM )
ELSE
SCOND = ONE
END IF
END IF
IF( INFO.EQ.0 ) THEN
IF( LDB.LT.MAX( 1, N ) ) THEN
INFO = -10
ELSE IF( LDX.LT.MAX( 1, N ) ) THEN
INFO = -12
END IF
END IF
END IF
<span class="comment">*</span><span class="comment">
</span> IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.296"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="CPPSVX.296"></a><a href="cppsvx.f.html#CPPSVX.1">CPPSVX</a>'</span>, -INFO )
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span> IF( EQUIL ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute row and column scalings to equilibrate the matrix A.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="CPPEQU.304"></a><a href="cppequ.f.html#CPPEQU.1">CPPEQU</a>( UPLO, N, AP, S, SCOND, AMAX, INFEQU )
IF( INFEQU.EQ.0 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Equilibrate the matrix.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="CLAQHP.309"></a><a href="claqhp.f.html#CLAQHP.1">CLAQHP</a>( UPLO, N, AP, S, SCOND, AMAX, EQUED )
RCEQU = <a name="LSAME.310"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( EQUED, <span class="string">'Y'</span> )
END IF
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Scale the right-hand side.
</span><span class="comment">*</span><span class="comment">
</span> IF( RCEQU ) THEN
DO 30 J = 1, NRHS
DO 20 I = 1, N
B( I, J ) = S( I )*B( I, J )
20 CONTINUE
30 CONTINUE
END IF
<span class="comment">*</span><span class="comment">
</span> IF( NOFACT .OR. EQUIL ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute the Cholesky factorization A = U'*U or A = L*L'.
</span><span class="comment">*</span><span class="comment">
</span> CALL CCOPY( N*( N+1 ) / 2, AP, 1, AFP, 1 )
CALL <a name="CPPTRF.329"></a><a href="cpptrf.f.html#CPPTRF.1">CPPTRF</a>( UPLO, N, AFP, 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> ANORM = <a name="CLANHP.341"></a><a href="clanhp.f.html#CLANHP.1">CLANHP</a>( <span class="string">'I'</span>, UPLO, N, AP, RWORK )
<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="CPPCON.345"></a><a href="cppcon.f.html#CPPCON.1">CPPCON</a>( UPLO, N, AFP, ANORM, RCOND, WORK, RWORK, INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute the solution matrix X.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="CLACPY.349"></a><a href="clacpy.f.html#CLACPY.1">CLACPY</a>( <span class="string">'Full'</span>, N, NRHS, B, LDB, X, LDX )
CALL <a name="CPPTRS.350"></a><a href="cpptrs.f.html#CPPTRS.1">CPPTRS</a>( UPLO, N, NRHS, AFP, 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 solution and
</span><span class="comment">*</span><span class="comment"> compute error bounds and backward error estimates for it.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="CPPRFS.355"></a><a href="cpprfs.f.html#CPPRFS.1">CPPRFS</a>( UPLO, N, NRHS, AP, AFP, B, LDB, X, LDX, FERR, BERR,
$ WORK, RWORK, INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Transform the solution matrix X to a solution of the original
</span><span class="comment">*</span><span class="comment"> system.
</span><span class="comment">*</span><span class="comment">
</span> IF( RCEQU ) THEN
DO 50 J = 1, NRHS
DO 40 I = 1, N
X( I, J ) = S( I )*X( I, J )
40 CONTINUE
50 CONTINUE
DO 60 J = 1, NRHS
FERR( J ) = FERR( J ) / SCOND
60 CONTINUE
END IF
<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.374"></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="CPPSVX.379"></a><a href="cppsvx.f.html#CPPSVX.1">CPPSVX</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?