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

[Feature Request] Set stride #73

Closed
tstsrt opened this issue May 3, 2021 · 3 comments
Closed

[Feature Request] Set stride #73

tstsrt opened this issue May 3, 2021 · 3 comments

Comments

@tstsrt
Copy link

tstsrt commented May 3, 2021

I would like to be able to set the stride of the FFT. This is very useful for computing 2D and 3D FFTs.

Example usage:

let mut buffer2d = [1,0,0,0,
                    0,0,0,0];

// x direction
let mut fft = fft_planner.plan_fft(4, FftDirection::Forward);
fft.set_stride(1);
fft.process(&mut buffer2d);
assert_eq!(buffer2d, [1,1,1,1,
                      0,0,0,0]);

// y direction
fft = fft_planner.plan_fft(2, FftDirection::Inverse);
fft.set_stride(4);
fft.process(&mut buffer2d);
assert_eq!(buffer2d, [1,1,1,1,
                      1,1,1,1]);
@HEnquist
Copy link
Contributor

HEnquist commented May 6, 2021

This would complicate things a lot, and very likely give a significant performance drop. Why not just transpose the data between the fft steps? Check "transpose" on crates.io for nice fast 2D transposes.

@tstsrt
Copy link
Author

tstsrt commented May 6, 2021

I did end up manually transposing the data. I just thought that adding a stride parameter would have a minimal performance impact. However, if this is not the case, I think the library's speed is more valuable than the convenience of having a stride parameter.

@tstsrt tstsrt closed this as completed May 6, 2021
@ejmahler
Copy link
Owner

ejmahler commented May 6, 2021

I do think there is some room in rustFFT for stride, but it would work by copying the data to a contiguous scratch buffer, and then doing the FFT contiguously. This would have the potential for being faster than the standard width -> transpose -> height ->transpose process, since it would be much more cache friendly.

I don't think I'll be able to get to it in the near future, unfortunately.

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

3 participants