Eigen (C++ library): Difference between revisions

No edit summary
Line 32: Line 32:
==Unsupported==
==Unsupported==
===FFT===
===FFT===
https://eigen.tuxfamily.org/dox/unsupported/group__FFT__Module.html
https://eigen.tuxfamily.org/dox/unsupported/group__FFT__Module.html<br>
This uses either fftw (default), Intel oneMKL, or kissfft (on older versions) under the hood.
https://gitlab.com/libeigen/eigen/-/blob/master/unsupported/Eigen/FFT?ref_type=heads<br>
https://eigen.tuxfamily.org/index.php?title=EigenFFT<br>
 
 
This uses either kissfft (default), fftw, Intel oneMKL, or pocketFFT under the hood.
There is very little documentation on this so it's easier to just read the code:
<syntaxhighlight lang="cpp">
 
// Initialize standard FFT.
Eigen::FFT<double> fft;
 
// Initialize RFFT
Eigen::FFT<double> fft(Eigen::FFT<double>::impl_type(), Eigen::FFT<double>::HalfSpectrum);
 
// Do the actual FFT or RFFT.
std::vector<double> my_data = {1.0, 2.0, 3.0, 4.0};
std::vector<std::complex<double>> fft_result;
fft.fwd(fft_result, my_data);
 
// Inverse
fft.inv(my_data, fft_result);
 
</syntaxhighlight>
 
'''Notes'''
* Alternative backend implementations can be set with <code>EIGEN_FFTW_DEFAULT</code>, <code>EIGEN_MKL_DEFAULT</code>, <code>EIGEN_POCKETFFT_DEFAULT</code>
* <code>fwd2</code> and <code>inv2</code> is available on the non-default backends.