zppsvx.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="ZPPSVX.296"></a><a href="zppsvx.f.html#ZPPSVX.1">ZPPSVX</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="ZPPEQU.304"></a><a href="zppequ.f.html#ZPPEQU.1">ZPPEQU</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="ZLAQHP.309"></a><a href="zlaqhp.f.html#ZLAQHP.1">ZLAQHP</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 ZCOPY( N*( N+1 ) / 2, AP, 1, AFP, 1 )
CALL <a name="ZPPTRF.329"></a><a href="zpptrf.f.html#ZPPTRF.1">ZPPTRF</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="ZLANHP.341"></a><a href="zlanhp.f.html#ZLANHP.1">ZLANHP</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="ZPPCON.345"></a><a href="zppcon.f.html#ZPPCON.1">ZPPCON</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="ZLACPY.349"></a><a href="zlacpy.f.html#ZLACPY.1">ZLACPY</a>( <span class="string">'Full'</span>, N, NRHS, B, LDB, X, LDX )
CALL <a name="ZPPTRS.350"></a><a href="zpptrs.f.html#ZPPTRS.1">ZPPTRS</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="ZPPRFS.355"></a><a href="zpprfs.f.html#ZPPRFS.1">ZPPRFS</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="DLAMCH.374"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</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="ZPPSVX.379"></a><a href="zppsvx.f.html#ZPPSVX.1">ZPPSVX</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?