3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download ZPFTRF + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zpftrf.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zpftrf.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zpftrf.f">
21 * SUBROUTINE ZPFTRF( TRANSR, UPLO, N, A, INFO )
23 * .. Scalar Arguments ..
24 * CHARACTER TRANSR, UPLO
27 * .. Array Arguments ..
28 * COMPLEX*16 A( 0: * )
36 *> ZPFTRF computes the Cholesky factorization of a complex Hermitian
37 *> positive definite matrix A.
39 *> The factorization has the form
40 *> A = U**H * U, if UPLO = 'U', or
41 *> A = L * L**H, if UPLO = 'L',
42 *> where U is an upper triangular matrix and L is lower triangular.
44 *> This is the block version of the algorithm, calling Level 3 BLAS.
52 *> TRANSR is CHARACTER*1
53 *> = 'N': The Normal TRANSR of RFP A is stored;
54 *> = 'C': The Conjugate-transpose TRANSR of RFP A is stored.
59 *> UPLO is CHARACTER*1
60 *> = 'U': Upper triangle of RFP A is stored;
61 *> = 'L': Lower triangle of RFP A is stored.
67 *> The order of the matrix A. N >= 0.
72 *> A is COMPLEX*16 array, dimension ( N*(N+1)/2 );
73 *> On entry, the Hermitian matrix A in RFP format. RFP format is
74 *> described by TRANSR, UPLO, and N as follows: If TRANSR = 'N'
75 *> then RFP A is (0:N,0:k-1) when N is even; k=N/2. RFP A is
76 *> (0:N-1,0:k) when N is odd; k=N/2. IF TRANSR = 'C' then RFP is
77 *> the Conjugate-transpose of RFP A as defined when
78 *> TRANSR = 'N'. The contents of RFP A are defined by UPLO as
79 *> follows: If UPLO = 'U' the RFP A contains the nt elements of
80 *> upper packed A. If UPLO = 'L' the RFP A contains the elements
81 *> of lower packed A. The LDA of RFP A is (N+1)/2 when TRANSR =
82 *> 'C'. When TRANSR is 'N' the LDA is N+1 when N is even and N
83 *> is odd. See the Note below for more details.
85 *> On exit, if INFO = 0, the factor U or L from the Cholesky
86 *> factorization RFP A = U**H*U or RFP A = L*L**H.
92 *> = 0: successful exit
93 *> < 0: if INFO = -i, the i-th argument had an illegal value
94 *> > 0: if INFO = i, the leading minor of order i is not
95 *> positive definite, and the factorization could not be
98 *> Further Notes on RFP Format:
99 *> ============================
101 *> We first consider Standard Packed Format when N is even.
102 *> We give an example where N = 6.
104 *> AP is Upper AP is Lower
106 *> 00 01 02 03 04 05 00
107 *> 11 12 13 14 15 10 11
108 *> 22 23 24 25 20 21 22
109 *> 33 34 35 30 31 32 33
110 *> 44 45 40 41 42 43 44
111 *> 55 50 51 52 53 54 55
113 *> Let TRANSR = 'N'. RFP holds AP as follows:
114 *> For UPLO = 'U' the upper trapezoid A(0:5,0:2) consists of the last
115 *> three columns of AP upper. The lower triangle A(4:6,0:2) consists of
116 *> conjugate-transpose of the first three columns of AP upper.
117 *> For UPLO = 'L' the lower trapezoid A(1:6,0:2) consists of the first
118 *> three columns of AP lower. The upper triangle A(0:2,0:2) consists of
119 *> conjugate-transpose of the last three columns of AP lower.
120 *> To denote conjugate we place -- above the element. This covers the
121 *> case N even and TRANSR = 'N'.
140 *> Now let TRANSR = 'C'. RFP A in both UPLO cases is just the conjugate-
141 *> transpose of RFP A above. One therefore gets:
145 *> -- -- -- -- -- -- -- -- -- --
146 *> 03 13 23 33 00 01 02 33 00 10 20 30 40 50
147 *> -- -- -- -- -- -- -- -- -- --
148 *> 04 14 24 34 44 11 12 43 44 11 21 31 41 51
149 *> -- -- -- -- -- -- -- -- -- --
150 *> 05 15 25 35 45 55 22 53 54 55 22 32 42 52
152 *> We next consider Standard Packed Format when N is odd.
153 *> We give an example where N = 5.
155 *> AP is Upper AP is Lower
163 *> Let TRANSR = 'N'. RFP holds AP as follows:
164 *> For UPLO = 'U' the upper trapezoid A(0:4,0:2) consists of the last
165 *> three columns of AP upper. The lower triangle A(3:4,0:1) consists of
166 *> conjugate-transpose of the first two columns of AP upper.
167 *> For UPLO = 'L' the lower trapezoid A(0:4,0:2) consists of the first
168 *> three columns of AP lower. The upper triangle A(0:1,1:2) consists of
169 *> conjugate-transpose of the last two columns of AP lower.
170 *> To denote conjugate we place -- above the element. This covers the
171 *> case N odd and TRANSR = 'N'.
186 *> Now let TRANSR = 'C'. RFP A in both UPLO cases is just the conjugate-
187 *> transpose of RFP A above. One therefore gets:
191 *> -- -- -- -- -- -- -- -- --
192 *> 02 12 22 00 01 00 10 20 30 40 50
193 *> -- -- -- -- -- -- -- -- --
194 *> 03 13 23 33 11 33 11 21 31 41 51
195 *> -- -- -- -- -- -- -- -- --
196 *> 04 14 24 34 44 43 44 22 32 42 52
202 *> \author Univ. of Tennessee
203 *> \author Univ. of California Berkeley
204 *> \author Univ. of Colorado Denver
209 *> \ingroup complex16OTHERcomputational
211 * =====================================================================
212 SUBROUTINE ZPFTRF( TRANSR, UPLO, N, A, INFO )
214 * -- LAPACK computational routine (version 3.6.1) --
215 * -- LAPACK is a software package provided by Univ. of Tennessee, --
216 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
219 * .. Scalar Arguments ..
220 CHARACTER TRANSR, UPLO
223 * .. Array Arguments ..
226 * =====================================================================
231 PARAMETER ( ONE = 1.0D+0, CONE = ( 1.0D+0, 0.0D+0 ) )
233 * .. Local Scalars ..
234 LOGICAL LOWER, NISODD, NORMALTRANSR
237 * .. External Functions ..
241 * .. External Subroutines ..
242 EXTERNAL XERBLA, ZHERK, ZPOTRF, ZTRSM
244 * .. Intrinsic Functions ..
247 * .. Executable Statements ..
249 * Test the input parameters.
252 NORMALTRANSR = LSAME( TRANSR, 'N' )
253 LOWER = LSAME( UPLO, 'L' )
254 IF( .NOT.NORMALTRANSR .AND. .NOT.LSAME( TRANSR, 'C' ) ) THEN
256 ELSE IF( .NOT.LOWER .AND. .NOT.LSAME( UPLO, 'U' ) ) THEN
258 ELSE IF( N.LT.0 ) THEN
262 CALL XERBLA( 'ZPFTRF', -INFO )
266 * Quick return if possible
271 * If N is odd, set NISODD = .TRUE.
272 * If N is even, set K = N/2 and NISODD = .FALSE.
274 IF( MOD( N, 2 ).EQ.0 ) THEN
281 * Set N1 and N2 depending on LOWER
291 * start execution: there are eight cases
297 IF( NORMALTRANSR ) THEN
299 * N is odd and TRANSR = 'N'
303 * SRPA for LOWER, NORMAL and N is odd ( a(0:n-1,0:n1-1) )
304 * T1 -> a(0,0), T2 -> a(0,1), S -> a(n1,0)
305 * T1 -> a(0), T2 -> a(n), S -> a(n1)
307 CALL ZPOTRF( 'L', N1, A( 0 ), N, INFO )
310 CALL ZTRSM( 'R', 'L', 'C', 'N', N2, N1, CONE, A( 0 ), N,
312 CALL ZHERK( 'U', 'N', N2, N1, -ONE, A( N1 ), N, ONE,
314 CALL ZPOTRF( 'U', N2, A( N ), N, INFO )
320 * SRPA for UPPER, NORMAL and N is odd ( a(0:n-1,0:n2-1)
321 * T1 -> a(n1+1,0), T2 -> a(n1,0), S -> a(0,0)
322 * T1 -> a(n2), T2 -> a(n1), S -> a(0)
324 CALL ZPOTRF( 'L', N1, A( N2 ), N, INFO )
327 CALL ZTRSM( 'L', 'L', 'N', 'N', N1, N2, CONE, A( N2 ), N,
329 CALL ZHERK( 'U', 'C', N2, N1, -ONE, A( 0 ), N, ONE,
331 CALL ZPOTRF( 'U', N2, A( N1 ), N, INFO )
339 * N is odd and TRANSR = 'C'
343 * SRPA for LOWER, TRANSPOSE and N is odd
344 * T1 -> A(0,0) , T2 -> A(1,0) , S -> A(0,n1)
345 * T1 -> a(0+0) , T2 -> a(1+0) , S -> a(0+n1*n1); lda=n1
347 CALL ZPOTRF( 'U', N1, A( 0 ), N1, INFO )
350 CALL ZTRSM( 'L', 'U', 'C', 'N', N1, N2, CONE, A( 0 ), N1,
352 CALL ZHERK( 'L', 'C', N2, N1, -ONE, A( N1*N1 ), N1, ONE,
354 CALL ZPOTRF( 'L', N2, A( 1 ), N1, INFO )
360 * SRPA for UPPER, TRANSPOSE and N is odd
361 * T1 -> A(0,n1+1), T2 -> A(0,n1), S -> A(0,0)
362 * T1 -> a(n2*n2), T2 -> a(n1*n2), S -> a(0); lda = n2
364 CALL ZPOTRF( 'U', N1, A( N2*N2 ), N2, INFO )
367 CALL ZTRSM( 'R', 'U', 'N', 'N', N2, N1, CONE, A( N2*N2 ),
369 CALL ZHERK( 'L', 'N', N2, N1, -ONE, A( 0 ), N2, ONE,
371 CALL ZPOTRF( 'L', N2, A( N1*N2 ), N2, INFO )
383 IF( NORMALTRANSR ) THEN
385 * N is even and TRANSR = 'N'
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)
393 CALL ZPOTRF( 'L', K, A( 1 ), N+1, INFO )
396 CALL ZTRSM( 'R', 'L', 'C', 'N', K, K, CONE, A( 1 ), N+1,
398 CALL ZHERK( 'U', 'N', K, K, -ONE, A( K+1 ), N+1, ONE,
400 CALL ZPOTRF( 'U', K, A( 0 ), N+1, INFO )
406 * SRPA for UPPER, NORMAL, and N is even ( a(0:n,0:k-1) )
407 * T1 -> a(k+1,0) , T2 -> a(k,0), S -> a(0,0)
408 * T1 -> a(k+1), T2 -> a(k), S -> a(0)
410 CALL ZPOTRF( 'L', K, A( K+1 ), N+1, INFO )
413 CALL ZTRSM( 'L', 'L', 'N', 'N', K, K, CONE, A( K+1 ),
415 CALL ZHERK( 'U', 'C', K, K, -ONE, A( 0 ), N+1, ONE,
417 CALL ZPOTRF( 'U', K, A( K ), N+1, INFO )
425 * N is even and TRANSR = 'C'
429 * SRPA for LOWER, TRANSPOSE and N is even (see paper)
430 * T1 -> B(0,1), T2 -> B(0,0), S -> B(0,k+1)
431 * T1 -> a(0+k), T2 -> a(0+0), S -> a(0+k*(k+1)); lda=k
433 CALL ZPOTRF( 'U', K, A( 0+K ), K, INFO )
436 CALL ZTRSM( 'L', 'U', 'C', 'N', K, K, CONE, A( K ), N1,
437 $ A( K*( K+1 ) ), K )
438 CALL ZHERK( 'L', 'C', K, K, -ONE, A( K*( K+1 ) ), K, ONE,
440 CALL ZPOTRF( 'L', K, A( 0 ), K, INFO )
446 * SRPA for UPPER, TRANSPOSE and N is even (see paper)
447 * T1 -> B(0,k+1), T2 -> B(0,k), S -> B(0,0)
448 * T1 -> a(0+k*(k+1)), T2 -> a(0+k*k), S -> a(0+0)); lda=k
450 CALL ZPOTRF( 'U', K, A( K*( K+1 ) ), K, INFO )
453 CALL ZTRSM( 'R', 'U', 'N', 'N', K, K, CONE,
454 $ A( K*( K+1 ) ), K, A( 0 ), K )
455 CALL ZHERK( 'L', 'N', K, K, -ONE, A( 0 ), K, ONE,
457 CALL ZPOTRF( 'L', K, A( K*K ), K, INFO )