ssptri.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 359 行 · 第 1/2 页
HTML
359 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>ssptri.f</title>
<meta name="generator" content="emacs 21.3.1; htmlfontify 0.20">
<style type="text/css"><!--
body { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.default { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.default a { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
span.string { color: rgb(188, 143, 143); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.string a { color: rgb(188, 143, 143); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
span.comment { color: rgb(178, 34, 34); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.comment a { color: rgb(178, 34, 34); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
--></style>
</head>
<body>
<pre>
SUBROUTINE <a name="SSPTRI.1"></a><a href="ssptri.f.html#SSPTRI.1">SSPTRI</a>( UPLO, N, AP, IPIV, WORK, INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> -- LAPACK routine (version 3.1) --
</span><span class="comment">*</span><span class="comment"> Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
</span><span class="comment">*</span><span class="comment"> November 2006
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> .. Scalar Arguments ..
</span> CHARACTER UPLO
INTEGER INFO, N
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Array Arguments ..
</span> INTEGER IPIV( * )
REAL AP( * ), WORK( * )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Purpose
</span><span class="comment">*</span><span class="comment"> =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> <a name="SSPTRI.19"></a><a href="ssptri.f.html#SSPTRI.1">SSPTRI</a> computes the inverse of a real symmetric indefinite matrix
</span><span class="comment">*</span><span class="comment"> A in packed storage using the factorization A = U*D*U**T or
</span><span class="comment">*</span><span class="comment"> A = L*D*L**T computed by <a name="SSPTRF.21"></a><a href="ssptrf.f.html#SSPTRF.1">SSPTRF</a>.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Arguments
</span><span class="comment">*</span><span class="comment"> =========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> UPLO (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment"> Specifies whether the details of the factorization are stored
</span><span class="comment">*</span><span class="comment"> as an upper or lower triangular matrix.
</span><span class="comment">*</span><span class="comment"> = 'U': Upper triangular, form is A = U*D*U**T;
</span><span class="comment">*</span><span class="comment"> = 'L': Lower triangular, form is A = L*D*L**T.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> N (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The order of the matrix A. N >= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> AP (input/output) REAL array, dimension (N*(N+1)/2)
</span><span class="comment">*</span><span class="comment"> On entry, the block diagonal matrix D and the multipliers
</span><span class="comment">*</span><span class="comment"> used to obtain the factor U or L as computed by <a name="SSPTRF.37"></a><a href="ssptrf.f.html#SSPTRF.1">SSPTRF</a>,
</span><span class="comment">*</span><span class="comment"> stored as a packed triangular matrix.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> On exit, if INFO = 0, the (symmetric) inverse of the original
</span><span class="comment">*</span><span class="comment"> matrix, stored as a packed triangular matrix. The j-th column
</span><span class="comment">*</span><span class="comment"> of inv(A) is stored in the array AP as follows:
</span><span class="comment">*</span><span class="comment"> if UPLO = 'U', AP(i + (j-1)*j/2) = inv(A)(i,j) for 1<=i<=j;
</span><span class="comment">*</span><span class="comment"> if UPLO = 'L',
</span><span class="comment">*</span><span class="comment"> AP(i + (j-1)*(2n-j)/2) = inv(A)(i,j) for j<=i<=n.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> IPIV (input) INTEGER array, dimension (N)
</span><span class="comment">*</span><span class="comment"> Details of the interchanges and the block structure of D
</span><span class="comment">*</span><span class="comment"> as determined by <a name="SSPTRF.49"></a><a href="ssptrf.f.html#SSPTRF.1">SSPTRF</a>.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> WORK (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, D(i,i) = 0; the matrix is singular and its
</span><span class="comment">*</span><span class="comment"> inverse could not be computed.
</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 ONE, ZERO
PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> LOGICAL UPPER
INTEGER J, K, KC, KCNEXT, KP, KPC, KSTEP, KX, NPP
REAL AK, AKKP1, AKP1, D, T, TEMP
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Functions ..
</span> LOGICAL <a name="LSAME.71"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
REAL SDOT
EXTERNAL <a name="LSAME.73"></a><a href="lsame.f.html#LSAME.1">LSAME</a>, SDOT
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL SCOPY, SSPMV, SSWAP, <a name="XERBLA.76"></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 ABS
<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><span class="comment">*</span><span class="comment"> Test the input parameters.
</span><span class="comment">*</span><span class="comment">
</span> INFO = 0
UPPER = <a name="LSAME.86"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'U'</span> )
IF( .NOT.UPPER .AND. .NOT.<a name="LSAME.87"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'L'</span> ) ) THEN
INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
END IF
IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.93"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="SSPTRI.93"></a><a href="ssptri.f.html#SSPTRI.1">SSPTRI</a>'</span>, -INFO )
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Quick return if possible
</span><span class="comment">*</span><span class="comment">
</span> IF( N.EQ.0 )
$ RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Check that the diagonal matrix D is nonsingular.
</span><span class="comment">*</span><span class="comment">
</span> IF( UPPER ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Upper triangular storage: examine D from bottom to top
</span><span class="comment">*</span><span class="comment">
</span> KP = N*( N+1 ) / 2
DO 10 INFO = N, 1, -1
IF( IPIV( INFO ).GT.0 .AND. AP( KP ).EQ.ZERO )
$ RETURN
KP = KP - INFO
10 CONTINUE
ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Lower triangular storage: examine D from top to bottom.
</span><span class="comment">*</span><span class="comment">
</span> KP = 1
DO 20 INFO = 1, N
IF( IPIV( INFO ).GT.0 .AND. AP( KP ).EQ.ZERO )
$ RETURN
KP = KP + N - INFO + 1
20 CONTINUE
END IF
INFO = 0
<span class="comment">*</span><span class="comment">
</span> IF( UPPER ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute inv(A) from the factorization A = U*D*U'.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> K is the main loop index, increasing from 1 to N in steps of
</span><span class="comment">*</span><span class="comment"> 1 or 2, depending on the size of the diagonal blocks.
</span><span class="comment">*</span><span class="comment">
</span> K = 1
KC = 1
30 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> If K > N, exit from loop.
</span><span class="comment">*</span><span class="comment">
</span> IF( K.GT.N )
$ GO TO 50
<span class="comment">*</span><span class="comment">
</span> KCNEXT = KC + K
IF( IPIV( K ).GT.0 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> 1 x 1 diagonal block
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Invert the diagonal block.
</span><span class="comment">*</span><span class="comment">
</span> AP( KC+K-1 ) = ONE / AP( KC+K-1 )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute column K of the inverse.
</span><span class="comment">*</span><span class="comment">
</span> IF( K.GT.1 ) THEN
CALL SCOPY( K-1, AP( KC ), 1, WORK, 1 )
CALL SSPMV( UPLO, K-1, -ONE, AP, WORK, 1, ZERO, AP( KC ),
$ 1 )
AP( KC+K-1 ) = AP( KC+K-1 ) -
$ SDOT( K-1, WORK, 1, AP( KC ), 1 )
END IF
KSTEP = 1
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?