LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zpotf2.f
Go to the documentation of this file.
1*> \brief \b ZPOTF2 computes the Cholesky factorization of a symmetric/Hermitian positive definite matrix (unblocked algorithm).
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> \htmlonly
9*> Download ZPOTF2 + dependencies
10*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zpotf2.f">
11*> [TGZ]</a>
12*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zpotf2.f">
13*> [ZIP]</a>
14*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zpotf2.f">
15*> [TXT]</a>
16*> \endhtmlonly
17*
18* Definition:
19* ===========
20*
21* SUBROUTINE ZPOTF2( UPLO, N, A, LDA, INFO )
22*
23* .. Scalar Arguments ..
24* CHARACTER UPLO
25* INTEGER INFO, LDA, N
26* ..
27* .. Array Arguments ..
28* COMPLEX*16 A( LDA, * )
29* ..
30*
31*
32*> \par Purpose:
33* =============
34*>
35*> \verbatim
36*>
37*> ZPOTF2 computes the Cholesky factorization of a complex Hermitian
38*> positive definite matrix A.
39*>
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.
44*>
45*> This is the unblocked version of the algorithm, calling Level 2 BLAS.
46*> \endverbatim
47*
48* Arguments:
49* ==========
50*
51*> \param[in] UPLO
52*> \verbatim
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
58*> \endverbatim
59*>
60*> \param[in] N
61*> \verbatim
62*> N is INTEGER
63*> The order of the matrix A. N >= 0.
64*> \endverbatim
65*>
66*> \param[in,out] A
67*> \verbatim
68*> A is COMPLEX*16 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.
76*>
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.
79*> \endverbatim
80*>
81*> \param[in] LDA
82*> \verbatim
83*> LDA is INTEGER
84*> The leading dimension of the array A. LDA >= max(1,N).
85*> \endverbatim
86*>
87*> \param[out] INFO
88*> \verbatim
89*> INFO is INTEGER
90*> = 0: successful exit
91*> < 0: if INFO = -k, the k-th argument had an illegal value
92*> > 0: if INFO = k, the leading principal minor of order k
93*> is not positive, and the factorization could not be
94*> completed.
95*> \endverbatim
96*
97* Authors:
98* ========
99*
100*> \author Univ. of Tennessee
101*> \author Univ. of California Berkeley
102*> \author Univ. of Colorado Denver
103*> \author NAG Ltd.
104*
105*> \ingroup potf2
106*
107* =====================================================================
108 SUBROUTINE zpotf2( UPLO, N, A, LDA, INFO )
109*
110* -- LAPACK computational routine --
111* -- LAPACK is a software package provided by Univ. of Tennessee, --
112* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
113*
114* .. Scalar Arguments ..
115 CHARACTER UPLO
116 INTEGER INFO, LDA, N
117* ..
118* .. Array Arguments ..
119 COMPLEX*16 A( LDA, * )
120* ..
121*
122* =====================================================================
123*
124* .. Parameters ..
125 DOUBLE PRECISION ONE, ZERO
126 parameter( one = 1.0d+0, zero = 0.0d+0 )
127 COMPLEX*16 CONE
128 parameter( cone = ( 1.0d+0, 0.0d+0 ) )
129* ..
130* .. Local Scalars ..
131 LOGICAL UPPER
132 INTEGER J
133 DOUBLE PRECISION AJJ
134* ..
135* .. External Functions ..
136 LOGICAL LSAME, DISNAN
137 COMPLEX*16 ZDOTC
138 EXTERNAL lsame, zdotc, disnan
139* ..
140* .. External Subroutines ..
141 EXTERNAL xerbla, zdscal, zgemv, zlacgv
142* ..
143* .. Intrinsic Functions ..
144 INTRINSIC dble, max, sqrt
145* ..
146* .. Executable Statements ..
147*
148* Test the input parameters.
149*
150 info = 0
151 upper = lsame( uplo, 'U' )
152 IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
153 info = -1
154 ELSE IF( n.LT.0 ) THEN
155 info = -2
156 ELSE IF( lda.LT.max( 1, n ) ) THEN
157 info = -4
158 END IF
159 IF( info.NE.0 ) THEN
160 CALL xerbla( 'ZPOTF2', -info )
161 RETURN
162 END IF
163*
164* Quick return if possible
165*
166 IF( n.EQ.0 )
167 $ RETURN
168*
169 IF( upper ) THEN
170*
171* Compute the Cholesky factorization A = U**H *U.
172*
173 DO 10 j = 1, n
174*
175* Compute U(J,J) and test for non-positive-definiteness.
176*
177 ajj = dble( a( j, j ) ) - dble( zdotc( j-1, a( 1, j ), 1,
178 $ a( 1, j ), 1 ) )
179 IF( ajj.LE.zero.OR.disnan( ajj ) ) THEN
180 a( j, j ) = ajj
181 GO TO 30
182 END IF
183 ajj = sqrt( ajj )
184 a( j, j ) = ajj
185*
186* Compute elements J+1:N of row J.
187*
188 IF( j.LT.n ) THEN
189 CALL zlacgv( j-1, a( 1, j ), 1 )
190 CALL zgemv( 'Transpose', j-1, n-j, -cone, a( 1, j+1 ),
191 $ lda, a( 1, j ), 1, cone, a( j, j+1 ), lda )
192 CALL zlacgv( j-1, a( 1, j ), 1 )
193 CALL zdscal( n-j, one / ajj, a( j, j+1 ), lda )
194 END IF
195 10 CONTINUE
196 ELSE
197*
198* Compute the Cholesky factorization A = L*L**H.
199*
200 DO 20 j = 1, n
201*
202* Compute L(J,J) and test for non-positive-definiteness.
203*
204 ajj = dble( a( j, j ) ) - dble( zdotc( j-1, a( j, 1 ), lda,
205 $ a( j, 1 ), lda ) )
206 IF( ajj.LE.zero.OR.disnan( ajj ) ) THEN
207 a( j, j ) = ajj
208 GO TO 30
209 END IF
210 ajj = sqrt( ajj )
211 a( j, j ) = ajj
212*
213* Compute elements J+1:N of column J.
214*
215 IF( j.LT.n ) THEN
216 CALL zlacgv( j-1, a( j, 1 ), lda )
217 CALL zgemv( 'No transpose', n-j, j-1, -cone, a( j+1, 1 ),
218 $ lda, a( j, 1 ), lda, cone, a( j+1, j ), 1 )
219 CALL zlacgv( j-1, a( j, 1 ), lda )
220 CALL zdscal( n-j, one / ajj, a( j+1, j ), 1 )
221 END IF
222 20 CONTINUE
223 END IF
224 GO TO 40
225*
226 30 CONTINUE
227 info = j
228*
229 40 CONTINUE
230 RETURN
231*
232* End of ZPOTF2
233*
234 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine zgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
ZGEMV
Definition zgemv.f:160
subroutine zlacgv(n, x, incx)
ZLACGV conjugates a complex vector.
Definition zlacgv.f:74
subroutine zpotf2(uplo, n, a, lda, info)
ZPOTF2 computes the Cholesky factorization of a symmetric/Hermitian positive definite matrix (unblock...
Definition zpotf2.f:109
subroutine zdscal(n, da, zx, incx)
ZDSCAL
Definition zdscal.f:78