Example description
    Program c06pqfe

!     C06PQF Example Program Text

!     Mark 26.2 Release. NAG Copyright 2017.

!     .. Use Statements ..
      Use nag_library, Only: c06pqf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer                          :: i, ieof, ifail, j, m, n
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: work(:), x(:)
!     .. Executable Statements ..
      Write (nout,*) 'C06PQF Example Program Results'
!     Skip heading in data file
      Read (nin,*)
loop: Do
        Read (nin,*,Iostat=ieof) m, n
        If (ieof<0) Then
          Exit loop
        End If

        Allocate (work((m+2)*n+15),x(m*(n+2)))
        Do j = 1, m*(n+2), n + 2
          Read (nin,*)(x(j+i),i=0,n-1)
        End Do
        Write (nout,*)
        Write (nout,*) 'Original data values'
        Write (nout,*)
        Do j = 1, m*(n+2), n + 2
          Write (nout,99999) '     ', (x(j+i),i=0,n-1)
        End Do

!       ifail: behaviour on error exit
!              =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
        ifail = 0
        Call c06pqf('F',n,m,x,work,ifail)

        Write (nout,*)
        Write (nout,*)                                                         &
          'Discrete Fourier transforms in complex Hermitian format'
        Do j = 1, m*(n+2), n + 2
          Write (nout,*)
          Write (nout,99999) 'Real ', (x(j+2*i),i=0,n/2)
          Write (nout,99999) 'Imag ', (x(j+2*i+1),i=0,n/2)
        End Do
        Write (nout,*)
        Write (nout,*) 'Fourier transforms in full complex form'

        Do j = 1, m*(n+2), n + 2
          Write (nout,*)
          Write (nout,99999) 'Real ', (x(j+2*i),i=0,n/2),                      &
            (x(j+2*(n-i)),i=n/2+1,n-1)
          Write (nout,99999) 'Imag ', (x(j+2*i+1),i=0,n/2),                    &
            (-x(j+2*(n-i)+1),i=n/2+1,n-1)
        End Do

        Call c06pqf('B',n,m,x,work,ifail)

        Write (nout,*)
        Write (nout,*) 'Original data as restored by inverse transform'
        Write (nout,*)
        Do j = 1, m*(n+2), n + 2
          Write (nout,99999) '     ', (x(j+i),i=0,n-1)
        End Do
        Deallocate (x,work)
      End Do loop

99999 Format (1X,A,9(:,1X,F10.4))
    End Program c06pqfe