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

NAG FL Interface Introduction
Example description
    Program c06fkfe

!     C06FKF Example Program Text

!     Mark 30.1 Release. NAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: c06fkf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer                          :: ieof, ifail, j, n
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: work(:), xa(:), xb(:), ya(:), yb(:)
!     .. Executable Statements ..
      Write (nout,*) 'C06FKF 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(n),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 c06fkf(1,xa,ya,n,work,ifail)

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

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

99999 Format (1X,I5,2F13.5)
    End Program c06fkfe