1 *> \brief \b CTRTTF copies a triangular matrix from the standard full format (TR) 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 CTRTTF + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ctrttf.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ctrttf.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ctrttf.f">
21 * SUBROUTINE CTRTTF( TRANSR, UPLO, N, A, LDA, ARF, 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 *> CTRTTF copies a triangular matrix A from standard full format (TR)
38 *> to rectangular full packed format (TF) .
46 *> TRANSR is CHARACTER*1
47 *> = 'N': ARF in Normal mode is wanted;
48 *> = 'C': ARF in Conjugate Transpose mode is wanted;
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 *> A is COMPLEX array, dimension ( LDA, N )
67 *> On entry, the triangular matrix A. If UPLO = 'U', the
68 *> leading N-by-N upper triangular part of the array A contains
69 *> the upper triangular matrix, and the strictly lower
70 *> triangular part of A is not referenced. If UPLO = 'L', the
71 *> leading N-by-N lower triangular part of the array A contains
72 *> the lower triangular matrix, and the strictly upper
73 *> triangular part of A is not referenced.
79 *> The leading dimension of the matrix A. LDA >= max(1,N).
84 *> ARF is COMPLEX array, dimension ( N*(N+1)/2 ),
85 *> On exit, the upper or lower triangular matrix A stored in
86 *> RFP format. For a further discussion see Notes below.
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
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 CTRTTF( TRANSR, UPLO, N, A, LDA, ARF, INFO )
219 * -- LAPACK computational routine (version 3.6.1) --
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 I, IJ, J, K, L, N1, N2, NT, NX2, NP1X2
240 * .. External Functions ..
244 * .. External Subroutines ..
247 * .. Intrinsic Functions ..
248 INTRINSIC CONJG, MAX, MOD
250 * .. Executable Statements ..
252 * Test the input parameters.
255 NORMALTRANSR = LSAME( TRANSR, 'N' )
256 LOWER = LSAME( UPLO, 'L' )
257 IF( .NOT.NORMALTRANSR .AND. .NOT.LSAME( TRANSR, 'C' ) ) THEN
259 ELSE IF( .NOT.LOWER .AND. .NOT.LSAME( UPLO, 'U' ) ) THEN
261 ELSE IF( N.LT.0 ) THEN
263 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
267 CALL XERBLA( 'CTRTTF', -INFO )
271 * Quick return if possible
275 IF( NORMALTRANSR ) THEN
278 ARF( 0 ) = CONJG( A( 0, 0 ) )
284 * Size of array ARF(1:2,0:nt-1)
288 * set N1 and N2 depending on LOWER: for N even N1=N2=K
298 * If N is odd, set NISODD = .TRUE., LDA=N+1 and A is (N+1)--by--K2.
299 * If N is even, set K = N/2 and NISODD = .FALSE., LDA=N and A is
302 IF( MOD( N, 2 ).EQ.0 ) THEN
317 IF( NORMALTRANSR ) THEN
319 * N is odd and TRANSR = 'N'
323 * SRPA for LOWER, NORMAL and N is odd ( a(0:n-1,0:n1-1) )
324 * T1 -> a(0,0), T2 -> a(0,1), S -> a(n1,0)
325 * T1 -> a(0), T2 -> a(n), S -> a(n1); lda=n
330 ARF( IJ ) = CONJG( A( N2+J, I ) )
334 ARF( IJ ) = A( I, J )
341 * SRPA for UPPER, NORMAL and N is odd ( a(0:n-1,0:n2-1)
342 * T1 -> a(n1+1,0), T2 -> a(n1,0), S -> a(0,0)
343 * T1 -> a(n2), T2 -> a(n1), S -> a(0); lda=n
348 ARF( IJ ) = A( I, J )
351 DO L = J - N1, N1 - 1
352 ARF( IJ ) = CONJG( A( J-N1, L ) )
362 * N is odd and TRANSR = 'C'
366 * SRPA for LOWER, TRANSPOSE and N is odd
367 * T1 -> A(0,0) , T2 -> A(1,0) , S -> A(0,n1)
368 * T1 -> A(0+0) , T2 -> A(1+0) , S -> A(0+n1*n1); lda=n1
373 ARF( IJ ) = CONJG( A( J, I ) )
377 ARF( IJ ) = A( I, N1+J )
383 ARF( IJ ) = CONJG( A( J, I ) )
390 * SRPA for UPPER, TRANSPOSE and N is odd
391 * T1 -> A(0,n1+1), T2 -> A(0,n1), S -> A(0,0)
392 * T1 -> A(n2*n2), T2 -> A(n1*n2), S -> A(0); lda=n2
397 ARF( IJ ) = CONJG( A( J, I ) )
403 ARF( IJ ) = A( I, J )
407 ARF( IJ ) = CONJG( A( N2+J, L ) )
420 IF( NORMALTRANSR ) THEN
422 * N is even and TRANSR = 'N'
426 * SRPA for LOWER, NORMAL, and N is even ( a(0:n,0:k-1) )
427 * T1 -> a(1,0), T2 -> a(0,0), S -> a(k+1,0)
428 * T1 -> a(1), T2 -> a(0), S -> a(k+1); lda=n+1
433 ARF( IJ ) = CONJG( A( K+J, I ) )
437 ARF( IJ ) = A( I, J )
444 * SRPA for UPPER, NORMAL, and N is even ( a(0:n,0:k-1) )
445 * T1 -> a(k+1,0) , T2 -> a(k,0), S -> a(0,0)
446 * T1 -> a(k+1), T2 -> a(k), S -> a(0); lda=n+1
451 ARF( IJ ) = A( I, J )
455 ARF( IJ ) = CONJG( A( J-K, L ) )
465 * N is even and TRANSR = 'C'
469 * SRPA for LOWER, TRANSPOSE and N is even (see paper, A=B)
470 * T1 -> A(0,1) , T2 -> A(0,0) , S -> A(0,k+1) :
471 * T1 -> A(0+k) , T2 -> A(0+0) , S -> A(0+k*(k+1)); lda=k
476 ARF( IJ ) = A( I, J )
481 ARF( IJ ) = CONJG( A( J, I ) )
484 DO I = K + 1 + J, N - 1
485 ARF( IJ ) = A( I, K+1+J )
491 ARF( IJ ) = CONJG( A( J, I ) )
498 * SRPA for UPPER, TRANSPOSE and N is even (see paper, A=B)
499 * T1 -> A(0,k+1) , T2 -> A(0,k) , S -> A(0,0)
500 * T1 -> A(0+k*(k+1)) , T2 -> A(0+k*k) , S -> A(0+0)); lda=k
505 ARF( IJ ) = CONJG( A( J, I ) )
511 ARF( IJ ) = A( I, J )
514 DO L = K + 1 + J, N - 1
515 ARF( IJ ) = CONJG( A( K+1+J, L ) )
520 * Note that here J = K-1
523 ARF( IJ ) = A( I, J )