1 *> \brief \b DTRTTF 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 DTRTTF + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dtrttf.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dtrttf.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dtrttf.f">
21 * SUBROUTINE DTRTTF( TRANSR, UPLO, N, A, LDA, ARF, INFO )
23 * .. Scalar Arguments ..
24 * CHARACTER TRANSR, UPLO
25 * INTEGER INFO, N, LDA
27 * .. Array Arguments ..
28 * DOUBLE PRECISION A( 0: LDA-1, 0: * ), ARF( 0: * )
37 *> DTRTTF 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 form is wanted;
48 *> = 'T': ARF in Transpose form is wanted.
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 DOUBLE PRECISION 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 DOUBLE PRECISION array, dimension (NT).
85 *> NT=N*(N+1)/2. On exit, the triangular matrix A in RFP format.
91 *> = 0: successful exit
92 *> < 0: if INFO = -i, the i-th argument had an illegal value
98 *> \author Univ. of Tennessee
99 *> \author Univ. of California Berkeley
100 *> \author Univ. of Colorado Denver
103 *> \date September 2012
105 *> \ingroup doubleOTHERcomputational
107 *> \par Further Details:
108 * =====================
112 *> We first consider Rectangular Full Packed (RFP) Format when N is
113 *> even. We give an example where N = 6.
115 *> AP is Upper AP is Lower
117 *> 00 01 02 03 04 05 00
118 *> 11 12 13 14 15 10 11
119 *> 22 23 24 25 20 21 22
120 *> 33 34 35 30 31 32 33
121 *> 44 45 40 41 42 43 44
122 *> 55 50 51 52 53 54 55
125 *> Let TRANSR = 'N'. RFP holds AP as follows:
126 *> For UPLO = 'U' the upper trapezoid A(0:5,0:2) consists of the last
127 *> three columns of AP upper. The lower triangle A(4:6,0:2) consists of
128 *> the transpose of the first three columns of AP upper.
129 *> For UPLO = 'L' the lower trapezoid A(1:6,0:2) consists of the first
130 *> three columns of AP lower. The upper triangle A(0:2,0:2) consists of
131 *> the transpose of the last three columns of AP lower.
132 *> This covers the case N even and TRANSR = 'N'.
144 *> Now let TRANSR = 'T'. RFP A in both UPLO cases is just the
145 *> transpose of RFP A above. One therefore gets:
150 *> 03 13 23 33 00 01 02 33 00 10 20 30 40 50
151 *> 04 14 24 34 44 11 12 43 44 11 21 31 41 51
152 *> 05 15 25 35 45 55 22 53 54 55 22 32 42 52
155 *> We then consider Rectangular Full Packed (RFP) Format when N is
156 *> odd. We give an example where N = 5.
158 *> AP is Upper AP is Lower
167 *> Let TRANSR = 'N'. RFP holds AP as follows:
168 *> For UPLO = 'U' the upper trapezoid A(0:4,0:2) consists of the last
169 *> three columns of AP upper. The lower triangle A(3:4,0:1) consists of
170 *> the transpose of the first two columns of AP upper.
171 *> For UPLO = 'L' the lower trapezoid A(0:4,0:2) consists of the first
172 *> three columns of AP lower. The upper triangle A(0:1,1:2) consists of
173 *> the transpose of the last two columns of AP lower.
174 *> This covers the case N odd and TRANSR = 'N'.
184 *> Now let TRANSR = 'T'. RFP A in both UPLO cases is just the
185 *> transpose of RFP A above. One therefore gets:
189 *> 02 12 22 00 01 00 10 20 30 40 50
190 *> 03 13 23 33 11 33 11 21 31 41 51
191 *> 04 14 24 34 44 43 44 22 32 42 52
194 * =====================================================================
195 SUBROUTINE DTRTTF( TRANSR, UPLO, N, A, LDA, ARF, INFO )
197 * -- LAPACK computational routine (version 3.4.2) --
198 * -- LAPACK is a software package provided by Univ. of Tennessee, --
199 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
202 * .. Scalar Arguments ..
203 CHARACTER TRANSR, UPLO
206 * .. Array Arguments ..
207 DOUBLE PRECISION A( 0: LDA-1, 0: * ), ARF( 0: * )
210 * =====================================================================
213 * .. Local Scalars ..
214 LOGICAL LOWER, NISODD, NORMALTRANSR
215 INTEGER I, IJ, J, K, L, N1, N2, NT, NX2, NP1X2
217 * .. External Functions ..
221 * .. External Subroutines ..
224 * .. Intrinsic Functions ..
227 * .. Executable Statements ..
229 * Test the input parameters.
232 NORMALTRANSR = LSAME( TRANSR, 'N' )
233 LOWER = LSAME( UPLO, 'L' )
234 IF( .NOT.NORMALTRANSR .AND. .NOT.LSAME( TRANSR, 'T' ) ) THEN
236 ELSE IF( .NOT.LOWER .AND. .NOT.LSAME( UPLO, 'U' ) ) THEN
238 ELSE IF( N.LT.0 ) THEN
240 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
244 CALL XERBLA( 'DTRTTF', -INFO )
248 * Quick return if possible
257 * Size of array ARF(0:nt-1)
261 * Set N1 and N2 depending on LOWER: for N even N1=N2=K
271 * If N is odd, set NISODD = .TRUE., LDA=N+1 and A is (N+1)--by--K2.
272 * If N is even, set K = N/2 and NISODD = .FALSE., LDA=N and A is
275 IF( MOD( N, 2 ).EQ.0 ) THEN
290 IF( NORMALTRANSR ) THEN
292 * N is odd and TRANSR = 'N'
296 * N is odd, TRANSR = 'N', and UPLO = 'L'
301 ARF( IJ ) = A( N2+J, I )
305 ARF( IJ ) = A( I, J )
312 * N is odd, TRANSR = 'N', and UPLO = 'U'
317 ARF( IJ ) = A( I, J )
320 DO L = J - N1, N1 - 1
321 ARF( IJ ) = A( J-N1, L )
331 * N is odd and TRANSR = 'T'
335 * N is odd, TRANSR = 'T', and UPLO = 'L'
340 ARF( IJ ) = A( J, I )
344 ARF( IJ ) = A( I, N1+J )
350 ARF( IJ ) = A( J, I )
357 * N is odd, TRANSR = 'T', and UPLO = 'U'
362 ARF( IJ ) = A( J, I )
368 ARF( IJ ) = A( I, J )
372 ARF( IJ ) = A( N2+J, L )
385 IF( NORMALTRANSR ) THEN
387 * N is even and TRANSR = 'N'
391 * N is even, TRANSR = 'N', and UPLO = 'L'
396 ARF( IJ ) = A( K+J, I )
400 ARF( IJ ) = A( I, J )
407 * N is even, TRANSR = 'N', and UPLO = 'U'
412 ARF( IJ ) = A( I, J )
416 ARF( IJ ) = A( J-K, L )
426 * N is even and TRANSR = 'T'
430 * N is even, TRANSR = 'T', and UPLO = 'L'
435 ARF( IJ ) = A( I, J )
440 ARF( IJ ) = A( J, I )
443 DO I = K + 1 + J, N - 1
444 ARF( IJ ) = A( I, K+1+J )
450 ARF( IJ ) = A( J, I )
457 * N is even, TRANSR = 'T', and UPLO = 'U'
462 ARF( IJ ) = A( J, I )
468 ARF( IJ ) = A( I, J )
471 DO L = K + 1 + J, N - 1
472 ARF( IJ ) = A( K+1+J, L )
476 * Note that here, on exit of the loop, J = K-1
478 ARF( IJ ) = A( I, J )