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

NAG FL Interface Introduction
Example description
    Program f01zdfe

!     F01ZDF Example Program Text

!     Mark 27.2 Release. NAG Copyright 2021.

!     .. Use Statements ..
      Use nag_library, Only: f01zdf, nag_wp, x04daf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer                          :: i, ifail, kl, ku, lda, ldb, m, n
!     .. Local Arrays ..
      Complex (Kind=nag_wp), Allocatable :: a(:,:), b(:,:)
!     .. Executable Statements ..
      Write (nout,*) 'F01ZDF Example Program Results'
!     Skip heading in data file
      Read (nin,*)
      Write (nout,*)
      Flush (nout)
      Read (nin,*) m, n, kl, ku
      lda = n
      ldb = lda
      Allocate (a(lda,n),b(ldb,n))
!     Read a banded matrix of size m by n. kl is the number of
!     subdiagonals, ku the number of superdiagonals.
      Do i = 1, n
        Read (nin,*) a(i,1:n)
      End Do
!     Clear the packed matrix array B, so that no elements are
!     unassigned when we print B later.
      b(1:(kl+ku+1),1:n) = (0.0E+0_nag_wp,0.0E+0_nag_wp)

!     ifail: behaviour on error exit
!             =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
      ifail = 0
!     Print the unpacked matrix
      Call x04daf('G','X',n,n,a,lda,'Unpacked Matrix A:',ifail)

      Write (nout,*)
      Flush (nout)

!     Convert to packed matrix form
      ifail = 0
      Call f01zdf('Pack',m,n,kl,ku,a,lda,b,ldb,ifail)

!     Print the packed matrix
      ifail = 0
      Call x04daf('G','X',kl+ku+1,n,b,ldb,'Packed Matrix B:',ifail)

    End Program f01zdfe