LAPACK  3.6.1 LAPACK: Linear Algebra PACKage
cpotrf.f
Go to the documentation of this file.
1 C> \brief \b CPOTRF VARIANT: top-looking block version of the algorithm, calling Level 3 BLAS.
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 * Definition:
9 * ===========
10 *
11 * SUBROUTINE CPOTRF ( UPLO, N, A, LDA, INFO )
12 *
13 * .. Scalar Arguments ..
14 * CHARACTER UPLO
15 * INTEGER INFO, LDA, N
16 * ..
17 * .. Array Arguments ..
18 * COMPLEX A( LDA, * )
19 * ..
20 *
21 * Purpose
22 * =======
23 *
24 C>\details \b Purpose:
25 C>\verbatim
26 C>
27 C> CPOTRF computes the Cholesky factorization of a real symmetric
28 C> positive definite matrix A.
29 C>
30 C> The factorization has the form
31 C> A = U**H * U, if UPLO = 'U', or
32 C> A = L * L**H, if UPLO = 'L',
33 C> where U is an upper triangular matrix and L is lower triangular.
34 C>
35 C> This is the top-looking block version of the algorithm, calling Level 3 BLAS.
36 C>
37 C>\endverbatim
38 *
39 * Arguments:
40 * ==========
41 *
42 C> \param[in] UPLO
43 C> \verbatim
44 C> UPLO is CHARACTER*1
45 C> = 'U': Upper triangle of A is stored;
46 C> = 'L': Lower triangle of A is stored.
47 C> \endverbatim
48 C>
49 C> \param[in] N
50 C> \verbatim
51 C> N is INTEGER
52 C> The order of the matrix A. N >= 0.
53 C> \endverbatim
54 C>
55 C> \param[in,out] A
56 C> \verbatim
57 C> A is COMPLEX array, dimension (LDA,N)
58 C> On entry, the symmetric matrix A. If UPLO = 'U', the leading
59 C> N-by-N upper triangular part of A contains the upper
60 C> triangular part of the matrix A, and the strictly lower
61 C> triangular part of A is not referenced. If UPLO = 'L', the
62 C> leading N-by-N lower triangular part of A contains the lower
63 C> triangular part of the matrix A, and the strictly upper
64 C> triangular part of A is not referenced.
65 C> \endverbatim
66 C> \verbatim
67 C> On exit, if INFO = 0, the factor U or L from the Cholesky
68 C> factorization A = U**H*U or A = L*L**H.
69 C> \endverbatim
70 C>
71 C> \param[in] LDA
72 C> \verbatim
73 C> LDA is INTEGER
74 C> The leading dimension of the array A. LDA >= max(1,N).
75 C> \endverbatim
76 C>
77 C> \param[out] INFO
78 C> \verbatim
79 C> INFO is INTEGER
80 C> = 0: successful exit
81 C> < 0: if INFO = -i, the i-th argument had an illegal value
82 C> > 0: if INFO = i, the leading minor of order i is not
83 C> positive definite, and the factorization could not be
84 C> completed.
85 C> \endverbatim
86 C>
87 *
88 * Authors:
89 * ========
90 *
91 C> \author Univ. of Tennessee
92 C> \author Univ. of California Berkeley
93 C> \author Univ. of Colorado Denver
94 C> \author NAG Ltd.
95 *
96 C> \date November 2011
97 *
98 C> \ingroup variantsPOcomputational
99 *
100 * =====================================================================
101  SUBROUTINE cpotrf ( UPLO, N, A, LDA, INFO )
102 *
103 * -- LAPACK computational routine (version 3.1) --
104 * -- LAPACK is a software package provided by Univ. of Tennessee, --
105 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
106 * November 2011
107 *
108 * .. Scalar Arguments ..
109  CHARACTER UPLO
110  INTEGER INFO, LDA, N
111 * ..
112 * .. Array Arguments ..
113  COMPLEX A( lda, * )
114 * ..
115 *
116 * =====================================================================
117 *
118 * .. Parameters ..
119  REAL ONE
120  COMPLEX CONE
121  parameter ( one = 1.0e+0, cone = ( 1.0e+0, 0.0e+0 ) )
122 * ..
123 * .. Local Scalars ..
124  LOGICAL UPPER
125  INTEGER J, JB, NB
126 * ..
127 * .. External Functions ..
128  LOGICAL LSAME
129  INTEGER ILAENV
130  EXTERNAL lsame, ilaenv
131 * ..
132 * .. External Subroutines ..
133  EXTERNAL cgemm, cpotf2, cherk, ctrsm, xerbla
134 * ..
135 * .. Intrinsic Functions ..
136  INTRINSIC max, min
137 * ..
138 * .. Executable Statements ..
139 *
140 * Test the input parameters.
141 *
142  info = 0
143  upper = lsame( uplo, 'U' )
144  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
145  info = -1
146  ELSE IF( n.LT.0 ) THEN
147  info = -2
148  ELSE IF( lda.LT.max( 1, n ) ) THEN
149  info = -4
150  END IF
151  IF( info.NE.0 ) THEN
152  CALL xerbla( 'CPOTRF', -info )
153  RETURN
154  END IF
155 *
156 * Quick return if possible
157 *
158  IF( n.EQ.0 )
159  \$ RETURN
160 *
161 * Determine the block size for this environment.
162 *
163  nb = ilaenv( 1, 'CPOTRF', uplo, n, -1, -1, -1 )
164  IF( nb.LE.1 .OR. nb.GE.n ) THEN
165 *
166 * Use unblocked code.
167 *
168  CALL cpotf2( uplo, n, a, lda, info )
169  ELSE
170 *
171 * Use blocked code.
172 *
173  IF( upper ) THEN
174 *
175 * Compute the Cholesky factorization A = U'*U.
176 *
177  DO 10 j = 1, n, nb
178
179  jb = min( nb, n-j+1 )
180 *
181 * Compute the current block.
182 *
183  CALL ctrsm( 'Left', 'Upper', 'Conjugate Transpose',
184  \$ 'Non-unit', j-1, jb, cone, a( 1, 1 ), lda,
185  \$ a( 1, j ), lda )
186
187  CALL cherk( 'Upper', 'Conjugate Transpose', jb, j-1,
188  \$ -one, a( 1, j ), lda, one, a( j, j ), lda )
189 *
190 * Update and factorize the current diagonal block and test
191 * for non-positive-definiteness.
192 *
193  CALL cpotf2( 'Upper', jb, a( j, j ), lda, info )
194  IF( info.NE.0 )
195  \$ GO TO 30
196
197  10 CONTINUE
198 *
199  ELSE
200 *
201 * Compute the Cholesky factorization A = L*L'.
202 *
203  DO 20 j = 1, n, nb
204
205  jb = min( nb, n-j+1 )
206 *
207 * Compute the current block.
208 *
209  CALL ctrsm( 'Right', 'Lower', 'Conjugate Transpose',
210  \$ 'Non-unit', jb, j-1, cone, a( 1, 1 ), lda,
211  \$ a( j, 1 ), lda )
212
213  CALL cherk( 'Lower', 'No Transpose', jb, j-1,
214  \$ -one, a( j, 1 ), lda,
215  \$ one, a( j, j ), lda )
216 *
217 * Update and factorize the current diagonal block and test
218 * for non-positive-definiteness.
219 *
220  CALL cpotf2( 'Lower', jb, a( j, j ), lda, info )
221  IF( info.NE.0 )
222  \$ GO TO 30
223
224  20 CONTINUE
225  END IF
226  END IF
227  GO TO 40
228 *
229  30 CONTINUE
230  info = info + j - 1
231 *
232  40 CONTINUE
233  RETURN
234 *
235 * End of CPOTRF
236 *
237  END
subroutine cherk(UPLO, TRANS, N, K, ALPHA, A, LDA, BETA, C, LDC)
CHERK
Definition: cherk.f:175
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine ctrsm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
CTRSM
Definition: ctrsm.f:182
subroutine cpotrf(UPLO, N, A, LDA, INFO)
CPOTRF
Definition: cpotrf.f:109
subroutine cpotf2(UPLO, N, A, LDA, INFO)
CPOTF2 computes the Cholesky factorization of a symmetric/Hermitian positive definite matrix (unblock...
Definition: cpotf2.f:111
subroutine cgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
CGEMM
Definition: cgemm.f:189