fftw_complex *in, *out;
in = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N);
out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N);
fftw_plan p;
p = fftw_plan_dft_1d(N, in, out, FFTW_FORWARD, FFTW_ESTIMATE);
/* read in samples */
fftw_execute(p);
/* do stuff */
fftw_destroy_plan(p);
fftw_free(in);
fftw_free(out);
In Python with
numpy/scipy installed, this is so much easier.from numpy import *
# read in samples
fftout = fft(samples)
And that's it! I should have been using nothing but Python for nearly everything from the start, and screw C.
