dpptrf.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 202 行
HTML
202 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>dpptrf.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="DPPTRF.1"></a><a href="dpptrf.f.html#DPPTRF.1">DPPTRF</a>( UPLO, N, AP, 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> DOUBLE PRECISION AP( * )
<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="DPPTRF.18"></a><a href="dpptrf.f.html#DPPTRF.1">DPPTRF</a> computes the Cholesky factorization of a real symmetric
</span><span class="comment">*</span><span class="comment"> positive definite matrix A stored in packed format.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> The factorization has the form
</span><span class="comment">*</span><span class="comment"> A = U**T * U, if UPLO = 'U', or
</span><span class="comment">*</span><span class="comment"> A = L * L**T, if UPLO = 'L',
</span><span class="comment">*</span><span class="comment"> where U is an upper triangular matrix and L is lower triangular.
</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"> = 'U': Upper triangle of A is stored;
</span><span class="comment">*</span><span class="comment"> = 'L': Lower triangle of A is stored.
</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) DOUBLE PRECISION array, dimension (N*(N+1)/2)
</span><span class="comment">*</span><span class="comment"> On entry, the upper or lower triangle of the symmetric matrix
</span><span class="comment">*</span><span class="comment"> A, packed columnwise in a linear array. The j-th column of A
</span><span class="comment">*</span><span class="comment"> 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) = A(i,j) for 1<=i<=j;
</span><span class="comment">*</span><span class="comment"> if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
</span><span class="comment">*</span><span class="comment"> See below for further details.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> On exit, if INFO = 0, the triangular factor U or L from the
</span><span class="comment">*</span><span class="comment"> Cholesky factorization A = U**T*U or A = L*L**T, in the same
</span><span class="comment">*</span><span class="comment"> storage format as A.
</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, the leading minor of order i is not
</span><span class="comment">*</span><span class="comment"> positive definite, and the factorization could not be
</span><span class="comment">*</span><span class="comment"> completed.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Further Details
</span><span class="comment">*</span><span class="comment"> ======= =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> The packed storage scheme is illustrated by the following example
</span><span class="comment">*</span><span class="comment"> when N = 4, UPLO = 'U':
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Two-dimensional storage of the symmetric matrix A:
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> a11 a12 a13 a14
</span><span class="comment">*</span><span class="comment"> a22 a23 a24
</span><span class="comment">*</span><span class="comment"> a33 a34 (aij = aji)
</span><span class="comment">*</span><span class="comment"> a44
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Packed storage of the upper triangle of A:
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> AP = [ a11, a12, a22, a13, a23, a33, a14, a24, a34, a44 ]
</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> DOUBLE PRECISION ONE, ZERO
PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> LOGICAL UPPER
INTEGER J, JC, JJ
DOUBLE PRECISION AJJ
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Functions ..
</span> LOGICAL <a name="LSAME.84"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
DOUBLE PRECISION DDOT
EXTERNAL <a name="LSAME.86"></a><a href="lsame.f.html#LSAME.1">LSAME</a>, DDOT
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL DSCAL, DSPR, DTPSV, <a name="XERBLA.89"></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 SQRT
<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.99"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'U'</span> )
IF( .NOT.UPPER .AND. .NOT.<a name="LSAME.100"></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.106"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="DPPTRF.106"></a><a href="dpptrf.f.html#DPPTRF.1">DPPTRF</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> IF( UPPER ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute the Cholesky factorization A = U'*U.
</span><span class="comment">*</span><span class="comment">
</span> JJ = 0
DO 10 J = 1, N
JC = JJ + 1
JJ = JJ + J
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute elements 1:J-1 of column J.
</span><span class="comment">*</span><span class="comment">
</span> IF( J.GT.1 )
$ CALL DTPSV( <span class="string">'Upper'</span>, <span class="string">'Transpose'</span>, <span class="string">'Non-unit'</span>, J-1, AP,
$ AP( JC ), 1 )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute U(J,J) and test for non-positive-definiteness.
</span><span class="comment">*</span><span class="comment">
</span> AJJ = AP( JJ ) - DDOT( J-1, AP( JC ), 1, AP( JC ), 1 )
IF( AJJ.LE.ZERO ) THEN
AP( JJ ) = AJJ
GO TO 30
END IF
AP( JJ ) = SQRT( AJJ )
10 CONTINUE
ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute the Cholesky factorization A = L*L'.
</span><span class="comment">*</span><span class="comment">
</span> JJ = 1
DO 20 J = 1, N
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute L(J,J) and test for non-positive-definiteness.
</span><span class="comment">*</span><span class="comment">
</span> AJJ = AP( JJ )
IF( AJJ.LE.ZERO ) THEN
AP( JJ ) = AJJ
GO TO 30
END IF
AJJ = SQRT( AJJ )
AP( JJ ) = AJJ
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute elements J+1:N of column J and update the trailing
</span><span class="comment">*</span><span class="comment"> submatrix.
</span><span class="comment">*</span><span class="comment">
</span> IF( J.LT.N ) THEN
CALL DSCAL( N-J, ONE / AJJ, AP( JJ+1 ), 1 )
CALL DSPR( <span class="string">'Lower'</span>, N-J, -ONE, AP( JJ+1 ), 1,
$ AP( JJ+N-J+1 ) )
JJ = JJ + N - J + 1
END IF
20 CONTINUE
END IF
GO TO 40
<span class="comment">*</span><span class="comment">
</span> 30 CONTINUE
INFO = J
<span class="comment">*</span><span class="comment">
</span> 40 CONTINUE
RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> End of <a name="DPPTRF.175"></a><a href="dpptrf.f.html#DPPTRF.1">DPPTRF</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?