1 *> \brief \b CTFTTR copies a triangular matrix from the rectangular full packed format (TF) to the standard full format (TR).
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download CTFTTR + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ctfttr.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ctfttr.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ctfttr.f">
21 * SUBROUTINE CTFTTR( TRANSR, UPLO, N, ARF, A, LDA, INFO )
23 * .. Scalar Arguments ..
24 * CHARACTER TRANSR, UPLO
25 * INTEGER INFO, N, LDA
27 * .. Array Arguments ..
28 * COMPLEX A( 0: LDA-1, 0: * ), ARF( 0: * )
37 *> CTFTTR copies a triangular matrix A from rectangular full packed
38 *> format (TF) to standard full format (TR).
46 *> TRANSR is CHARACTER*1
47 *> = 'N': ARF is in Normal format;
48 *> = 'C': ARF is in Conjugate-transpose format;
53 *> UPLO is CHARACTER*1
54 *> = 'U': A is upper triangular;
55 *> = 'L': A is lower triangular.
61 *> The order of the matrix A. N >= 0.
66 *> ARF is COMPLEX array, dimension ( N*(N+1)/2 ),
67 *> On entry, the upper or lower triangular matrix A stored in
68 *> RFP format. For a further discussion see Notes below.
73 *> A is COMPLEX array, dimension ( LDA, N )
74 *> On exit, the triangular matrix A. If UPLO = 'U', the
75 *> leading N-by-N upper triangular part of the array A contains
76 *> the upper triangular matrix, and the strictly lower
77 *> triangular part of A is not referenced. If UPLO = 'L', the
78 *> leading N-by-N lower triangular part of the array A contains
79 *> the lower triangular matrix, and the strictly upper
80 *> triangular part of A is not referenced.
86 *> The leading dimension of the array A. LDA >= max(1,N).
92 *> = 0: successful exit
93 *> < 0: if INFO = -i, the i-th argument had an illegal value
99 *> \author Univ. of Tennessee
100 *> \author Univ. of California Berkeley
101 *> \author Univ. of Colorado Denver
104 *> \date September 2012
106 *> \ingroup complexOTHERcomputational
108 *> \par Further Details:
109 * =====================
113 *> We first consider Standard Packed Format when N is even.
114 *> We give an example where N = 6.
116 *> AP is Upper AP is Lower
118 *> 00 01 02 03 04 05 00
119 *> 11 12 13 14 15 10 11
120 *> 22 23 24 25 20 21 22
121 *> 33 34 35 30 31 32 33
122 *> 44 45 40 41 42 43 44
123 *> 55 50 51 52 53 54 55
126 *> Let TRANSR = 'N'. RFP holds AP as follows:
127 *> For UPLO = 'U' the upper trapezoid A(0:5,0:2) consists of the last
128 *> three columns of AP upper. The lower triangle A(4:6,0:2) consists of
129 *> conjugate-transpose of the first three columns of AP upper.
130 *> For UPLO = 'L' the lower trapezoid A(1:6,0:2) consists of the first
131 *> three columns of AP lower. The upper triangle A(0:2,0:2) consists of
132 *> conjugate-transpose of the last three columns of AP lower.
133 *> To denote conjugate we place -- above the element. This covers the
134 *> case N even and TRANSR = 'N'.
153 *> Now let TRANSR = 'C'. RFP A in both UPLO cases is just the conjugate-
154 *> transpose of RFP A above. One therefore gets:
159 *> -- -- -- -- -- -- -- -- -- --
160 *> 03 13 23 33 00 01 02 33 00 10 20 30 40 50
161 *> -- -- -- -- -- -- -- -- -- --
162 *> 04 14 24 34 44 11 12 43 44 11 21 31 41 51
163 *> -- -- -- -- -- -- -- -- -- --
164 *> 05 15 25 35 45 55 22 53 54 55 22 32 42 52
167 *> We next consider Standard Packed Format when N is odd.
168 *> We give an example where N = 5.
170 *> AP is Upper AP is Lower
179 *> Let TRANSR = 'N'. RFP holds AP as follows:
180 *> For UPLO = 'U' the upper trapezoid A(0:4,0:2) consists of the last
181 *> three columns of AP upper. The lower triangle A(3:4,0:1) consists of
182 *> conjugate-transpose of the first two columns of AP upper.
183 *> For UPLO = 'L' the lower trapezoid A(0:4,0:2) consists of the first
184 *> three columns of AP lower. The upper triangle A(0:1,1:2) consists of
185 *> conjugate-transpose of the last two columns of AP lower.
186 *> To denote conjugate we place -- above the element. This covers the
187 *> case N odd and TRANSR = 'N'.
202 *> Now let TRANSR = 'C'. RFP A in both UPLO cases is just the conjugate-
203 *> transpose of RFP A above. One therefore gets:
208 *> -- -- -- -- -- -- -- -- --
209 *> 02 12 22 00 01 00 10 20 30 40 50
210 *> -- -- -- -- -- -- -- -- --
211 *> 03 13 23 33 11 33 11 21 31 41 51
212 *> -- -- -- -- -- -- -- -- --
213 *> 04 14 24 34 44 43 44 22 32 42 52
216 * =====================================================================
217 SUBROUTINE CTFTTR( TRANSR, UPLO, N, ARF, A, LDA, INFO )
219 * -- LAPACK computational routine (version 3.4.2) --
220 * -- LAPACK is a software package provided by Univ. of Tennessee, --
221 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
224 * .. Scalar Arguments ..
225 CHARACTER TRANSR, UPLO
228 * .. Array Arguments ..
229 COMPLEX A( 0: LDA-1, 0: * ), ARF( 0: * )
232 * =====================================================================
236 * .. Local Scalars ..
237 LOGICAL LOWER, NISODD, NORMALTRANSR
238 INTEGER N1, N2, K, NT, NX2, NP1X2
241 * .. External Functions ..
245 * .. External Subroutines ..
248 * .. Intrinsic Functions ..
249 INTRINSIC CONJG, MAX, MOD
251 * .. Executable Statements ..
253 * Test the input parameters.
256 NORMALTRANSR = LSAME( TRANSR, 'N' )
257 LOWER = LSAME( UPLO, 'L' )
258 IF( .NOT.NORMALTRANSR .AND. .NOT.LSAME( TRANSR, 'C' ) ) THEN
260 ELSE IF( .NOT.LOWER .AND. .NOT.LSAME( UPLO, 'U' ) ) THEN
262 ELSE IF( N.LT.0 ) THEN
264 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
268 CALL XERBLA( 'CTFTTR', -INFO )
272 * Quick return if possible
276 IF( NORMALTRANSR ) THEN
279 A( 0, 0 ) = CONJG( ARF( 0 ) )
285 * Size of array ARF(1:2,0:nt-1)
289 * set N1 and N2 depending on LOWER: for N even N1=N2=K
299 * If N is odd, set NISODD = .TRUE., LDA=N+1 and A is (N+1)--by--K2.
300 * If N is even, set K = N/2 and NISODD = .FALSE., LDA=N and A is
303 IF( MOD( N, 2 ).EQ.0 ) THEN
318 IF( NORMALTRANSR ) THEN
320 * N is odd and TRANSR = 'N'
324 * SRPA for LOWER, NORMAL and N is odd ( a(0:n-1,0:n1-1) )
325 * T1 -> a(0,0), T2 -> a(0,1), S -> a(n1,0)
326 * T1 -> a(0), T2 -> a(n), S -> a(n1); lda=n
331 A( N2+J, I ) = CONJG( ARF( IJ ) )
335 A( I, J ) = ARF( IJ )
342 * SRPA for UPPER, NORMAL and N is odd ( a(0:n-1,0:n2-1)
343 * T1 -> a(n1+1,0), T2 -> a(n1,0), S -> a(0,0)
344 * T1 -> a(n2), T2 -> a(n1), S -> a(0); lda=n
349 A( I, J ) = ARF( IJ )
352 DO L = J - N1, N1 - 1
353 A( J-N1, L ) = CONJG( ARF( IJ ) )
363 * N is odd and TRANSR = 'C'
367 * SRPA for LOWER, TRANSPOSE and N is odd
368 * T1 -> A(0,0) , T2 -> A(1,0) , S -> A(0,n1)
369 * T1 -> A(0+0) , T2 -> A(1+0) , S -> A(0+n1*n1); lda=n1
374 A( J, I ) = CONJG( ARF( IJ ) )
378 A( I, N1+J ) = ARF( IJ )
384 A( J, I ) = CONJG( ARF( IJ ) )
391 * SRPA for UPPER, TRANSPOSE and N is odd
392 * T1 -> A(0,n1+1), T2 -> A(0,n1), S -> A(0,0)
393 * T1 -> A(n2*n2), T2 -> A(n1*n2), S -> A(0); lda = n2
398 A( J, I ) = CONJG( ARF( IJ ) )
404 A( I, J ) = ARF( IJ )
408 A( N2+J, L ) = CONJG( ARF( IJ ) )
421 IF( NORMALTRANSR ) THEN
423 * N is even and TRANSR = 'N'
427 * SRPA for LOWER, NORMAL, and N is even ( a(0:n,0:k-1) )
428 * T1 -> a(1,0), T2 -> a(0,0), S -> a(k+1,0)
429 * T1 -> a(1), T2 -> a(0), S -> a(k+1); lda=n+1
434 A( K+J, I ) = CONJG( ARF( IJ ) )
438 A( I, J ) = ARF( IJ )
445 * SRPA for UPPER, NORMAL, and N is even ( a(0:n,0:k-1) )
446 * T1 -> a(k+1,0) , T2 -> a(k,0), S -> a(0,0)
447 * T1 -> a(k+1), T2 -> a(k), S -> a(0); lda=n+1
452 A( I, J ) = ARF( IJ )
456 A( J-K, L ) = CONJG( ARF( IJ ) )
466 * N is even and TRANSR = 'C'
470 * SRPA for LOWER, TRANSPOSE and N is even (see paper, A=B)
471 * T1 -> A(0,1) , T2 -> A(0,0) , S -> A(0,k+1) :
472 * T1 -> A(0+k) , T2 -> A(0+0) , S -> A(0+k*(k+1)); lda=k
477 A( I, J ) = ARF( IJ )
482 A( J, I ) = CONJG( ARF( IJ ) )
485 DO I = K + 1 + J, N - 1
486 A( I, K+1+J ) = ARF( IJ )
492 A( J, I ) = CONJG( ARF( IJ ) )
499 * SRPA for UPPER, TRANSPOSE and N is even (see paper, A=B)
500 * T1 -> A(0,k+1) , T2 -> A(0,k) , S -> A(0,0)
501 * T1 -> A(0+k*(k+1)) , T2 -> A(0+k*k) , S -> A(0+0)); lda=k
506 A( J, I ) = CONJG( ARF( IJ ) )
512 A( I, J ) = ARF( IJ )
515 DO L = K + 1 + J, N - 1
516 A( K+1+J, L ) = CONJG( ARF( IJ ) )
521 * Note that here J = K-1
524 A( I, J ) = ARF( IJ )