-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement simple numpy.fft-like interface #6
Comments
One issue to decide on is how to deal with FFTWs behavior of destroying input for complex to real transforms (see FFTW_DESTROY_INPUT). For multi-dimensional transforms it's not possible to use FFTW_PRESERVE_INPUT, so it might be more consistent to set it to FFTW_DESTROY_INPUT for 1D transforms as well. However, this will break numpy.fft compatibility. It may be good to print a warning message to make this clear. |
FFTW offers specialized functions for ranks 1, 2 and 3 and a general function for n-dimensional transforms. However, we should benchmark whether the 1-3 dimensional special functions are actually faster than the n-dimensional one. If not, we can just use one implementation function for all ranks, with simple wrappers for the 1, 2 and 3 dimensional cases. This would reduce the number of implemented functions from 72 to 18, plus 54 simple wrapper functions. See issue #13. |
Edited top comment, adding multiple precision functions. |
The basic interface for xarray is now implemented through only two function templates that include all the fftw-calling and type conversion logic. These can be specialized to all three precisions, all three fft families (regular, real and Hermitian) and all dimensionalities. This commit includes trial specializations for the 1D rfft family. On my laptop, tests for these functions run successfully. Using this commit to test on Travis and AppVeyor matrices.
The templates from commit 133f1be should probably be inline. |
Regarding the destroy input comment above: I opted to go for destructive functions. This should be added to the documentation (#12). |
Regular FFT family now fully functional! #6
We want to implement a very simple FFT interface, mimicking the numpy.fft default behavior. This means that we want the following matrix of functions:
fft
for standard complex to complex transforms,rfft
for real FFTs (real signal) andhfft
for Hermitian FFTs (real Fourier spectrum);i
, e.g.ifft
;2
,3
orn
, e.g.irfft3
.That's a total of 24 functions.
Additionally, we want to support single, double and long double precision arrays. This can be implemented through template specializations. The total amount of implemented functions would then be 72.
Also part of this interface would be broadcasting over multiple array dimensions, if the dimension of the function is smaller than that of the array itself; see #4.
The text was updated successfully, but these errors were encountered: