DEFT is a C++ library providing Fourier-transform-based tools for data on three-dimensional grids, including
- sums of functions duplicated over a lattice;
- interpolation and filtering with Fourier transforms;
- various derivatives (gradients, the Laplacian, etc.) computed with Fourier transforms.
DEFT has three FFT modes
- PocketFFT, used by numpy (installs automatically);
- FFTW, the "Fastest Fourier Transform in the West" (requires separate installation);
- Intel-MKL, can be the fastest in practice (requires separate installation).
DEFT includes python bindings constructed with pybind11. For example applications, see
- example: sums of functions duplicated over a lattice;
- example: interpolation with Fourier transforms;
- example: computing derivatives with Fourier transforms.
The default installation uses PocketFFT.
git clone --recursive https://github.com/wcwitt/deft
cd deft
mkdir build
cd build
cmake ..
make
cd ../test
python -m unittest
To use FFTW, first install the library. The following uses conda for this purpose.
git clone --recursive https://github.com/wcwitt/deft
cd deft
conda create --name deft-fftw python=3 numpy cmake
conda activate deft-fftw
conda install -c conda-forge fftw
mkdir build
cd build
cmake -DDEFT_FFT_TYPE=FFTW \
-DFFTW_INCLUDE_DIR=<conda-base>/envs/deft-fftw/include \
-DFFTW_LIBRARY_DIR=<conda-base>/envs/deft-fftw/lib \
..
make
cd ../test
python -m unittest
To use MKL, first install the library. The following uses conda for this purpose.
git clone --recursive https://github.com/wcwitt/deft
cd deft
conda create --name deft-mkl python=3 numpy cmake
conda activate deft-mkl
conda install -c intel mkl-devel
mkdir build
cd build
cmake -DDEFT_FFT_TYPE=MKL \
-DMKL_INCLUDE_DIR=<conda-base>/envs/deft-mkl/include \
-DMKL_LIBRARY_DIR=<conda-base>/envs/deft-mkl/lib \
..
make
export LD_LIBRARY_PATH=<conda-base>/envs/deft-mkl/lib:$LD_LIBRARY_PATH
cd ../test
python -m unittest