1*
2* Copyright (c) 1997-1999, 2003 Massachusetts Institute of Technology
3*
4* This program is free software; you can redistribute it and/or modify
5* it under the terms of the GNU General Public License as published by
6* the Free Software Foundation; either version 2 of the License, or
7* (at your option) any later version.
8*
9* This program is distributed in the hope that it will be useful,
10* but WITHOUT ANY WARRANTY; without even the implied warranty of
11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12* GNU General Public License for more details.
13*
14* You should have received a copy of the GNU General Public License
15* along with this program; if not, write to the Free Software
16* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17*
18
19c	Simple program to demonstrate calling the wrapper routines
20c	to perform 1D transforms in Fortran.  This program should be
21c       linked with -lfftw -lm (assuming double-precision FFTW).  Note
22c       also that the plan should be integer*8 on a 64-bit machine.
23
24	program test
25
26	implicit none
27
28#include "fftw_f77.i"
29
30	integer N
31	parameter(N=4)
32	double complex in, out
33	dimension in(N),out(N)
34
35	integer i
36
37	integer plan
38
39	write(*,*) 'Input array:'
40	do i = 1,N,1
41		in(i) = dcmplx(float(i),float(i+1))
42		write(*,*) '    in(',i,') = ',in(i)
43	enddo
44
45	call fftw_f77_create_plan(plan,N,FFTW_FORWARD,FFTW_ESTIMATE)
46
47	call fftw_f77(plan,1,in,1,0,out,1,0)
48
49        write(*,*) 'Output array:'
50        do i = 1,N,1
51                write(*,*) '    out(',i,') = ',out(i)
52        enddo
53
54	call fftw_f77_destroy_plan(plan)
55
56	call fftw_f77_create_plan(plan,N,FFTW_BACKWARD,FFTW_ESTIMATE)
57
58        call fftw_f77(plan,1,out,1,0,in,1,0)
59
60        write(*,*) 'Output array after inverse FFT:'
61        do i = 1,N,1
62                write(*,*) '    ',N,' * in(',i,') = ',in(i)
63        enddo
64
65        call fftw_f77_destroy_plan(plan)
66
67	end
68