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

NAG FL Interface Introduction
Example description
    Program f01zbfe

!     F01ZBF Example Program Text

!     Mark 28.3 Release. NAG Copyright 2022.

!     .. Use Statements ..
      Use nag_library, Only: f01zbf, nag_wp, x04dbf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer                          :: i, ifail, lb, lda, lenb, n
      Character (1)                    :: diag, uplo
!     .. Local Arrays ..
      Complex (Kind=nag_wp), Allocatable :: a(:,:), b(:)
      Character (1)                    :: clabs(1), rlabs(1)
!     .. Executable Statements ..
      Write (nout,*) 'F01ZBF Example Program Results'
!     Skip heading in data file
      Read (nin,*)
      Write (nout,*)
      Flush (nout)
      Read (nin,*) n, uplo, diag
      lda = n
      lenb = (n*(n+1))/2
      Allocate (a(lda,n),b(lenb))
!     Read a triangular matrix of order n
      Do i = 1, n
        Read (nin,*) a(i,1:n)
      End Do

!     ifail: behaviour on error exit
!             =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
      ifail = 0
!     Print the unpacked matrix
      Call x04dbf(uplo,diag,n,n,a,lda,'B','F5.2','Unpacked Matrix A:','I',     &
        rlabs,'I',clabs,80,0,ifail)

      Write (nout,*)
      Flush (nout)

!     Convert to packed vector form
      ifail = 0
      Call f01zbf('Pack',uplo,diag,n,a,lda,b,ifail)

      lb = n*(n+1)/2

!     Print the packed vector
      ifail = 0
      Call x04dbf('G','X',lb,1,b,lb,'B','F5.2','Packed Vector B:','I',rlabs,   &
        'N',clabs,80,0,ifail)

    End Program f01zbfe