1 *> \brief \b CPOTF2 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 CPOTF2 + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cpotf2.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cpotf2.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cpotf2.f">
21 * SUBROUTINE CPOTF2( UPLO, N, A, LDA, INFO )
23 * .. Scalar Arguments ..
25 * INTEGER INFO, LDA, N
27 * .. Array Arguments ..
37 *> CPOTF2 computes the Cholesky factorization of a complex Hermitian
38 *> positive definite matrix A.
40 *> The factorization has the form
41 *> A = U**H * U , if UPLO = 'U', or
42 *> A = L * L**H, 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 *> Hermitian matrix A is stored.
56 *> = 'U': Upper triangular
57 *> = 'L': Lower triangular
63 *> The order of the matrix A. N >= 0.
68 *> A is COMPLEX array, dimension (LDA,N)
69 *> On entry, the Hermitian 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**H *U or A = L*L**H.
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 complexPOcomputational
109 * =====================================================================
110 SUBROUTINE CPOTF2( 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 ..
125 * =====================================================================
129 PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
131 PARAMETER ( CONE = ( 1.0E+0, 0.0E+0 ) )
133 * .. Local Scalars ..
138 * .. External Functions ..
139 LOGICAL LSAME, SISNAN
141 EXTERNAL LSAME, CDOTC, SISNAN
143 * .. External Subroutines ..
144 EXTERNAL CGEMV, CLACGV, CSSCAL, XERBLA
146 * .. Intrinsic Functions ..
147 INTRINSIC MAX, REAL, SQRT
149 * .. Executable Statements ..
151 * Test the input parameters.
154 UPPER = LSAME( UPLO, 'U' )
155 IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
157 ELSE IF( N.LT.0 ) THEN
159 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
163 CALL XERBLA( 'CPOTF2', -INFO )
167 * Quick return if possible
174 * Compute the Cholesky factorization A = U**H *U.
178 * Compute U(J,J) and test for non-positive-definiteness.
180 AJJ = REAL( A( J, J ) ) - CDOTC( J-1, A( 1, J ), 1,
182 IF( AJJ.LE.ZERO.OR.SISNAN( AJJ ) ) THEN
189 * Compute elements J+1:N of row J.
192 CALL CLACGV( J-1, A( 1, J ), 1 )
193 CALL CGEMV( 'Transpose', J-1, N-J, -CONE, A( 1, J+1 ),
194 $ LDA, A( 1, J ), 1, CONE, A( J, J+1 ), LDA )
195 CALL CLACGV( J-1, A( 1, J ), 1 )
196 CALL CSSCAL( N-J, ONE / AJJ, A( J, J+1 ), LDA )
201 * Compute the Cholesky factorization A = L*L**H.
205 * Compute L(J,J) and test for non-positive-definiteness.
207 AJJ = REAL( A( J, J ) ) - CDOTC( J-1, A( J, 1 ), LDA,
209 IF( AJJ.LE.ZERO.OR.SISNAN( AJJ ) ) THEN
216 * Compute elements J+1:N of column J.
219 CALL CLACGV( J-1, A( J, 1 ), LDA )
220 CALL CGEMV( 'No transpose', N-J, J-1, -CONE, A( J+1, 1 ),
221 $ LDA, A( J, 1 ), LDA, CONE, A( J+1, J ), 1 )
222 CALL CLACGV( J-1, A( J, 1 ), LDA )
223 CALL CSSCAL( N-J, ONE / AJJ, A( J+1, J ), 1 )