3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download ZPFTRI + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zpftri.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zpftri.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zpftri.f">
21 * SUBROUTINE ZPFTRI( TRANSR, UPLO, N, A, INFO )
23 * .. Scalar Arguments ..
24 * CHARACTER TRANSR, UPLO
26 * .. Array Arguments ..
27 * COMPLEX*16 A( 0: * )
36 *> ZPFTRI computes the inverse of a complex Hermitian positive definite
37 *> matrix A using the Cholesky factorization A = U**H*U or A = L*L**H
38 *> computed by ZPFTRF.
46 *> TRANSR is CHARACTER*1
47 *> = 'N': The Normal TRANSR of RFP A is stored;
48 *> = 'C': The Conjugate-transpose TRANSR of RFP A is stored.
53 *> UPLO is CHARACTER*1
54 *> = 'U': Upper triangle of A is stored;
55 *> = 'L': Lower triangle of A is stored.
61 *> The order of the matrix A. N >= 0.
66 *> A is COMPLEX*16 array, dimension ( N*(N+1)/2 );
67 *> On entry, the Hermitian matrix A in RFP format. RFP format is
68 *> described by TRANSR, UPLO, and N as follows: If TRANSR = 'N'
69 *> then RFP A is (0:N,0:k-1) when N is even; k=N/2. RFP A is
70 *> (0:N-1,0:k) when N is odd; k=N/2. IF TRANSR = 'C' then RFP is
71 *> the Conjugate-transpose of RFP A as defined when
72 *> TRANSR = 'N'. The contents of RFP A are defined by UPLO as
73 *> follows: If UPLO = 'U' the RFP A contains the nt elements of
74 *> upper packed A. If UPLO = 'L' the RFP A contains the elements
75 *> of lower packed A. The LDA of RFP A is (N+1)/2 when TRANSR =
76 *> 'C'. When TRANSR is 'N' the LDA is N+1 when N is even and N
77 *> is odd. See the Note below for more details.
79 *> On exit, the Hermitian inverse of the original matrix, in the
80 *> same storage format.
86 *> = 0: successful exit
87 *> < 0: if INFO = -i, the i-th argument had an illegal value
88 *> > 0: if INFO = i, the (i,i) element of the factor U or L is
89 *> zero, and the inverse could not be computed.
95 *> \author Univ. of Tennessee
96 *> \author Univ. of California Berkeley
97 *> \author Univ. of Colorado Denver
100 *> \date November 2011
102 *> \ingroup complex16OTHERcomputational
104 *> \par Further Details:
105 * =====================
109 *> We first consider Standard Packed Format when N is even.
110 *> We give an example where N = 6.
112 *> AP is Upper AP is Lower
114 *> 00 01 02 03 04 05 00
115 *> 11 12 13 14 15 10 11
116 *> 22 23 24 25 20 21 22
117 *> 33 34 35 30 31 32 33
118 *> 44 45 40 41 42 43 44
119 *> 55 50 51 52 53 54 55
122 *> Let TRANSR = 'N'. RFP holds AP as follows:
123 *> For UPLO = 'U' the upper trapezoid A(0:5,0:2) consists of the last
124 *> three columns of AP upper. The lower triangle A(4:6,0:2) consists of
125 *> conjugate-transpose of the first three columns of AP upper.
126 *> For UPLO = 'L' the lower trapezoid A(1:6,0:2) consists of the first
127 *> three columns of AP lower. The upper triangle A(0:2,0:2) consists of
128 *> conjugate-transpose of the last three columns of AP lower.
129 *> To denote conjugate we place -- above the element. This covers the
130 *> case N even and TRANSR = 'N'.
149 *> Now let TRANSR = 'C'. RFP A in both UPLO cases is just the conjugate-
150 *> transpose of RFP A above. One therefore gets:
155 *> -- -- -- -- -- -- -- -- -- --
156 *> 03 13 23 33 00 01 02 33 00 10 20 30 40 50
157 *> -- -- -- -- -- -- -- -- -- --
158 *> 04 14 24 34 44 11 12 43 44 11 21 31 41 51
159 *> -- -- -- -- -- -- -- -- -- --
160 *> 05 15 25 35 45 55 22 53 54 55 22 32 42 52
163 *> We next consider Standard Packed Format when N is odd.
164 *> We give an example where N = 5.
166 *> AP is Upper AP is Lower
175 *> Let TRANSR = 'N'. RFP holds AP as follows:
176 *> For UPLO = 'U' the upper trapezoid A(0:4,0:2) consists of the last
177 *> three columns of AP upper. The lower triangle A(3:4,0:1) consists of
178 *> conjugate-transpose of the first two columns of AP upper.
179 *> For UPLO = 'L' the lower trapezoid A(0:4,0:2) consists of the first
180 *> three columns of AP lower. The upper triangle A(0:1,1:2) consists of
181 *> conjugate-transpose of the last two columns of AP lower.
182 *> To denote conjugate we place -- above the element. This covers the
183 *> case N odd and TRANSR = 'N'.
198 *> Now let TRANSR = 'C'. RFP A in both UPLO cases is just the conjugate-
199 *> transpose of RFP A above. One therefore gets:
204 *> -- -- -- -- -- -- -- -- --
205 *> 02 12 22 00 01 00 10 20 30 40 50
206 *> -- -- -- -- -- -- -- -- --
207 *> 03 13 23 33 11 33 11 21 31 41 51
208 *> -- -- -- -- -- -- -- -- --
209 *> 04 14 24 34 44 43 44 22 32 42 52
212 * =====================================================================
213 SUBROUTINE ZPFTRI( TRANSR, UPLO, N, A, INFO )
215 * -- LAPACK computational routine (version 3.4.0) --
216 * -- LAPACK is a software package provided by Univ. of Tennessee, --
217 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
220 * .. Scalar Arguments ..
221 CHARACTER TRANSR, UPLO
223 * .. Array Arguments ..
227 * =====================================================================
232 PARAMETER ( ONE = 1.D0, CONE = ( 1.D0, 0.D0 ) )
234 * .. Local Scalars ..
235 LOGICAL LOWER, NISODD, NORMALTRANSR
238 * .. External Functions ..
242 * .. External Subroutines ..
243 EXTERNAL XERBLA, ZTFTRI, ZLAUUM, ZTRMM, ZHERK
245 * .. Intrinsic Functions ..
248 * .. Executable Statements ..
250 * Test the input parameters.
253 NORMALTRANSR = LSAME( TRANSR, 'N' )
254 LOWER = LSAME( UPLO, 'L' )
255 IF( .NOT.NORMALTRANSR .AND. .NOT.LSAME( TRANSR, 'C' ) ) THEN
257 ELSE IF( .NOT.LOWER .AND. .NOT.LSAME( UPLO, 'U' ) ) THEN
259 ELSE IF( N.LT.0 ) THEN
263 CALL XERBLA( 'ZPFTRI', -INFO )
267 * Quick return if possible
272 * Invert the triangular Cholesky factor U or L.
274 CALL ZTFTRI( TRANSR, UPLO, 'N', N, A, INFO )
278 * If N is odd, set NISODD = .TRUE.
279 * If N is even, set K = N/2 and NISODD = .FALSE.
281 IF( MOD( N, 2 ).EQ.0 ) THEN
288 * Set N1 and N2 depending on LOWER
298 * Start execution of triangular matrix multiply: inv(U)*inv(U)^C or
299 * inv(L)^C*inv(L). There are eight cases.
305 IF( NORMALTRANSR ) THEN
307 * N is odd and TRANSR = 'N'
311 * SRPA for LOWER, NORMAL and N is odd ( a(0:n-1,0:N1-1) )
312 * T1 -> a(0,0), T2 -> a(0,1), S -> a(N1,0)
313 * T1 -> a(0), T2 -> a(n), S -> a(N1)
315 CALL ZLAUUM( 'L', N1, A( 0 ), N, INFO )
316 CALL ZHERK( 'L', 'C', N1, N2, ONE, A( N1 ), N, ONE,
318 CALL ZTRMM( 'L', 'U', 'N', 'N', N2, N1, CONE, A( N ), N,
320 CALL ZLAUUM( 'U', N2, A( N ), N, INFO )
324 * SRPA for UPPER, NORMAL and N is odd ( a(0:n-1,0:N2-1)
325 * T1 -> a(N1+1,0), T2 -> a(N1,0), S -> a(0,0)
326 * T1 -> a(N2), T2 -> a(N1), S -> a(0)
328 CALL ZLAUUM( 'L', N1, A( N2 ), N, INFO )
329 CALL ZHERK( 'L', 'N', N1, N2, ONE, A( 0 ), N, ONE,
331 CALL ZTRMM( 'R', 'U', 'C', 'N', N1, N2, CONE, A( N1 ), N,
333 CALL ZLAUUM( '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), T2 -> a(1), S -> a(0+N1*N1)
346 CALL ZLAUUM( 'U', N1, A( 0 ), N1, INFO )
347 CALL ZHERK( 'U', 'N', N1, N2, ONE, A( N1*N1 ), N1, ONE,
349 CALL ZTRMM( 'R', 'L', 'N', 'N', N1, N2, CONE, A( 1 ), N1,
351 CALL ZLAUUM( 'L', N2, A( 1 ), N1, INFO )
355 * SRPA for UPPER, TRANSPOSE, and N is odd
356 * T1 -> a(0+N2*N2), T2 -> a(0+N1*N2), S -> a(0)
358 CALL ZLAUUM( 'U', N1, A( N2*N2 ), N2, INFO )
359 CALL ZHERK( 'U', 'C', N1, N2, ONE, A( 0 ), N2, ONE,
361 CALL ZTRMM( 'L', 'L', 'C', 'N', N2, N1, CONE, A( N1*N2 ),
363 CALL ZLAUUM( 'L', N2, A( N1*N2 ), N2, INFO )
373 IF( NORMALTRANSR ) THEN
375 * N is even and TRANSR = 'N'
379 * SRPA for LOWER, NORMAL, and N is even ( a(0:n,0:k-1) )
380 * T1 -> a(1,0), T2 -> a(0,0), S -> a(k+1,0)
381 * T1 -> a(1), T2 -> a(0), S -> a(k+1)
383 CALL ZLAUUM( 'L', K, A( 1 ), N+1, INFO )
384 CALL ZHERK( 'L', 'C', K, K, ONE, A( K+1 ), N+1, ONE,
386 CALL ZTRMM( 'L', 'U', 'N', 'N', K, K, CONE, A( 0 ), N+1,
388 CALL ZLAUUM( 'U', K, A( 0 ), N+1, INFO )
392 * SRPA for UPPER, NORMAL, and N is even ( a(0:n,0:k-1) )
393 * T1 -> a(k+1,0) , T2 -> a(k,0), S -> a(0,0)
394 * T1 -> a(k+1), T2 -> a(k), S -> a(0)
396 CALL ZLAUUM( 'L', K, A( K+1 ), N+1, INFO )
397 CALL ZHERK( 'L', 'N', K, K, ONE, A( 0 ), N+1, ONE,
399 CALL ZTRMM( 'R', 'U', 'C', 'N', K, K, CONE, A( K ), N+1,
401 CALL ZLAUUM( 'U', K, A( K ), N+1, INFO )
407 * N is even and TRANSR = 'C'
411 * SRPA for LOWER, TRANSPOSE, and N is even (see paper)
412 * T1 -> B(0,1), T2 -> B(0,0), S -> B(0,k+1),
413 * T1 -> a(0+k), T2 -> a(0+0), S -> a(0+k*(k+1)); lda=k
415 CALL ZLAUUM( 'U', K, A( K ), K, INFO )
416 CALL ZHERK( 'U', 'N', K, K, ONE, A( K*( K+1 ) ), K, ONE,
418 CALL ZTRMM( 'R', 'L', 'N', 'N', K, K, CONE, A( 0 ), K,
419 $ A( K*( K+1 ) ), K )
420 CALL ZLAUUM( 'L', K, A( 0 ), K, INFO )
424 * SRPA for UPPER, TRANSPOSE, and N is even (see paper)
425 * T1 -> B(0,k+1), T2 -> B(0,k), S -> B(0,0),
426 * T1 -> a(0+k*(k+1)), T2 -> a(0+k*k), S -> a(0+0)); lda=k
428 CALL ZLAUUM( 'U', K, A( K*( K+1 ) ), K, INFO )
429 CALL ZHERK( 'U', 'C', K, K, ONE, A( 0 ), K, ONE,
430 $ A( K*( K+1 ) ), K )
431 CALL ZTRMM( 'L', 'L', 'C', 'N', K, K, CONE, A( K*K ), K,
433 CALL ZLAUUM( 'L', K, A( K*K ), K, INFO )