/******************************************************************** * Research Computing Center * The University of Chicago * Edelstone Center * 6030 S. Ellis Avenue, Room 126 * Chicago, IL 60637 * 773-795-2667 * rcc@uchicago.edu * * Author: Douglas Rudd * CNET: drudd * * Created: Tue Jul 10 ********************************************************************/ #include #include #include #include int main( int argc, char *argv[] ) { int fft_size; fftw_plan p; fftw_complex *in, *out; if ( argc != 2 ) { fprintf(stderr,"Usage: ./a.out N (size of fft)\n"); exit(1); } /* allocate space and initialize complex array to transform */ fft_size = atoi(argv[1]); in = (fftw_complex *)malloc( sizeof(fftw_complex)*fft_size ); out = (fftw_complex *)malloc( sizeof(fftw_complex)*fft_size ); if ( in == NULL || out == NULL ) { fprintf(stderr,"Unable to allocate space for arrays!\n"); exit(1); } memset( in, 0, fft_size*sizeof(fftw_complex) ); /* create fftw plan, compute fft, and destroy plan */ p = fftw_create_plan( fft_size, FFTW_FORWARD, FFTW_ESTIMATE | FFTW_OUT_OF_PLACE ); fftw_one( p, in, out ); fftw_destroy_plan(p); free(in); free(out); return 0; }