LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ dtpttf()

subroutine dtpttf ( character transr,
character uplo,
integer n,
double precision, dimension( 0: * ) ap,
double precision, dimension( 0: * ) arf,
integer info )

DTPTTF copies a triangular matrix from the standard packed format (TP) to the rectangular full packed format (TF).

Download DTPTTF + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> DTPTTF copies a triangular matrix A from standard packed format (TP)
!> to rectangular full packed format (TF).
!> 
Parameters
[in]TRANSR
!>          TRANSR is CHARACTER*1
!>          = 'N':  ARF in Normal format is wanted;
!>          = 'T':  ARF in Conjugate-transpose format is wanted.
!> 
[in]UPLO
!>          UPLO is CHARACTER*1
!>          = 'U':  A is upper triangular;
!>          = 'L':  A is lower triangular.
!> 
[in]N
!>          N is INTEGER
!>          The order of the matrix A.  N >= 0.
!> 
[in]AP
!>          AP is DOUBLE PRECISION array, dimension ( N*(N+1)/2 ),
!>          On entry, the upper or lower triangular matrix A, packed
!>          columnwise in a linear array. The j-th column of A is stored
!>          in the array AP as follows:
!>          if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
!>          if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
!> 
[out]ARF
!>          ARF is DOUBLE PRECISION array, dimension ( N*(N+1)/2 ),
!>          On exit, the upper or lower triangular matrix A stored in
!>          RFP format. For a further discussion see Notes below.
!> 
[out]INFO
!>          INFO is INTEGER
!>          = 0:  successful exit
!>          < 0:  if INFO = -i, the i-th argument had an illegal value
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
!>
!>  We first consider Rectangular Full Packed (RFP) Format when N is
!>  even. We give an example where N = 6.
!>
!>      AP is Upper             AP is Lower
!>
!>   00 01 02 03 04 05       00
!>      11 12 13 14 15       10 11
!>         22 23 24 25       20 21 22
!>            33 34 35       30 31 32 33
!>               44 45       40 41 42 43 44
!>                  55       50 51 52 53 54 55
!>
!>
!>  Let TRANSR = 'N'. RFP holds AP as follows:
!>  For UPLO = 'U' the upper trapezoid A(0:5,0:2) consists of the last
!>  three columns of AP upper. The lower triangle A(4:6,0:2) consists of
!>  the transpose of the first three columns of AP upper.
!>  For UPLO = 'L' the lower trapezoid A(1:6,0:2) consists of the first
!>  three columns of AP lower. The upper triangle A(0:2,0:2) consists of
!>  the transpose of the last three columns of AP lower.
!>  This covers the case N even and TRANSR = 'N'.
!>
!>         RFP A                   RFP A
!>
!>        03 04 05                33 43 53
!>        13 14 15                00 44 54
!>        23 24 25                10 11 55
!>        33 34 35                20 21 22
!>        00 44 45                30 31 32
!>        01 11 55                40 41 42
!>        02 12 22                50 51 52
!>
!>  Now let TRANSR = 'T'. RFP A in both UPLO cases is just the
!>  transpose of RFP A above. One therefore gets:
!>
!>
!>           RFP A                   RFP A
!>
!>     03 13 23 33 00 01 02    33 00 10 20 30 40 50
!>     04 14 24 34 44 11 12    43 44 11 21 31 41 51
!>     05 15 25 35 45 55 22    53 54 55 22 32 42 52
!>
!>
!>  We then consider Rectangular Full Packed (RFP) Format when N is
!>  odd. We give an example where N = 5.
!>
!>     AP is Upper                 AP is Lower
!>
!>   00 01 02 03 04              00
!>      11 12 13 14              10 11
!>         22 23 24              20 21 22
!>            33 34              30 31 32 33
!>               44              40 41 42 43 44
!>
!>
!>  Let TRANSR = 'N'. RFP holds AP as follows:
!>  For UPLO = 'U' the upper trapezoid A(0:4,0:2) consists of the last
!>  three columns of AP upper. The lower triangle A(3:4,0:1) consists of
!>  the transpose of the first two columns of AP upper.
!>  For UPLO = 'L' the lower trapezoid A(0:4,0:2) consists of the first
!>  three columns of AP lower. The upper triangle A(0:1,1:2) consists of
!>  the transpose of the last two columns of AP lower.
!>  This covers the case N odd and TRANSR = 'N'.
!>
!>         RFP A                   RFP A
!>
!>        02 03 04                00 33 43
!>        12 13 14                10 11 44
!>        22 23 24                20 21 22
!>        00 33 34                30 31 32
!>        01 11 44                40 41 42
!>
!>  Now let TRANSR = 'T'. RFP A in both UPLO cases is just the
!>  transpose of RFP A above. One therefore gets:
!>
!>           RFP A                   RFP A
!>
!>     02 12 22 00 01             00 10 20 30 40 50
!>     03 13 23 33 11             33 11 21 31 41 51
!>     04 14 24 34 44             43 44 22 32 42 52
!> 

Definition at line 183 of file dtpttf.f.

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 DOUBLE PRECISION 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( 'DTPTTF', -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 DTPTTF
496*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
Here is the call graph for this function:
Here is the caller graph for this function: