1 *> \brief \b STPTTF 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 STPTTF + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/stpttf.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/stpttf.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/stpttf.f">
21 * SUBROUTINE STPTTF( TRANSR, UPLO, N, AP, ARF, INFO )
23 * .. Scalar Arguments ..
24 * CHARACTER TRANSR, UPLO
27 * .. Array Arguments ..
28 * REAL AP( 0: * ), ARF( 0: * )
36 *> STPTTF 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 *> = 'T': 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 REAL 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 REAL 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 realOTHERcomputational
99 *> \par Further Details:
100 * =====================
104 *> We first consider Rectangular Full Packed (RFP) Format when N is
105 *> even. 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 *> the 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 *> the transpose of the last three columns of AP lower.
124 *> This covers the case N even and TRANSR = 'N'.
136 *> Now let TRANSR = 'T'. RFP A in both UPLO cases is just the
137 *> transpose of RFP A above. One therefore gets:
142 *> 03 13 23 33 00 01 02 33 00 10 20 30 40 50
143 *> 04 14 24 34 44 11 12 43 44 11 21 31 41 51
144 *> 05 15 25 35 45 55 22 53 54 55 22 32 42 52
147 *> We then consider Rectangular Full Packed (RFP) Format when N is
148 *> odd. We give an example where N = 5.
150 *> AP is Upper AP is Lower
159 *> Let TRANSR = 'N'. RFP holds AP as follows:
160 *> For UPLO = 'U' the upper trapezoid A(0:4,0:2) consists of the last
161 *> three columns of AP upper. The lower triangle A(3:4,0:1) consists of
162 *> the transpose of the first two columns of AP upper.
163 *> For UPLO = 'L' the lower trapezoid A(0:4,0:2) consists of the first
164 *> three columns of AP lower. The upper triangle A(0:1,1:2) consists of
165 *> the transpose of the last two columns of AP lower.
166 *> This covers the case N odd and TRANSR = 'N'.
176 *> Now let TRANSR = 'T'. RFP A in both UPLO cases is just the
177 *> transpose of RFP A above. One therefore gets:
181 *> 02 12 22 00 01 00 10 20 30 40 50
182 *> 03 13 23 33 11 33 11 21 31 41 51
183 *> 04 14 24 34 44 43 44 22 32 42 52
186 * =====================================================================
187 SUBROUTINE STPTTF( TRANSR, UPLO, N, AP, ARF, INFO )
189 * -- LAPACK computational routine (version 3.4.2) --
190 * -- LAPACK is a software package provided by Univ. of Tennessee, --
191 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
194 * .. Scalar Arguments ..
195 CHARACTER TRANSR, UPLO
198 * .. Array Arguments ..
199 REAL AP( 0: * ), ARF( 0: * )
201 * =====================================================================
205 * .. Local Scalars ..
206 LOGICAL LOWER, NISODD, NORMALTRANSR
207 INTEGER N1, N2, K, NT
209 INTEGER IJP, JP, LDA, JS
211 * .. External Functions ..
215 * .. External Subroutines ..
218 * .. Intrinsic Functions ..
221 * .. Executable Statements ..
223 * Test the input parameters.
226 NORMALTRANSR = LSAME( TRANSR, 'N' )
227 LOWER = LSAME( UPLO, 'L' )
228 IF( .NOT.NORMALTRANSR .AND. .NOT.LSAME( TRANSR, 'T' ) ) THEN
230 ELSE IF( .NOT.LOWER .AND. .NOT.LSAME( UPLO, 'U' ) ) THEN
232 ELSE IF( N.LT.0 ) THEN
236 CALL XERBLA( 'STPTTF', -INFO )
240 * Quick return if possible
246 IF( NORMALTRANSR ) THEN
254 * Size of array ARF(0:NT-1)
258 * Set N1 and N2 depending on LOWER
268 * If N is odd, set NISODD = .TRUE.
269 * If N is even, set K = N/2 and NISODD = .FALSE.
271 * set lda of ARF^C; ARF^C is (0:(N+1)/2-1,0:N-noe)
272 * where noe = 0 if n is even, noe = 1 if n is odd
274 IF( MOD( N, 2 ).EQ.0 ) THEN
283 * ARF^C has lda rows and n+1-noe cols
285 IF( .NOT.NORMALTRANSR )
288 * start execution: there are eight cases
294 IF( NORMALTRANSR ) THEN
296 * N is odd and TRANSR = 'N'
300 * N is odd, TRANSR = 'N', and UPLO = 'L'
307 ARF( IJ ) = AP( IJP )
315 ARF( IJ ) = AP( IJP )
322 * N is odd, TRANSR = 'N', and UPLO = 'U'
328 ARF( IJ ) = AP( IJP )
337 ARF( IJ ) = AP( IJP )
347 * N is odd and TRANSR = 'T'
351 * N is odd, TRANSR = 'T', and UPLO = 'L'
355 DO IJ = I*( LDA+1 ), N*LDA - 1, LDA
356 ARF( IJ ) = AP( IJP )
362 DO IJ = JS, JS + N2 - J - 1
363 ARF( IJ ) = AP( IJP )
371 * N is odd, TRANSR = 'T', and UPLO = 'U'
377 ARF( IJ ) = AP( IJP )
383 DO IJ = I, I + ( N1+I )*LDA, LDA
384 ARF( IJ ) = AP( IJP )
397 IF( NORMALTRANSR ) THEN
399 * N is even and TRANSR = 'N'
403 * N is even, TRANSR = 'N', and UPLO = 'L'
410 ARF( IJ ) = AP( IJP )
418 ARF( IJ ) = AP( IJP )
425 * N is even, TRANSR = 'N', and UPLO = 'U'
431 ARF( IJ ) = AP( IJP )
440 ARF( IJ ) = AP( IJP )
450 * N is even and TRANSR = 'T'
454 * N is even, TRANSR = 'T', and UPLO = 'L'
458 DO IJ = I + ( I+1 )*LDA, ( N+1 )*LDA - 1, LDA
459 ARF( IJ ) = AP( IJP )
465 DO IJ = JS, JS + K - J - 1
466 ARF( IJ ) = AP( IJP )
474 * N is even, TRANSR = 'T', and UPLO = 'U'
480 ARF( IJ ) = AP( IJP )
486 DO IJ = I, I + ( K+I )*LDA, LDA
487 ARF( IJ ) = AP( IJP )