1 *> \brief \b CTPTTF copies a triangular matrix from the standard packed format (TP) to the rectangular full packed format (TF).
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download CTPTTF + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ctpttf.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ctpttf.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ctpttf.f">
21 * SUBROUTINE CTPTTF( TRANSR, UPLO, N, AP, ARF, INFO )
23 * .. Scalar Arguments ..
24 * CHARACTER TRANSR, UPLO
27 * .. Array Arguments ..
28 * COMPLEX AP( 0: * ), ARF( 0: * )
36 *> CTPTTF copies a triangular matrix A from standard packed format (TP)
37 *> to rectangular full packed format (TF).
45 *> TRANSR is CHARACTER*1
46 *> = 'N': ARF in Normal format is wanted;
47 *> = 'C': ARF in Conjugate-transpose format is wanted.
52 *> UPLO is CHARACTER*1
53 *> = 'U': A is upper triangular;
54 *> = 'L': A is lower triangular.
60 *> The order of the matrix A. N >= 0.
65 *> AP is COMPLEX array, dimension ( N*(N+1)/2 ),
66 *> On entry, the upper or lower triangular matrix A, packed
67 *> columnwise in a linear array. The j-th column of A is stored
68 *> in the array AP as follows:
69 *> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
70 *> if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
75 *> ARF is COMPLEX array, dimension ( N*(N+1)/2 ),
76 *> On exit, the upper or lower triangular matrix A stored in
77 *> RFP format. For a further discussion see Notes below.
83 *> = 0: successful exit
84 *> < 0: if INFO = -i, the i-th argument had an illegal value
90 *> \author Univ. of Tennessee
91 *> \author Univ. of California Berkeley
92 *> \author Univ. of Colorado Denver
95 *> \date September 2012
97 *> \ingroup complexOTHERcomputational
99 *> \par Further Details:
100 * =====================
104 *> We first consider Standard Packed Format when N is even.
105 *> We give an example where N = 6.
107 *> AP is Upper AP is Lower
109 *> 00 01 02 03 04 05 00
110 *> 11 12 13 14 15 10 11
111 *> 22 23 24 25 20 21 22
112 *> 33 34 35 30 31 32 33
113 *> 44 45 40 41 42 43 44
114 *> 55 50 51 52 53 54 55
117 *> Let TRANSR = 'N'. RFP holds AP as follows:
118 *> For UPLO = 'U' the upper trapezoid A(0:5,0:2) consists of the last
119 *> three columns of AP upper. The lower triangle A(4:6,0:2) consists of
120 *> conjugate-transpose of the first three columns of AP upper.
121 *> For UPLO = 'L' the lower trapezoid A(1:6,0:2) consists of the first
122 *> three columns of AP lower. The upper triangle A(0:2,0:2) consists of
123 *> conjugate-transpose of the last three columns of AP lower.
124 *> To denote conjugate we place -- above the element. This covers the
125 *> case N even and TRANSR = 'N'.
144 *> Now let TRANSR = 'C'. RFP A in both UPLO cases is just the conjugate-
145 *> transpose of RFP A above. One therefore gets:
150 *> -- -- -- -- -- -- -- -- -- --
151 *> 03 13 23 33 00 01 02 33 00 10 20 30 40 50
152 *> -- -- -- -- -- -- -- -- -- --
153 *> 04 14 24 34 44 11 12 43 44 11 21 31 41 51
154 *> -- -- -- -- -- -- -- -- -- --
155 *> 05 15 25 35 45 55 22 53 54 55 22 32 42 52
158 *> We next consider Standard Packed Format when N is odd.
159 *> We give an example where N = 5.
161 *> AP is Upper AP is Lower
170 *> Let TRANSR = 'N'. RFP holds AP as follows:
171 *> For UPLO = 'U' the upper trapezoid A(0:4,0:2) consists of the last
172 *> three columns of AP upper. The lower triangle A(3:4,0:1) consists of
173 *> conjugate-transpose of the first two columns of AP upper.
174 *> For UPLO = 'L' the lower trapezoid A(0:4,0:2) consists of the first
175 *> three columns of AP lower. The upper triangle A(0:1,1:2) consists of
176 *> conjugate-transpose of the last two columns of AP lower.
177 *> To denote conjugate we place -- above the element. This covers the
178 *> case N odd and TRANSR = 'N'.
193 *> Now let TRANSR = 'C'. RFP A in both UPLO cases is just the conjugate-
194 *> transpose of RFP A above. One therefore gets:
199 *> -- -- -- -- -- -- -- -- --
200 *> 02 12 22 00 01 00 10 20 30 40 50
201 *> -- -- -- -- -- -- -- -- --
202 *> 03 13 23 33 11 33 11 21 31 41 51
203 *> -- -- -- -- -- -- -- -- --
204 *> 04 14 24 34 44 43 44 22 32 42 52
207 * =====================================================================
208 SUBROUTINE CTPTTF( TRANSR, UPLO, N, AP, ARF, INFO )
210 * -- LAPACK computational routine (version 3.4.2) --
211 * -- LAPACK is a software package provided by Univ. of Tennessee, --
212 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
215 * .. Scalar Arguments ..
216 CHARACTER TRANSR, UPLO
219 * .. Array Arguments ..
220 COMPLEX AP( 0: * ), ARF( 0: * )
222 * =====================================================================
226 * .. Local Scalars ..
227 LOGICAL LOWER, NISODD, NORMALTRANSR
228 INTEGER N1, N2, K, NT
230 INTEGER IJP, JP, LDA, JS
232 * .. External Functions ..
236 * .. External Subroutines ..
239 * .. Intrinsic Functions ..
242 * .. Executable Statements ..
244 * Test the input parameters.
247 NORMALTRANSR = LSAME( TRANSR, 'N' )
248 LOWER = LSAME( UPLO, 'L' )
249 IF( .NOT.NORMALTRANSR .AND. .NOT.LSAME( TRANSR, 'C' ) ) THEN
251 ELSE IF( .NOT.LOWER .AND. .NOT.LSAME( UPLO, 'U' ) ) THEN
253 ELSE IF( N.LT.0 ) THEN
257 CALL XERBLA( 'CTPTTF', -INFO )
261 * Quick return if possible
267 IF( NORMALTRANSR ) THEN
270 ARF( 0 ) = CONJG( AP( 0 ) )
275 * Size of array ARF(0:NT-1)
279 * Set N1 and N2 depending on LOWER
289 * If N is odd, set NISODD = .TRUE.
290 * If N is even, set K = N/2 and NISODD = .FALSE.
292 * set lda of ARF^C; ARF^C is (0:(N+1)/2-1,0:N-noe)
293 * where noe = 0 if n is even, noe = 1 if n is odd
295 IF( MOD( N, 2 ).EQ.0 ) THEN
304 * ARF^C has lda rows and n+1-noe cols
306 IF( .NOT.NORMALTRANSR )
309 * start execution: there are eight cases
315 IF( NORMALTRANSR ) THEN
317 * N is odd and TRANSR = 'N'
321 * SRPA for LOWER, NORMAL and N is odd ( a(0:n-1,0:n1-1) )
322 * T1 -> a(0,0), T2 -> a(0,1), S -> a(n1,0)
323 * T1 -> a(0), T2 -> a(n), S -> a(n1); lda = n
330 ARF( IJ ) = AP( IJP )
338 ARF( IJ ) = CONJG( AP( IJP ) )
345 * SRPA for UPPER, NORMAL and N is odd ( a(0:n-1,0:n2-1)
346 * T1 -> a(n1+1,0), T2 -> a(n1,0), S -> a(0,0)
347 * T1 -> a(n2), T2 -> a(n1), S -> a(0)
353 ARF( IJ ) = CONJG( AP( IJP ) )
362 ARF( IJ ) = AP( IJP )
372 * N is odd and TRANSR = 'C'
376 * SRPA for LOWER, TRANSPOSE and N is odd
377 * T1 -> A(0,0) , T2 -> A(1,0) , S -> A(0,n1)
378 * T1 -> a(0+0) , T2 -> a(1+0) , S -> a(0+n1*n1); lda=n1
382 DO IJ = I*( LDA+1 ), N*LDA - 1, LDA
383 ARF( IJ ) = CONJG( AP( IJP ) )
389 DO IJ = JS, JS + N2 - J - 1
390 ARF( IJ ) = AP( IJP )
398 * SRPA for UPPER, TRANSPOSE and N is odd
399 * T1 -> A(0,n1+1), T2 -> A(0,n1), S -> A(0,0)
400 * T1 -> a(n2*n2), T2 -> a(n1*n2), S -> a(0); lda = n2
406 ARF( IJ ) = AP( IJP )
412 DO IJ = I, I + ( N1+I )*LDA, LDA
413 ARF( IJ ) = CONJG( AP( IJP ) )
426 IF( NORMALTRANSR ) THEN
428 * N is even and TRANSR = 'N'
432 * SRPA for LOWER, NORMAL, and N is even ( a(0:n,0:k-1) )
433 * T1 -> a(1,0), T2 -> a(0,0), S -> a(k+1,0)
434 * T1 -> a(1), T2 -> a(0), S -> a(k+1)
441 ARF( IJ ) = AP( IJP )
449 ARF( IJ ) = CONJG( AP( IJP ) )
456 * SRPA for UPPER, NORMAL, and N is even ( a(0:n,0:k-1) )
457 * T1 -> a(k+1,0) , T2 -> a(k,0), S -> a(0,0)
458 * T1 -> a(k+1), T2 -> a(k), S -> a(0)
464 ARF( IJ ) = CONJG( AP( IJP ) )
473 ARF( IJ ) = AP( IJP )
483 * N is even and TRANSR = 'C'
487 * SRPA for LOWER, TRANSPOSE and N is even (see paper)
488 * T1 -> B(0,1), T2 -> B(0,0), S -> B(0,k+1)
489 * T1 -> a(0+k), T2 -> a(0+0), S -> a(0+k*(k+1)); lda=k
493 DO IJ = I + ( I+1 )*LDA, ( N+1 )*LDA - 1, LDA
494 ARF( IJ ) = CONJG( AP( IJP ) )
500 DO IJ = JS, JS + K - J - 1
501 ARF( IJ ) = AP( IJP )
509 * SRPA for UPPER, TRANSPOSE and N is even (see paper)
510 * T1 -> B(0,k+1), T2 -> B(0,k), S -> B(0,0)
511 * T1 -> a(0+k*(k+1)), T2 -> a(0+k*k), S -> a(0+0)); lda=k
517 ARF( IJ ) = AP( IJP )
523 DO IJ = I, I + ( K+I )*LDA, LDA
524 ARF( IJ ) = CONJG( AP( IJP ) )