Program c06fcfe
! C06FCF Example Program Text
! Mark 29.3 Release. NAG Copyright 2023.
! .. Use Statements ..
Use nag_library, Only: c06fcf, 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(:), x(:), xx(:), y(:), yy(:)
! .. Executable Statements ..
Write (nout,*) 'C06FCF Example Program Results'
! Skip heading in data file
Read (nin,*)
loop: Do
Read (nin,*,Iostat=ieof) n
If (ieof<0) Then
Exit loop
End If
Allocate (x(0:n-1),xx(0:n-1),y(0:n-1),yy(0:n-1),work(n))
Read (nin,*)(x(j),y(j),j=0,n-1)
xx(0:n-1) = x(0:n-1)
yy(0:n-1) = y(0:n-1)
! ifail: behaviour on error exit
! =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
ifail = 0
Call c06fcf(x,y,n,work,ifail)
Write (nout,*)
Write (nout,*) 'Components of discrete Fourier transform'
Write (nout,*)
Write (nout,*) ' Real Imag'
Write (nout,*)
Write (nout,99999)(j,x(j),y(j),j=0,n-1)
y(0:n-1) = -y(0:n-1)
Call c06fcf(x,y,n,work,ifail)
y(0:n-1) = -y(0:n-1)
Write (nout,*)
Write (nout,*) 'Original sequence as restored by inverse transform'
Write (nout,*)
Write (nout,*) ' Original Restored'
Write (nout,*) ' Real Imag Real Imag'
Write (nout,*)
Write (nout,99998)(j,xx(j),yy(j),x(j),y(j),j=0,n-1)
Deallocate (x,xx,y,yy,work)
End Do loop
99999 Format (1X,I5,2F10.5)
99998 Format (1X,I5,2F10.5,5X,2F10.5)
End Program c06fcfe