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

NAG FL Interface Introduction
Example description
    Program c06pkfe

!     C06PKF Example Program Text

!     Mark 28.3 Release. NAG Copyright 2022.

!     .. Use Statements ..
      Use nag_library, Only: c06pkf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer                          :: ieof, ifail, j, n
!     .. Local Arrays ..
      Complex (Kind=nag_wp), Allocatable :: work(:), xa(:), xb(:), ya(:),      &
                                          yb(:)
!     .. Executable Statements ..
      Write (nout,*) 'C06PKF Example Program Results'
      Write (nout,*)
!     Skip heading in data file
      Read (nin,*)
loop: Do
        Read (nin,*,Iostat=ieof) n
        If (ieof<0) Then
          Exit loop
        End If

        Allocate (work(2*n+15),xa(n),xb(n),ya(n),yb(n))
        Read (nin,*)(xa(j),ya(j),j=1,n)
        xb(1:n) = xa(1:n)
        yb(1:n) = ya(1:n)

!       ifail: behaviour on error exit
!              =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
        ifail = 0
        Call c06pkf(1,xa,ya,n,work,ifail)

        Call c06pkf(2,xb,yb,n,work,ifail)

        Write (nout,*) '        Convolution            Correlation'
        Write (nout,*)
        Do j = 0, n - 1
          Write (nout,99999) j, xa(j+1), xb(j+1)
        End Do
        Deallocate (work,xa,xb,ya,yb)
      End Do loop

99999 Format (1X,I5,2(1X,'(',F9.5,',',F9.5,')'))
    End Program c06pkfe