2020년 3월 23일 월요일

How to use the FFTW Library

How to use the FFTW Library


Using FFTW 3 from C and C++

In your program include:
#include <fftw3.h>
and call the appropriate fftw3 functions.
You may also include:
#include <complex.h>
to handle complex numbers.
There are three versions of the fftw3 library depending on precision. The APIs for each differ slightly because of the precision differences:
PrecisionLibraryExample Program (FFT of a sine wave)
Doublefftw3fftw3-test.c
Singlefftw3ffftw3f-test.c
Long Doublefftw3lfftw3l-test.c
To compile and link either enter:
icc pgm.c -I$FFTW3_HOME/include -L$FFTW3_HOME/lib -llib [-static-intel] -o pgm
or:
gcc -std=c99 pgm.c -I$FFTW3_HOME/include -L$FFTW3_HOME/lib -llib -lm [-static] -o pgm
depending upon the compiler you want to use.
  • Replace pgm.c with the name of the file containing your source code
  • Replace pgm with the name of the executable to be created
  • Replace lib with one of the three fftw3 libraries: fftw3, fftw3f or fftw3l
  • Set FFTW3_HOME /u/local/apps/fftw3/current
If you omit -static, you will have to set the LD_LIBRARY_PATH environment variable at run time to include $FFTW_HOME/lib.
You can either set an environment variable or replace $FFTW3_HOME in the command shown above.

댓글 없음:

댓글 쓰기