Skip to content
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

Support 2D and 3D FFT? #49

Open
davidssmith opened this issue Oct 13, 2019 · 7 comments
Open

Support 2D and 3D FFT? #49

davidssmith opened this issue Oct 13, 2019 · 7 comments

Comments

@davidssmith
Copy link

Does this crate support 2D and 3D FFTs?

@ejmahler
Copy link
Collaborator

ejmahler commented Oct 13, 2019 via email

@davidssmith
Copy link
Author

Is there a speed penalty for doing it this way, or is this how libraries like FFTW do 2D transforms under the hood?

@ejmahler
Copy link
Collaborator

ejmahler commented Oct 13, 2019 via email

@Boscop
Copy link

Boscop commented Jun 13, 2020

Btw, FFTS supports N-dimensional FFT: https://github.com/anthonix/ffts

@alvarozamora
Copy link

Bumping this. Is there a better crate for doing N-dimensional FFTs in Rust. Is there an example of using this + transpose crate?

@cavemanloverboy
Copy link

Not directly. But you can compute a Nd FFT by computing FFTs for the rows, transposing, doing FFTs for the columns, transposing again, etc. check out the “transpose” crate for a convenient transpose routine

On Sun, Oct 13, 2019 at 10:34 AM David Smith @.***> wrote: Does this crate support 2D and 3D FFTs? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#49?email_source=notifications&email_token=AAI2M6XE4H4B3VWS6RM4O2TQONL4FA5CNFSM4JAH352KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HROLU3A>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI2M6V3UKVHF5UWUQM4PDTQONL4FANCNFSM4JAH352A .

I tried doing this but it's kind of slow. I spend 10x time on transposes vs the FFTs.

@ejmahler
Copy link
Collaborator

One approach that could take less time is:

For each dimension, copy strided elements into a contiguous scratch buffer, then compute the FFT, then copy them back into their original strided location.

That would let you do the FFT without any transposes, and it's highly parallelizable.

Once you do that, an obvious next step to improve cache friendliness would be "loop tiling" IE instead of copying a single column into a single scratch buffer, copy 8 columns into 8 scratch buffers, and then compute 8 FFTs. By doing 8 columns at once, you can copy 8 contiguous elements from each row, making your code more cache friendly.

If you try this and it works well, let me know, I'd be happy to include it! BTW, this repository is obsolete, rustFFT now happens in https://github.com/ejmahler/RustFFT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants