1
SUBROUTINE DPPTRF( UPLO, N, AP, INFO )
3
* -- LAPACK routine (version 2.0) --
4
* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
5
* Courant Institute, Argonne National Lab, and Rice University
8
* .. Scalar Arguments ..
12
* .. Array Arguments ..
13
DOUBLE PRECISION AP( * )
19
* DPPTRF computes the Cholesky factorization of a real symmetric
20
* positive definite matrix A stored in packed format.
22
* The factorization has the form
23
* A = U**T * U, if UPLO = 'U', or
24
* A = L * L**T, if UPLO = 'L',
25
* where U is an upper triangular matrix and L is lower triangular.
30
* UPLO (input) CHARACTER*1
31
* = 'U': Upper triangle of A is stored;
32
* = 'L': Lower triangle of A is stored.
35
* The order of the matrix A. N >= 0.
37
* AP (input/output) DOUBLE PRECISION array, dimension (N*(N+1)/2)
38
* On entry, the upper or lower triangle of the symmetric matrix
39
* A, packed columnwise in a linear array. The j-th column of A
40
* is stored in the array AP as follows:
41
* if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
42
* if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
43
* See below for further details.
45
* On exit, if INFO = 0, the triangular factor U or L from the
46
* Cholesky factorization A = U**T*U or A = L*L**T, in the same
47
* storage format as A.
49
* INFO (output) INTEGER
50
* = 0: successful exit
51
* < 0: if INFO = -i, the i-th argument had an illegal value
52
* > 0: if INFO = i, the leading minor of order i is not
53
* positive definite, and the factorization could not be
59
* The packed storage scheme is illustrated by the following example
60
* when N = 4, UPLO = 'U':
62
* Two-dimensional storage of the symmetric matrix A:
69
* Packed storage of the upper triangle of A:
71
* AP = [ a11, a12, a22, a13, a23, a33, a14, a24, a34, a44 ]
73
* =====================================================================
76
DOUBLE PRECISION ONE, ZERO
77
PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
84
* .. External Functions ..
89
* .. External Subroutines ..
90
EXTERNAL DSCAL, DSPR, DTPSV, XERBLA
92
* .. Intrinsic Functions ..
95
* .. Executable Statements ..
97
* Test the input parameters.
100
UPPER = LSAME( UPLO, 'U' )
101
IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
103
ELSE IF( N.LT.0 ) THEN
107
CALL XERBLA( 'DPPTRF', -INFO )
111
* Quick return if possible
118
* Compute the Cholesky factorization A = U'*U.
125
* Compute elements 1:J-1 of column J.
128
$ CALL DTPSV( 'Upper', 'Transpose', 'Non-unit', J-1, AP,
131
* Compute U(J,J) and test for non-positive-definiteness.
133
AJJ = AP( JJ ) - DDOT( J-1, AP( JC ), 1, AP( JC ), 1 )
134
IF( AJJ.LE.ZERO ) THEN
138
AP( JJ ) = SQRT( AJJ )
142
* Compute the Cholesky factorization A = L*L'.
147
* Compute L(J,J) and test for non-positive-definiteness.
150
IF( AJJ.LE.ZERO ) THEN
157
* Compute elements J+1:N of column J and update the trailing
161
CALL DSCAL( N-J, ONE / AJJ, AP( JJ+1 ), 1 )
162
CALL DSPR( 'Lower', N-J, -ONE, AP( JJ+1 ), 1,