LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
stpttf.f
Go to the documentation of this file.
1*> \brief \b STPTTF copies a triangular matrix from the standard packed format (TP) to the rectangular full packed format (TF).
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download STPTTF + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/stpttf.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/stpttf.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/stpttf.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE STPTTF( TRANSR, UPLO, N, AP, ARF, INFO )
20*
21* .. Scalar Arguments ..
22* CHARACTER TRANSR, UPLO
23* INTEGER INFO, N
24* ..
25* .. Array Arguments ..
26* REAL AP( 0: * ), ARF( 0: * )
27*
28*
29*> \par Purpose:
30* =============
31*>
32*> \verbatim
33*>
34*> STPTTF copies a triangular matrix A from standard packed format (TP)
35*> to rectangular full packed format (TF).
36*> \endverbatim
37*
38* Arguments:
39* ==========
40*
41*> \param[in] TRANSR
42*> \verbatim
43*> TRANSR is CHARACTER*1
44*> = 'N': ARF in Normal format is wanted;
45*> = 'T': ARF in Conjugate-transpose format is wanted.
46*> \endverbatim
47*>
48*> \param[in] UPLO
49*> \verbatim
50*> UPLO is CHARACTER*1
51*> = 'U': A is upper triangular;
52*> = 'L': A is lower triangular.
53*> \endverbatim
54*>
55*> \param[in] N
56*> \verbatim
57*> N is INTEGER
58*> The order of the matrix A. N >= 0.
59*> \endverbatim
60*>
61*> \param[in] AP
62*> \verbatim
63*> AP is REAL array, dimension ( N*(N+1)/2 ),
64*> On entry, the upper or lower triangular matrix A, packed
65*> columnwise in a linear array. The j-th column of A is stored
66*> in the array AP as follows:
67*> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
68*> if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
69*> \endverbatim
70*>
71*> \param[out] ARF
72*> \verbatim
73*> ARF is REAL array, dimension ( N*(N+1)/2 ),
74*> On exit, the upper or lower triangular matrix A stored in
75*> RFP format. For a further discussion see Notes below.
76*> \endverbatim
77*>
78*> \param[out] INFO
79*> \verbatim
80*> INFO is INTEGER
81*> = 0: successful exit
82*> < 0: if INFO = -i, the i-th argument had an illegal value
83*> \endverbatim
84*
85* Authors:
86* ========
87*
88*> \author Univ. of Tennessee
89*> \author Univ. of California Berkeley
90*> \author Univ. of Colorado Denver
91*> \author NAG Ltd.
92*
93*> \ingroup tpttf
94*
95*> \par Further Details:
96* =====================
97*>
98*> \verbatim
99*>
100*> We first consider Rectangular Full Packed (RFP) Format when N is
101*> even. We give an example where N = 6.
102*>
103*> AP is Upper AP is Lower
104*>
105*> 00 01 02 03 04 05 00
106*> 11 12 13 14 15 10 11
107*> 22 23 24 25 20 21 22
108*> 33 34 35 30 31 32 33
109*> 44 45 40 41 42 43 44
110*> 55 50 51 52 53 54 55
111*>
112*>
113*> Let TRANSR = 'N'. RFP holds AP as follows:
114*> For UPLO = 'U' the upper trapezoid A(0:5,0:2) consists of the last
115*> three columns of AP upper. The lower triangle A(4:6,0:2) consists of
116*> the transpose of the first three columns of AP upper.
117*> For UPLO = 'L' the lower trapezoid A(1:6,0:2) consists of the first
118*> three columns of AP lower. The upper triangle A(0:2,0:2) consists of
119*> the transpose of the last three columns of AP lower.
120*> This covers the case N even and TRANSR = 'N'.
121*>
122*> RFP A RFP A
123*>
124*> 03 04 05 33 43 53
125*> 13 14 15 00 44 54
126*> 23 24 25 10 11 55
127*> 33 34 35 20 21 22
128*> 00 44 45 30 31 32
129*> 01 11 55 40 41 42
130*> 02 12 22 50 51 52
131*>
132*> Now let TRANSR = 'T'. RFP A in both UPLO cases is just the
133*> transpose of RFP A above. One therefore gets:
134*>
135*>
136*> RFP A RFP A
137*>
138*> 03 13 23 33 00 01 02 33 00 10 20 30 40 50
139*> 04 14 24 34 44 11 12 43 44 11 21 31 41 51
140*> 05 15 25 35 45 55 22 53 54 55 22 32 42 52
141*>
142*>
143*> We then consider Rectangular Full Packed (RFP) Format when N is
144*> odd. We give an example where N = 5.
145*>
146*> AP is Upper AP is Lower
147*>
148*> 00 01 02 03 04 00
149*> 11 12 13 14 10 11
150*> 22 23 24 20 21 22
151*> 33 34 30 31 32 33
152*> 44 40 41 42 43 44
153*>
154*>
155*> Let TRANSR = 'N'. RFP holds AP as follows:
156*> For UPLO = 'U' the upper trapezoid A(0:4,0:2) consists of the last
157*> three columns of AP upper. The lower triangle A(3:4,0:1) consists of
158*> the transpose of the first two columns of AP upper.
159*> For UPLO = 'L' the lower trapezoid A(0:4,0:2) consists of the first
160*> three columns of AP lower. The upper triangle A(0:1,1:2) consists of
161*> the transpose of the last two columns of AP lower.
162*> This covers the case N odd and TRANSR = 'N'.
163*>
164*> RFP A RFP A
165*>
166*> 02 03 04 00 33 43
167*> 12 13 14 10 11 44
168*> 22 23 24 20 21 22
169*> 00 33 34 30 31 32
170*> 01 11 44 40 41 42
171*>
172*> Now let TRANSR = 'T'. RFP A in both UPLO cases is just the
173*> transpose of RFP A above. One therefore gets:
174*>
175*> RFP A RFP A
176*>
177*> 02 12 22 00 01 00 10 20 30 40 50
178*> 03 13 23 33 11 33 11 21 31 41 51
179*> 04 14 24 34 44 43 44 22 32 42 52
180*> \endverbatim
181*>
182* =====================================================================
183 SUBROUTINE stpttf( TRANSR, UPLO, N, AP, ARF, INFO )
184*
185* -- LAPACK computational routine --
186* -- LAPACK is a software package provided by Univ. of Tennessee, --
187* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
188*
189* .. Scalar Arguments ..
190 CHARACTER TRANSR, UPLO
191 INTEGER INFO, N
192* ..
193* .. Array Arguments ..
194 REAL AP( 0: * ), ARF( 0: * )
195*
196* =====================================================================
197*
198* .. Parameters ..
199* ..
200* .. Local Scalars ..
201 LOGICAL LOWER, NISODD, NORMALTRANSR
202 INTEGER N1, N2, K, NT
203 INTEGER I, J, IJ
204 INTEGER IJP, JP, LDA, JS
205* ..
206* .. External Functions ..
207 LOGICAL LSAME
208 EXTERNAL lsame
209* ..
210* .. External Subroutines ..
211 EXTERNAL xerbla
212* ..
213* .. Intrinsic Functions ..
214 INTRINSIC mod
215* ..
216* .. Executable Statements ..
217*
218* Test the input parameters.
219*
220 info = 0
221 normaltransr = lsame( transr, 'N' )
222 lower = lsame( uplo, 'L' )
223 IF( .NOT.normaltransr .AND. .NOT.lsame( transr, 'T' ) ) THEN
224 info = -1
225 ELSE IF( .NOT.lower .AND. .NOT.lsame( uplo, 'U' ) ) THEN
226 info = -2
227 ELSE IF( n.LT.0 ) THEN
228 info = -3
229 END IF
230 IF( info.NE.0 ) THEN
231 CALL xerbla( 'STPTTF', -info )
232 RETURN
233 END IF
234*
235* Quick return if possible
236*
237 IF( n.EQ.0 )
238 $ RETURN
239*
240 IF( n.EQ.1 ) THEN
241 IF( normaltransr ) THEN
242 arf( 0 ) = ap( 0 )
243 ELSE
244 arf( 0 ) = ap( 0 )
245 END IF
246 RETURN
247 END IF
248*
249* Size of array ARF(0:NT-1)
250*
251 nt = n*( n+1 ) / 2
252*
253* Set N1 and N2 depending on LOWER
254*
255 IF( lower ) THEN
256 n2 = n / 2
257 n1 = n - n2
258 ELSE
259 n1 = n / 2
260 n2 = n - n1
261 END IF
262*
263* If N is odd, set NISODD = .TRUE.
264* If N is even, set K = N/2 and NISODD = .FALSE.
265*
266* set lda of ARF^C; ARF^C is (0:(N+1)/2-1,0:N-noe)
267* where noe = 0 if n is even, noe = 1 if n is odd
268*
269 IF( mod( n, 2 ).EQ.0 ) THEN
270 k = n / 2
271 nisodd = .false.
272 lda = n + 1
273 ELSE
274 nisodd = .true.
275 lda = n
276 END IF
277*
278* ARF^C has lda rows and n+1-noe cols
279*
280 IF( .NOT.normaltransr )
281 $ lda = ( n+1 ) / 2
282*
283* start execution: there are eight cases
284*
285 IF( nisodd ) THEN
286*
287* N is odd
288*
289 IF( normaltransr ) THEN
290*
291* N is odd and TRANSR = 'N'
292*
293 IF( lower ) THEN
294*
295* N is odd, TRANSR = 'N', and UPLO = 'L'
296*
297 ijp = 0
298 jp = 0
299 DO j = 0, n2
300 DO i = j, n - 1
301 ij = i + jp
302 arf( ij ) = ap( ijp )
303 ijp = ijp + 1
304 END DO
305 jp = jp + lda
306 END DO
307 DO i = 0, n2 - 1
308 DO j = 1 + i, n2
309 ij = i + j*lda
310 arf( ij ) = ap( ijp )
311 ijp = ijp + 1
312 END DO
313 END DO
314*
315 ELSE
316*
317* N is odd, TRANSR = 'N', and UPLO = 'U'
318*
319 ijp = 0
320 DO j = 0, n1 - 1
321 ij = n2 + j
322 DO i = 0, j
323 arf( ij ) = ap( ijp )
324 ijp = ijp + 1
325 ij = ij + lda
326 END DO
327 END DO
328 js = 0
329 DO j = n1, n - 1
330 ij = js
331 DO ij = js, js + j
332 arf( ij ) = ap( ijp )
333 ijp = ijp + 1
334 END DO
335 js = js + lda
336 END DO
337*
338 END IF
339*
340 ELSE
341*
342* N is odd and TRANSR = 'T'
343*
344 IF( lower ) THEN
345*
346* N is odd, TRANSR = 'T', and UPLO = 'L'
347*
348 ijp = 0
349 DO i = 0, n2
350 DO ij = i*( lda+1 ), n*lda - 1, lda
351 arf( ij ) = ap( ijp )
352 ijp = ijp + 1
353 END DO
354 END DO
355 js = 1
356 DO j = 0, n2 - 1
357 DO ij = js, js + n2 - j - 1
358 arf( ij ) = ap( ijp )
359 ijp = ijp + 1
360 END DO
361 js = js + lda + 1
362 END DO
363*
364 ELSE
365*
366* N is odd, TRANSR = 'T', and UPLO = 'U'
367*
368 ijp = 0
369 js = n2*lda
370 DO j = 0, n1 - 1
371 DO ij = js, js + j
372 arf( ij ) = ap( ijp )
373 ijp = ijp + 1
374 END DO
375 js = js + lda
376 END DO
377 DO i = 0, n1
378 DO ij = i, i + ( n1+i )*lda, lda
379 arf( ij ) = ap( ijp )
380 ijp = ijp + 1
381 END DO
382 END DO
383*
384 END IF
385*
386 END IF
387*
388 ELSE
389*
390* N is even
391*
392 IF( normaltransr ) THEN
393*
394* N is even and TRANSR = 'N'
395*
396 IF( lower ) THEN
397*
398* N is even, TRANSR = 'N', and UPLO = 'L'
399*
400 ijp = 0
401 jp = 0
402 DO j = 0, k - 1
403 DO i = j, n - 1
404 ij = 1 + i + jp
405 arf( ij ) = ap( ijp )
406 ijp = ijp + 1
407 END DO
408 jp = jp + lda
409 END DO
410 DO i = 0, k - 1
411 DO j = i, k - 1
412 ij = i + j*lda
413 arf( ij ) = ap( ijp )
414 ijp = ijp + 1
415 END DO
416 END DO
417*
418 ELSE
419*
420* N is even, TRANSR = 'N', and UPLO = 'U'
421*
422 ijp = 0
423 DO j = 0, k - 1
424 ij = k + 1 + j
425 DO i = 0, j
426 arf( ij ) = ap( ijp )
427 ijp = ijp + 1
428 ij = ij + lda
429 END DO
430 END DO
431 js = 0
432 DO j = k, n - 1
433 ij = js
434 DO ij = js, js + j
435 arf( ij ) = ap( ijp )
436 ijp = ijp + 1
437 END DO
438 js = js + lda
439 END DO
440*
441 END IF
442*
443 ELSE
444*
445* N is even and TRANSR = 'T'
446*
447 IF( lower ) THEN
448*
449* N is even, TRANSR = 'T', and UPLO = 'L'
450*
451 ijp = 0
452 DO i = 0, k - 1
453 DO ij = i + ( i+1 )*lda, ( n+1 )*lda - 1, lda
454 arf( ij ) = ap( ijp )
455 ijp = ijp + 1
456 END DO
457 END DO
458 js = 0
459 DO j = 0, k - 1
460 DO ij = js, js + k - j - 1
461 arf( ij ) = ap( ijp )
462 ijp = ijp + 1
463 END DO
464 js = js + lda + 1
465 END DO
466*
467 ELSE
468*
469* N is even, TRANSR = 'T', and UPLO = 'U'
470*
471 ijp = 0
472 js = ( k+1 )*lda
473 DO j = 0, k - 1
474 DO ij = js, js + j
475 arf( ij ) = ap( ijp )
476 ijp = ijp + 1
477 END DO
478 js = js + lda
479 END DO
480 DO i = 0, k - 1
481 DO ij = i, i + ( k+i )*lda, lda
482 arf( ij ) = ap( ijp )
483 ijp = ijp + 1
484 END DO
485 END DO
486*
487 END IF
488*
489 END IF
490*
491 END IF
492*
493 RETURN
494*
495* End of STPTTF
496*
497 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine stpttf(transr, uplo, n, ap, arf, info)
STPTTF copies a triangular matrix from the standard packed format (TP) to the rectangular full packed...
Definition stpttf.f:184