    PROGRAM nag_sym_fft_ex07

      ! Example Program Text for nag_sym_fft
      ! NAG fl90, Release 4. NAG Copyright 2000.

      ! .. Use Statements ..
      USE nag_examples_io, ONLY : nag_std_in, nag_std_out
      USE nag_sym_fft, ONLY : nag_fft_qtr_sin, nag_fft_trig
      ! .. Implicit None Statement ..
      IMPLICIT NONE
      ! .. Intrinsic Functions ..
      INTRINSIC KIND
      ! .. Parameters ..
      INTEGER, PARAMETER :: wp = KIND(1.0D0)
      ! .. Local Scalars ..
      INTEGER :: n
      ! .. Local Arrays ..
      REAL (wp), ALLOCATABLE :: trig(:), x(:), xhat(:)
      ! .. Executable Statements ..
      WRITE (nag_std_out,*) 'Example Program Results for nag_sym_fft_ex07'

      READ (nag_std_in,*)          ! Skip heading in data file
      READ (nag_std_in,*) n

      ALLOCATE (x(n),xhat(n),trig(2*n)) ! Allocate storage

      READ (nag_std_in,*) x
      WRITE (nag_std_out,*)
      WRITE (nag_std_out,*) 'Original data'
      WRITE (nag_std_out,'(7f10.4)') x
      WRITE (nag_std_out,*)

      CALL nag_fft_trig(trig)

      xhat = nag_fft_qtr_sin(x,trig=trig)

      WRITE (nag_std_out,*) 'Transformed data'
      WRITE (nag_std_out,'(7f10.4)') xhat
      WRITE (nag_std_out,*)

      x = nag_fft_qtr_sin(xhat,inverse=.TRUE.,trig=trig)

      WRITE (nag_std_out,*) 'Original data restored by inverse transform'
      WRITE (nag_std_out,'(7f10.4)') x
      WRITE (nag_std_out,*)

      DEALLOCATE (x,xhat,trig)     ! Deallocate storage

    END PROGRAM nag_sym_fft_ex07
