1 *> \brief \b DPOTF2 computes the Cholesky factorization of a symmetric/Hermitian positive definite matrix (unblocked algorithm).
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download DPOTF2 + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dpotf2.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dpotf2.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dpotf2.f">
21 * SUBROUTINE DPOTF2( UPLO, N, A, LDA, INFO )
23 * .. Scalar Arguments ..
25 * INTEGER INFO, LDA, N
27 * .. Array Arguments ..
28 * DOUBLE PRECISION A( LDA, * )
37 *> DPOTF2 computes the Cholesky factorization of a real symmetric
38 *> positive definite matrix A.
40 *> The factorization has the form
41 *> A = U**T * U , if UPLO = 'U', or
42 *> A = L * L**T, if UPLO = 'L',
43 *> where U is an upper triangular matrix and L is lower triangular.
45 *> This is the unblocked version of the algorithm, calling Level 2 BLAS.
53 *> UPLO is CHARACTER*1
54 *> Specifies whether the upper or lower triangular part of the
55 *> symmetric matrix A is stored.
56 *> = 'U': Upper triangular
57 *> = 'L': Lower triangular
63 *> The order of the matrix A. N >= 0.
68 *> A is DOUBLE PRECISION array, dimension (LDA,N)
69 *> On entry, the symmetric matrix A. If UPLO = 'U', the leading
70 *> n by n upper triangular part of A contains the upper
71 *> triangular part of the matrix A, and the strictly lower
72 *> triangular part of A is not referenced. If UPLO = 'L', the
73 *> leading n by n lower triangular part of A contains the lower
74 *> triangular part of the matrix A, and the strictly upper
75 *> triangular part of A is not referenced.
77 *> On exit, if INFO = 0, the factor U or L from the Cholesky
78 *> factorization A = U**T *U or A = L*L**T.
84 *> The leading dimension of the array A. LDA >= max(1,N).
90 *> = 0: successful exit
91 *> < 0: if INFO = -k, the k-th argument had an illegal value
92 *> > 0: if INFO = k, the leading minor of order k is not
93 *> positive definite, and the factorization could not be
100 *> \author Univ. of Tennessee
101 *> \author Univ. of California Berkeley
102 *> \author Univ. of Colorado Denver
105 *> \date September 2012
107 *> \ingroup doublePOcomputational
109 * =====================================================================
110 SUBROUTINE DPOTF2( UPLO, N, A, LDA, INFO )
112 * -- LAPACK computational routine (version 3.4.2) --
113 * -- LAPACK is a software package provided by Univ. of Tennessee, --
114 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
117 * .. Scalar Arguments ..
121 * .. Array Arguments ..
122 DOUBLE PRECISION A( LDA, * )
125 * =====================================================================
128 DOUBLE PRECISION ONE, ZERO
129 PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
131 * .. Local Scalars ..
136 * .. External Functions ..
137 LOGICAL LSAME, DISNAN
138 DOUBLE PRECISION DDOT
139 EXTERNAL LSAME, DDOT, DISNAN
141 * .. External Subroutines ..
142 EXTERNAL DGEMV, DSCAL, XERBLA
144 * .. Intrinsic Functions ..
147 * .. Executable Statements ..
149 * Test the input parameters.
152 UPPER = LSAME( UPLO, 'U' )
153 IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
155 ELSE IF( N.LT.0 ) THEN
157 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
161 CALL XERBLA( 'DPOTF2', -INFO )
165 * Quick return if possible
172 * Compute the Cholesky factorization A = U**T *U.
176 * Compute U(J,J) and test for non-positive-definiteness.
178 AJJ = A( J, J ) - DDOT( J-1, A( 1, J ), 1, A( 1, J ), 1 )
179 IF( AJJ.LE.ZERO.OR.DISNAN( AJJ ) ) THEN
186 * Compute elements J+1:N of row J.
189 CALL DGEMV( 'Transpose', J-1, N-J, -ONE, A( 1, J+1 ),
190 $ LDA, A( 1, J ), 1, ONE, A( J, J+1 ), LDA )
191 CALL DSCAL( N-J, ONE / AJJ, A( J, J+1 ), LDA )
196 * Compute the Cholesky factorization A = L*L**T.
200 * Compute L(J,J) and test for non-positive-definiteness.
202 AJJ = A( J, J ) - DDOT( J-1, A( J, 1 ), LDA, A( J, 1 ),
204 IF( AJJ.LE.ZERO.OR.DISNAN( AJJ ) ) THEN
211 * Compute elements J+1:N of column J.
214 CALL DGEMV( 'No transpose', N-J, J-1, -ONE, A( J+1, 1 ),
215 $ LDA, A( J, 1 ), LDA, ONE, A( J+1, J ), 1 )
216 CALL DSCAL( N-J, ONE / AJJ, A( J+1, J ), 1 )