xtensor-stack / xtensor

C++ tensors with broadcasting and lazy computing
BSD 3-Clause "New" or "Revised" License
3.32k stars 396 forks source link

Pure xtensor FFT implementation #2782

Closed spectre-ns closed 3 months ago

spectre-ns commented 5 months ago

Checklist

Description

spectre-ns commented 5 months ago

@tdegeus Try again on the FFT PR. :)

spectre-ns commented 4 months ago

@JohanMabille I thought you might like this to help fill out the numpy interface farther.

JohanMabille commented 3 months ago

Thanks! We also have FFTW bindings, although not maintained for a while. It might be interesting to compare the results and performance.

spectre-ns commented 3 months ago

We also have FFTW bindings, although not maintained for a while. It might be interesting to compare the results and performance.

@JohanMabille Yeah I use the FFTW binding in some production code but it's nice to get something for prototyping without the extra dependencies. Also, FFTW is GPL licensed which meant we had to link against MKL instead.

I expect the performance from FFTW will be far superior because I didn't implement any memory pools or plans. Thus, there is dynamic memory allocation each time this is called in the hot path. We could implement it such that when used with xfixed the operation is completely fused and unwrapped which would have an advantage over FFTW... FFTW is crazy fast though so I don't know if xtensor would win versus the hand rolled implementation in FFTW.