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