LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
cpftrf.f
Go to the documentation of this file.
1*> \brief \b CPFTRF
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download CPFTRF + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cpftrf.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cpftrf.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cpftrf.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE CPFTRF( TRANSR, UPLO, N, A, INFO )
20*
21* .. Scalar Arguments ..
22* CHARACTER TRANSR, UPLO
23* INTEGER N, INFO
24* ..
25* .. Array Arguments ..
26* COMPLEX A( 0: * )
27*
28*
29*> \par Purpose:
30* =============
31*>
32*> \verbatim
33*>
34*> CPFTRF computes the Cholesky factorization of a complex Hermitian
35*> positive definite matrix A.
36*>
37*> The factorization has the form
38*> A = U**H * U, if UPLO = 'U', or
39*> A = L * L**H, if UPLO = 'L',
40*> where U is an upper triangular matrix and L is lower triangular.
41*>
42*> This is the block version of the algorithm, calling Level 3 BLAS.
43*> \endverbatim
44*
45* Arguments:
46* ==========
47*
48*> \param[in] TRANSR
49*> \verbatim
50*> TRANSR is CHARACTER*1
51*> = 'N': The Normal TRANSR of RFP A is stored;
52*> = 'C': The Conjugate-transpose TRANSR of RFP A is stored.
53*> \endverbatim
54*>
55*> \param[in] UPLO
56*> \verbatim
57*> UPLO is CHARACTER*1
58*> = 'U': Upper triangle of RFP A is stored;
59*> = 'L': Lower triangle of RFP A is stored.
60*> \endverbatim
61*>
62*> \param[in] N
63*> \verbatim
64*> N is INTEGER
65*> The order of the matrix A. N >= 0.
66*> \endverbatim
67*>
68*> \param[in,out] A
69*> \verbatim
70*> A is COMPLEX array, dimension ( N*(N+1)/2 );
71*> On entry, the Hermitian matrix A in RFP format. RFP format is
72*> described by TRANSR, UPLO, and N as follows: If TRANSR = 'N'
73*> then RFP A is (0:N,0:k-1) when N is even; k=N/2. RFP A is
74*> (0:N-1,0:k) when N is odd; k=N/2. IF TRANSR = 'C' then RFP is
75*> the Conjugate-transpose of RFP A as defined when
76*> TRANSR = 'N'. The contents of RFP A are defined by UPLO as
77*> follows: If UPLO = 'U' the RFP A contains the nt elements of
78*> upper packed A. If UPLO = 'L' the RFP A contains the elements
79*> of lower packed A. The LDA of RFP A is (N+1)/2 when TRANSR =
80*> 'C'. When TRANSR is 'N' the LDA is N+1 when N is even and N
81*> is odd. See the Note below for more details.
82*>
83*> On exit, if INFO = 0, the factor U or L from the Cholesky
84*> factorization RFP A = U**H*U or RFP A = L*L**H.
85*> \endverbatim
86*>
87*> \param[out] INFO
88*> \verbatim
89*> INFO is INTEGER
90*> = 0: successful exit
91*> < 0: if INFO = -i, the i-th argument had an illegal value
92*> > 0: if INFO = i, the leading principal minor of order i
93*> is not positive, and the factorization could not be
94*> completed.
95*>
96*> Further Notes on RFP Format:
97*> ============================
98*>
99*> We first consider Standard Packed Format when N is even.
100*> We give an example where N = 6.
101*>
102*> AP is Upper AP is Lower
103*>
104*> 00 01 02 03 04 05 00
105*> 11 12 13 14 15 10 11
106*> 22 23 24 25 20 21 22
107*> 33 34 35 30 31 32 33
108*> 44 45 40 41 42 43 44
109*> 55 50 51 52 53 54 55
110*>
111*> Let TRANSR = 'N'. RFP holds AP as follows:
112*> For UPLO = 'U' the upper trapezoid A(0:5,0:2) consists of the last
113*> three columns of AP upper. The lower triangle A(4:6,0:2) consists of
114*> conjugate-transpose of the first three columns of AP upper.
115*> For UPLO = 'L' the lower trapezoid A(1:6,0:2) consists of the first
116*> three columns of AP lower. The upper triangle A(0:2,0:2) consists of
117*> conjugate-transpose of the last three columns of AP lower.
118*> To denote conjugate we place -- above the element. This covers the
119*> case N even and TRANSR = 'N'.
120*>
121*> RFP A RFP A
122*>
123*> -- -- --
124*> 03 04 05 33 43 53
125*> -- --
126*> 13 14 15 00 44 54
127*> --
128*> 23 24 25 10 11 55
129*>
130*> 33 34 35 20 21 22
131*> --
132*> 00 44 45 30 31 32
133*> -- --
134*> 01 11 55 40 41 42
135*> -- -- --
136*> 02 12 22 50 51 52
137*>
138*> Now let TRANSR = 'C'. RFP A in both UPLO cases is just the conjugate-
139*> transpose of RFP A above. One therefore gets:
140*>
141*> RFP A RFP A
142*>
143*> -- -- -- -- -- -- -- -- -- --
144*> 03 13 23 33 00 01 02 33 00 10 20 30 40 50
145*> -- -- -- -- -- -- -- -- -- --
146*> 04 14 24 34 44 11 12 43 44 11 21 31 41 51
147*> -- -- -- -- -- -- -- -- -- --
148*> 05 15 25 35 45 55 22 53 54 55 22 32 42 52
149*>
150*> We next consider Standard Packed Format when N is odd.
151*> We give an example where N = 5.
152*>
153*> AP is Upper AP is Lower
154*>
155*> 00 01 02 03 04 00
156*> 11 12 13 14 10 11
157*> 22 23 24 20 21 22
158*> 33 34 30 31 32 33
159*> 44 40 41 42 43 44
160*>
161*> Let TRANSR = 'N'. RFP holds AP as follows:
162*> For UPLO = 'U' the upper trapezoid A(0:4,0:2) consists of the last
163*> three columns of AP upper. The lower triangle A(3:4,0:1) consists of
164*> conjugate-transpose of the first two columns of AP upper.
165*> For UPLO = 'L' the lower trapezoid A(0:4,0:2) consists of the first
166*> three columns of AP lower. The upper triangle A(0:1,1:2) consists of
167*> conjugate-transpose of the last two columns of AP lower.
168*> To denote conjugate we place -- above the element. This covers the
169*> case N odd and TRANSR = 'N'.
170*>
171*> RFP A RFP A
172*>
173*> -- --
174*> 02 03 04 00 33 43
175*> --
176*> 12 13 14 10 11 44
177*>
178*> 22 23 24 20 21 22
179*> --
180*> 00 33 34 30 31 32
181*> -- --
182*> 01 11 44 40 41 42
183*>
184*> Now let TRANSR = 'C'. RFP A in both UPLO cases is just the conjugate-
185*> transpose of RFP A above. One therefore gets:
186*>
187*> RFP A RFP A
188*>
189*> -- -- -- -- -- -- -- -- --
190*> 02 12 22 00 01 00 10 20 30 40 50
191*> -- -- -- -- -- -- -- -- --
192*> 03 13 23 33 11 33 11 21 31 41 51
193*> -- -- -- -- -- -- -- -- --
194*> 04 14 24 34 44 43 44 22 32 42 52
195*> \endverbatim
196*
197* Authors:
198* ========
199*
200*> \author Univ. of Tennessee
201*> \author Univ. of California Berkeley
202*> \author Univ. of Colorado Denver
203*> \author NAG Ltd.
204*
205*> \ingroup pftrf
206*
207* =====================================================================
208 SUBROUTINE cpftrf( TRANSR, UPLO, N, A, INFO )
209*
210* -- LAPACK computational routine --
211* -- LAPACK is a software package provided by Univ. of Tennessee, --
212* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
213*
214* .. Scalar Arguments ..
215 CHARACTER TRANSR, UPLO
216 INTEGER N, INFO
217* ..
218* .. Array Arguments ..
219 COMPLEX A( 0: * )
220*
221* =====================================================================
222*
223* .. Parameters ..
224 REAL ONE
225 COMPLEX CONE
226 parameter( one = 1.0e+0, cone = ( 1.0e+0, 0.0e+0 ) )
227* ..
228* .. Local Scalars ..
229 LOGICAL LOWER, NISODD, NORMALTRANSR
230 INTEGER N1, N2, K
231* ..
232* .. External Functions ..
233 LOGICAL LSAME
234 EXTERNAL lsame
235* ..
236* .. External Subroutines ..
237 EXTERNAL xerbla, cherk, cpotrf, ctrsm
238* ..
239* .. Intrinsic Functions ..
240 INTRINSIC mod
241* ..
242* .. Executable Statements ..
243*
244* Test the input parameters.
245*
246 info = 0
247 normaltransr = lsame( transr, 'N' )
248 lower = lsame( uplo, 'L' )
249 IF( .NOT.normaltransr .AND. .NOT.lsame( transr, 'C' ) ) THEN
250 info = -1
251 ELSE IF( .NOT.lower .AND. .NOT.lsame( uplo, 'U' ) ) THEN
252 info = -2
253 ELSE IF( n.LT.0 ) THEN
254 info = -3
255 END IF
256 IF( info.NE.0 ) THEN
257 CALL xerbla( 'CPFTRF', -info )
258 RETURN
259 END IF
260*
261* Quick return if possible
262*
263 IF( n.EQ.0 )
264 $ RETURN
265*
266* If N is odd, set NISODD = .TRUE.
267* If N is even, set K = N/2 and NISODD = .FALSE.
268*
269 IF( mod( n, 2 ).EQ.0 ) THEN
270 k = n / 2
271 nisodd = .false.
272 ELSE
273 nisodd = .true.
274 END IF
275*
276* Set N1 and N2 depending on LOWER
277*
278 IF( lower ) THEN
279 n2 = n / 2
280 n1 = n - n2
281 ELSE
282 n1 = n / 2
283 n2 = n - n1
284 END IF
285*
286* start execution: there are eight cases
287*
288 IF( nisodd ) THEN
289*
290* N is odd
291*
292 IF( normaltransr ) THEN
293*
294* N is odd and TRANSR = 'N'
295*
296 IF( lower ) THEN
297*
298* SRPA for LOWER, NORMAL and N is odd ( a(0:n-1,0:n1-1) )
299* T1 -> a(0,0), T2 -> a(0,1), S -> a(n1,0)
300* T1 -> a(0), T2 -> a(n), S -> a(n1)
301*
302 CALL cpotrf( 'L', n1, a( 0 ), n, info )
303 IF( info.GT.0 )
304 $ RETURN
305 CALL ctrsm( 'R', 'L', 'C', 'N', n2, n1, cone, a( 0 ),
306 $ n,
307 $ a( n1 ), n )
308 CALL cherk( 'U', 'N', n2, n1, -one, a( n1 ), n, one,
309 $ a( n ), n )
310 CALL cpotrf( 'U', n2, a( n ), n, info )
311 IF( info.GT.0 )
312 $ info = info + n1
313*
314 ELSE
315*
316* SRPA for UPPER, NORMAL and N is odd ( a(0:n-1,0:n2-1)
317* T1 -> a(n1+1,0), T2 -> a(n1,0), S -> a(0,0)
318* T1 -> a(n2), T2 -> a(n1), S -> a(0)
319*
320 CALL cpotrf( 'L', n1, a( n2 ), n, info )
321 IF( info.GT.0 )
322 $ RETURN
323 CALL ctrsm( 'L', 'L', 'N', 'N', n1, n2, cone, a( n2 ),
324 $ n,
325 $ a( 0 ), n )
326 CALL cherk( 'U', 'C', n2, n1, -one, a( 0 ), n, one,
327 $ a( n1 ), n )
328 CALL cpotrf( 'U', n2, a( n1 ), n, info )
329 IF( info.GT.0 )
330 $ info = info + n1
331*
332 END IF
333*
334 ELSE
335*
336* N is odd and TRANSR = 'C'
337*
338 IF( lower ) THEN
339*
340* SRPA for LOWER, TRANSPOSE and N is odd
341* T1 -> A(0,0) , T2 -> A(1,0) , S -> A(0,n1)
342* T1 -> a(0+0) , T2 -> a(1+0) , S -> a(0+n1*n1); lda=n1
343*
344 CALL cpotrf( 'U', n1, a( 0 ), n1, info )
345 IF( info.GT.0 )
346 $ RETURN
347 CALL ctrsm( 'L', 'U', 'C', 'N', n1, n2, cone, a( 0 ),
348 $ n1,
349 $ a( n1*n1 ), n1 )
350 CALL cherk( 'L', 'C', n2, n1, -one, a( n1*n1 ), n1,
351 $ one,
352 $ a( 1 ), n1 )
353 CALL cpotrf( 'L', n2, a( 1 ), n1, info )
354 IF( info.GT.0 )
355 $ info = info + n1
356*
357 ELSE
358*
359* SRPA for UPPER, TRANSPOSE and N is odd
360* T1 -> A(0,n1+1), T2 -> A(0,n1), S -> A(0,0)
361* T1 -> a(n2*n2), T2 -> a(n1*n2), S -> a(0); lda = n2
362*
363 CALL cpotrf( 'U', n1, a( n2*n2 ), n2, info )
364 IF( info.GT.0 )
365 $ RETURN
366 CALL ctrsm( 'R', 'U', 'N', 'N', n2, n1, cone,
367 $ a( n2*n2 ),
368 $ n2, a( 0 ), n2 )
369 CALL cherk( 'L', 'N', n2, n1, -one, a( 0 ), n2, one,
370 $ a( n1*n2 ), n2 )
371 CALL cpotrf( 'L', n2, a( n1*n2 ), n2, info )
372 IF( info.GT.0 )
373 $ info = info + n1
374*
375 END IF
376*
377 END IF
378*
379 ELSE
380*
381* N is even
382*
383 IF( normaltransr ) THEN
384*
385* N is even and TRANSR = 'N'
386*
387 IF( lower ) THEN
388*
389* SRPA for LOWER, NORMAL, and N is even ( a(0:n,0:k-1) )
390* T1 -> a(1,0), T2 -> a(0,0), S -> a(k+1,0)
391* T1 -> a(1), T2 -> a(0), S -> a(k+1)
392*
393 CALL cpotrf( 'L', k, a( 1 ), n+1, info )
394 IF( info.GT.0 )
395 $ RETURN
396 CALL ctrsm( 'R', 'L', 'C', 'N', k, k, cone, a( 1 ),
397 $ n+1,
398 $ a( k+1 ), n+1 )
399 CALL cherk( 'U', 'N', k, k, -one, a( k+1 ), n+1, one,
400 $ a( 0 ), n+1 )
401 CALL cpotrf( 'U', k, a( 0 ), n+1, info )
402 IF( info.GT.0 )
403 $ info = info + k
404*
405 ELSE
406*
407* SRPA for UPPER, NORMAL, and N is even ( a(0:n,0:k-1) )
408* T1 -> a(k+1,0) , T2 -> a(k,0), S -> a(0,0)
409* T1 -> a(k+1), T2 -> a(k), S -> a(0)
410*
411 CALL cpotrf( 'L', k, a( k+1 ), n+1, info )
412 IF( info.GT.0 )
413 $ RETURN
414 CALL ctrsm( 'L', 'L', 'N', 'N', k, k, cone, a( k+1 ),
415 $ n+1, a( 0 ), n+1 )
416 CALL cherk( 'U', 'C', k, k, -one, a( 0 ), n+1, one,
417 $ a( k ), n+1 )
418 CALL cpotrf( 'U', k, a( k ), n+1, info )
419 IF( info.GT.0 )
420 $ info = info + k
421*
422 END IF
423*
424 ELSE
425*
426* N is even and TRANSR = 'C'
427*
428 IF( lower ) THEN
429*
430* SRPA for LOWER, TRANSPOSE and N is even (see paper)
431* T1 -> B(0,1), T2 -> B(0,0), S -> B(0,k+1)
432* T1 -> a(0+k), T2 -> a(0+0), S -> a(0+k*(k+1)); lda=k
433*
434 CALL cpotrf( 'U', k, a( 0+k ), k, info )
435 IF( info.GT.0 )
436 $ RETURN
437 CALL ctrsm( 'L', 'U', 'C', 'N', k, k, cone, a( k ),
438 $ n1,
439 $ a( k*( k+1 ) ), k )
440 CALL cherk( 'L', 'C', k, k, -one, a( k*( k+1 ) ), k,
441 $ one,
442 $ a( 0 ), k )
443 CALL cpotrf( 'L', k, a( 0 ), k, info )
444 IF( info.GT.0 )
445 $ info = info + k
446*
447 ELSE
448*
449* SRPA for UPPER, TRANSPOSE and N is even (see paper)
450* T1 -> B(0,k+1), T2 -> B(0,k), S -> B(0,0)
451* T1 -> a(0+k*(k+1)), T2 -> a(0+k*k), S -> a(0+0)); lda=k
452*
453 CALL cpotrf( 'U', k, a( k*( k+1 ) ), k, info )
454 IF( info.GT.0 )
455 $ RETURN
456 CALL ctrsm( 'R', 'U', 'N', 'N', k, k, cone,
457 $ a( k*( k+1 ) ), k, a( 0 ), k )
458 CALL cherk( 'L', 'N', k, k, -one, a( 0 ), k, one,
459 $ a( k*k ), k )
460 CALL cpotrf( 'L', k, a( k*k ), k, info )
461 IF( info.GT.0 )
462 $ info = info + k
463*
464 END IF
465*
466 END IF
467*
468 END IF
469*
470 RETURN
471*
472* End of CPFTRF
473*
474 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine cherk(uplo, trans, n, k, alpha, a, lda, beta, c, ldc)
CHERK
Definition cherk.f:173
subroutine cpftrf(transr, uplo, n, a, info)
CPFTRF
Definition cpftrf.f:209
subroutine cpotrf(uplo, n, a, lda, info)
CPOTRF
Definition cpotrf.f:105
subroutine ctrsm(side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb)
CTRSM
Definition ctrsm.f:180