NAG Library Manual, Mark 30.1
Interfaces:  FL   CL   CPP   AD 

NAG FL Interface Introduction
Example description
    Program f01vcfe

!     F01VCF Example Program Text

!     Mark 30.1 Release. NAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: dtpttr, nag_wp, x04cbf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: inc1 = 1, indent = 0, ncols = 80,    &
                                          nin = 5, nout = 6
      Character (1), Parameter         :: diag = 'N', intlabel = 'I',          &
                                          matrix = 'G', nolabel = 'N'
      Character (4), Parameter         :: form = 'F5.2'
!     .. Local Scalars ..
      Integer                          :: i, ifail, info, lda, lenap, n
      Character (18)                   :: title
      Character (1)                    :: uplo
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: a(:,:), ap(:)
      Character (1)                    :: clabs(1), rlabs(1)
!     .. Executable Statements ..
      Write (nout,*) 'F01VCF Example Program Results'
!     Skip heading in data file
      Read (nin,*)
      Write (nout,*)
      Flush (nout)
      Read (nin,*) n, uplo
      lda = n
      lenap = (n*(n+1))/2
      Allocate (a(lda,n),ap(lenap))

!     Read a packed vector of order n
      Do i = 1, lenap
        Read (nin,*) ap(i)
      End Do

!     Print the packed vector
      title = 'Packed Matrix AP: '
      ifail = 0
      Call x04cbf(matrix,diag,lenap,inc1,ap,lenap,form,title,intlabel,rlabs,   &
        nolabel,clabs,ncols,indent,ifail)

      Write (nout,*)
      Flush (nout)

!     Convert to triangular form
!     The NAG name equivalent of dtpttr is f01vcf
      Call dtpttr(uplo,n,ap,a,lda,info)

!     Print the unpacked matrix
      title = 'Unpacked Matrix A:'
      ifail = 0
      Call x04cbf(uplo,diag,n,n,a,lda,form,title,intlabel,rlabs,intlabel,      &
        clabs,ncols,indent,ifail)

    End Program f01vcfe