[std.numeric.fft] Arbitrary sized FFT

Imperatorn johan_forsberg_86 at hotmail.com
Mon Nov 7 16:48:48 UTC 2022


On Saturday, 5 November 2022 at 14:47:40 UTC, RIG_ wrote:
> 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.

What about using something like this?

https://github.com/d1vanov/Simple-FFT

Some extra reading:
https://github.com/atilaneves/dpp
https://github.com/Superbelko/ohmygentool
https://github.com/dkorpel/ctod
https://github.com/jacob-carlborg/dstep
http://rainers.github.io/visuald/visuald/CppConversion.html


More information about the Digitalmars-d mailing list