FFTW for IDL

FFTW is a free C subroutine library for computing the discrete Fourier transform (DFT) in one or more dimensions, of arbitrary input size, and of both real and complex data (as well as of even/odd data, i.e. the discrete cosine/sine transforms or DCT/DST). It is known to be one of the fastest freely available implementations of fast fourier transforms.

IDL has build-in routines for performing fourier transforms, which are easy to use and in most cases sufficiently fast. However, for certain time-critical computations it might be useful to use FFTW instead.

Speed:

The speed improvement can be quite significant, in particular when transforming multi-dimensional arrays and when using real-to-complex and complex-to-real transforms, which doesn't exist in IDL. A factor of 2-4 compared to native IDL is the normal case.

To give an imagination what can be possible, here is a result from a 4-processor IRIX machine. A 2D-FFT of a 4096x4096 complex matrix took 127.2 sec in native IDL and only 17.2 sec using libIDLfftw. Keep in mind that also IDL uses all 4 processors when doing fft's.

Routines:

Currently, only 4 different FFTW functions are implemented, which were of particular interest for me:

Maybe I'll add some more routines to the wrapper in the future, but don't thrust me too much on this. I would appreciate very much any contribution.

Installation:

Step 1: Download an unpack libIDLfftw (see below). If you found a suitable binary distribution, you can directly switch over to step 5. If not, or if it is not working for some reason, you'll have to go on and compile libIDLfftw for yourself. When compliling for windows, download the binary distribution, as it contains some additional files needed under windows.

Step 2: Download an compile fftw-2.1.5 (you have to use version 2.1.5, not 3.x). Use the configure program of fftw before compilation. Here you have use the flag "--enable-float" (when you're working with single precision complex data). Set also the flag"--enable-threads". After configuring, issue the command 'make' to compile fftw.

Step 3:
Now you have to copy the fftw libraries into the libIDLfftw directory:

cp threads/.libs/libfftw_threads.a /my/path/to/libIDLfftw
cp threads/.libs/librfftw_threads.a /my/path/to/libIDLfftw
cp fftw/.libs/libfftw.a /my/path/to/libIDLfftw
cp rfftw/.libs/librfftw.a /my/path/to/libIDLfftw

Step 4: Change into the libIDLfftw directory and compile libIDLfftw by issuing the commands:

make clean
make

This generates four shared object files:
libIDLfftw.so - single processor version
libIDLfftw_threads2.so - dual processor version
libIDLfftw_threads4.so - quadro processor version
libIDLfftw_threads8.so - 8 processor version

Step 5:
To use libIDLfftw from within IDL, you first have to start IDL and link the library (possibly add these lines to your startup.pro). Use the threaded versions when you have more than one processor.

IDL> linkimage,'fftw2d','libIDLfftw.so'
IDL> linkimage,'fftw1d_arr','libIDLfftw.so'
IDL> linkimage,'fftw2d_rc','libIDLfftw.so'
IDL> linkimage,'fftw2d_cr','libIDLfftw.so'

Once this is done you can use the 4 new routines, as described above.

Download:

Authors:

Todo: