If you have to compile code that uses Fourier Transforms you may wish to use the FFTW library which the authors describe thusly:
Our benchmarks, performed on on a variety of platforms, show that FFTW’s performance is typically superior to that of other publicly available FFT software, and is even competitive with vendor-tuned codes. In contrast to vendor-tuned codes, however, FFTW’s performance is portable: the same program will perform well on most architectures without modification. Hence the name, “FFTW,” which stands for the somewhat whimsical title of “Fastest Fourier Transform in the West.”
This post has some tips on compiling this code and the associated R package ‘fftw’.
The following instructions worked on CentOS 6.2.
Our R package will require a shared library so we will be installing fftw3 from source:
wget http://www.fftw.org/fftw-3.3.3.tar.gz tar -xzf fftw-3.3.3.tar.gz cd fftw-3.3.3 ./configure --enable-shared make sudo make install
On my system, the shared and static libraries are installed in /usr/local/lib:
ls -1 /usr/local/lib/*fftw3* /usr/local/lib/libfftw3.a /usr/local/lib/libfftw3.la /usr/local/lib/libfftw3.so /usr/local/lib/libfftw3.so.3 /usr/local/lib/libfftw3.so.3.3.2
Now that the fftw3 library is installed we can work on the fftw R package.
wget http://cran.r-project.org/src/contrib/fftw_1.0-3.tar.gz sudo R CMD INSTALL fftw_1.0-3.tar.gz ... No package 'fftw3' found Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. ...
I’ll save you an hour or more of googling by letting you know what I learned:
The R ‘fftw’ package uses the pkg-config utility to find installed software during compilation. The default installation of the fftw3 library places the necessary information in /usr/local/lib/pkgconfig/ so all we have to do to compile properly is specify this location during installation:
sudo R CMD INSTALL --configure-vars="PKG_CONFIG_PATH=/usr/local/lib/pkgconfig" fftw_1.0-3.tar.gz
As a math professor once said: “It’s easy once you know how.”