LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ dpotf2()

subroutine dpotf2 ( character uplo,
integer n,
double precision, dimension( lda, * ) a,
integer lda,
integer info )

DPOTF2 computes the Cholesky factorization of a symmetric/Hermitian positive definite matrix (unblocked algorithm).

Download DPOTF2 + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> DPOTF2 computes the Cholesky factorization of a real symmetric
!> positive definite matrix A.
!>
!> The factorization has the form
!>    A = U**T * U ,  if UPLO = 'U', or
!>    A = L  * L**T,  if UPLO = 'L',
!> where U is an upper triangular matrix and L is lower triangular.
!>
!> This is the unblocked version of the algorithm, calling Level 2 BLAS.
!> 
Parameters
[in]UPLO
!>          UPLO is CHARACTER*1
!>          Specifies whether the upper or lower triangular part of the
!>          symmetric matrix A is stored.
!>          = 'U':  Upper triangular
!>          = 'L':  Lower triangular
!> 
[in]N
!>          N is INTEGER
!>          The order of the matrix A.  N >= 0.
!> 
[in,out]A
!>          A is DOUBLE PRECISION array, dimension (LDA,N)
!>          On entry, the symmetric matrix A.  If UPLO = 'U', the leading
!>          n by n upper triangular part of A contains the upper
!>          triangular part of the matrix A, and the strictly lower
!>          triangular part of A is not referenced.  If UPLO = 'L', the
!>          leading n by n lower triangular part of A contains the lower
!>          triangular part of the matrix A, and the strictly upper
!>          triangular part of A is not referenced.
!>
!>          On exit, if INFO = 0, the factor U or L from the Cholesky
!>          factorization A = U**T *U  or A = L*L**T.
!> 
[in]LDA
!>          LDA is INTEGER
!>          The leading dimension of the array A.  LDA >= max(1,N).
!> 
[out]INFO
!>          INFO is INTEGER
!>          = 0: successful exit
!>          < 0: if INFO = -k, the k-th argument had an illegal value
!>          > 0: if INFO = k, the leading principal minor of order k
!>               is not positive, and the factorization could not be
!>               completed.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 106 of file dpotf2.f.

107*
108* -- LAPACK computational routine --
109* -- LAPACK is a software package provided by Univ. of Tennessee, --
110* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
111*
112* .. Scalar Arguments ..
113 CHARACTER UPLO
114 INTEGER INFO, LDA, N
115* ..
116* .. Array Arguments ..
117 DOUBLE PRECISION A( LDA, * )
118* ..
119*
120* =====================================================================
121*
122* .. Parameters ..
123 DOUBLE PRECISION ONE, ZERO
124 parameter( one = 1.0d+0, zero = 0.0d+0 )
125* ..
126* .. Local Scalars ..
127 LOGICAL UPPER
128 INTEGER J
129 DOUBLE PRECISION AJJ
130* ..
131* .. External Functions ..
132 LOGICAL LSAME, DISNAN
133 DOUBLE PRECISION DDOT
134 EXTERNAL lsame, ddot, disnan
135* ..
136* .. External Subroutines ..
137 EXTERNAL dgemv, dscal, xerbla
138* ..
139* .. Intrinsic Functions ..
140 INTRINSIC max, sqrt
141* ..
142* .. Executable Statements ..
143*
144* Test the input parameters.
145*
146 info = 0
147 upper = lsame( uplo, 'U' )
148 IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
149 info = -1
150 ELSE IF( n.LT.0 ) THEN
151 info = -2
152 ELSE IF( lda.LT.max( 1, n ) ) THEN
153 info = -4
154 END IF
155 IF( info.NE.0 ) THEN
156 CALL xerbla( 'DPOTF2', -info )
157 RETURN
158 END IF
159*
160* Quick return if possible
161*
162 IF( n.EQ.0 )
163 $ RETURN
164*
165 IF( upper ) THEN
166*
167* Compute the Cholesky factorization A = U**T *U.
168*
169 DO 10 j = 1, n
170*
171* Compute U(J,J) and test for non-positive-definiteness.
172*
173 ajj = a( j, j ) - ddot( j-1, a( 1, j ), 1, a( 1, j ), 1 )
174 IF( ajj.LE.zero.OR.disnan( ajj ) ) THEN
175 a( j, j ) = ajj
176 GO TO 30
177 END IF
178 ajj = sqrt( ajj )
179 a( j, j ) = ajj
180*
181* Compute elements J+1:N of row J.
182*
183 IF( j.LT.n ) THEN
184 CALL dgemv( 'Transpose', j-1, n-j, -one, a( 1, j+1 ),
185 $ lda, a( 1, j ), 1, one, a( j, j+1 ), lda )
186 CALL dscal( n-j, one / ajj, a( j, j+1 ), lda )
187 END IF
188 10 CONTINUE
189 ELSE
190*
191* Compute the Cholesky factorization A = L*L**T.
192*
193 DO 20 j = 1, n
194*
195* Compute L(J,J) and test for non-positive-definiteness.
196*
197 ajj = a( j, j ) - ddot( j-1, a( j, 1 ), lda, a( j, 1 ),
198 $ lda )
199 IF( ajj.LE.zero.OR.disnan( ajj ) ) THEN
200 a( j, j ) = ajj
201 GO TO 30
202 END IF
203 ajj = sqrt( ajj )
204 a( j, j ) = ajj
205*
206* Compute elements J+1:N of column J.
207*
208 IF( j.LT.n ) THEN
209 CALL dgemv( 'No transpose', n-j, j-1, -one, a( j+1,
210 $ 1 ),
211 $ lda, a( j, 1 ), lda, one, a( j+1, j ), 1 )
212 CALL dscal( n-j, one / ajj, a( j+1, j ), 1 )
213 END IF
214 20 CONTINUE
215 END IF
216 GO TO 40
217*
218 30 CONTINUE
219 info = j
220*
221 40 CONTINUE
222 RETURN
223*
224* End of DPOTF2
225*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
double precision function ddot(n, dx, incx, dy, incy)
DDOT
Definition ddot.f:82
subroutine dgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
DGEMV
Definition dgemv.f:158
logical function disnan(din)
DISNAN tests input for NaN.
Definition disnan.f:57
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine dscal(n, da, dx, incx)
DSCAL
Definition dscal.f:79
Here is the call graph for this function:
Here is the caller graph for this function: