      PROGRAM FFTDEMO
      INCLUDE 'STDHDR.FOR'

      REAL xr(0: maxr, 0: maxc)
      REAL yi(0: maxr, 0: maxc)
      INTEGER nd, i,j


      !!!!!!!!!!!!!!!!!!!!!!!!!!!
      !!!!!!!!!!!!!!!!!!!!!!!!!!!
      ! {main program fft}
      nd = 8
      do i = 0, nd - 1
        do j = 0, nd - 1
          xr(i, j) = COS(pi * i / 4.0) + COS(pi * j / 2.0)
          yi(i, j) = 0.0
        end do
      end do
      CALL showdata(xr, nd)
      CALL FFT2DCalc(xr, yi, nd, nd, 0)
      CALL showdata(xr, nd)
      CALL FFT2DCalc(xr, yi, nd, nd, 1)
      CALL showdata(xr, nd)

      END

      !!!!!!!!!!!!!!!!!!!!!!!!!!!
C     ****************************
      !!!!!!!!!!!!!!!!!!!!!!!!!!!
      SUBROUTINE showdata (xr, nd)
      INCLUDE 'STDHDR.FOR'
      REAL xr(0: maxr, 0: maxc)
      INTEGER nd, i, j

      DO i = 0, nd - 1
        DO j = 0, nd - 1
          WRITE(*,10) xr(i, j)
        END DO
        WRITE (*,*)
      END DO
10    FORMAT (F9.3,5X \)
      END !! SUB ShowData


