[std.numeric.fft] Arbitrary sized FFT

RIG_ rustbucket1000 at live.co.uk
Sat Nov 5 14:47:40 UTC 2022


Hi,

I want to use D for scientific programming (I work at a 
University). It's fast, it's readable, and it's so nice to use, 
but I'm probably going to be forced to use Python / MATLAB unless 
I can easily do a Fast Fourier Transform.

The current [FFT 
implementation](https://dlang.org/library/std/numeric/fft.html) 
only allows for performing a one-dimensional Fourier transform 
across a one-dimensional `Range`.

I need to be able to do a Fourier Transform of an arbitrary-sized 
complex-values Slice with as many axes as I need.
I had thought about some kind of [DFT 
Matrix](https://en.wikipedia.org/wiki/DFT_matrix) as a 
[Vandermonde 
matrix](http://mir-algorithm.libmir.org/mir_ndslice_filling.html) 
approach, but the slow-down that I'd see using D would not be 
worth it.

I would be happy to implement it myself, but I don't know enough 
about D, nor the FFT algorithms to do so.

I have thought about using [`fftw`](https://www.fftw.org/), but 
it feels like doing `fft`s should in the standard library.

I'd say a wishlist is something on parity with NumPy, where I can 
take a fft of arbitrary-sized Range across an arbitrary axis. As 
it stands, the current `fft` implementation isn't _particularly_ 
useful without some inbuilt helper methods such as `fftshift`, 
`ifftshift`, `fftfreq`, etc.


More information about the Digitalmars-d mailing list