-
Notifications
You must be signed in to change notification settings - Fork 47
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
Example of multidimensional transform? #85
Comments
Your solution is not far off, you "just" need to transpose the data between the FFT steps so that each FFT runs along the correct axis. But have you looked at ndrustfft? I haven't tried it but looks like it should be able to do what you need. |
I see, I'll "just" do that if I can. 😆 Thanks. 🙂 I did look at ndrustfft, but I wanted to avoid the dependency on ndarray. Last time I tried ndarray, it was quite slow. Although that was years ago, it looks like they've been iterating, so I guess that could also be worth trying once more. |
Yeah there is quite a lot hidden in that "just" 😆 |
I can't remember anymore, this was quite some time ago when I was messing around with some ML stuff in Rust. ndrustfft itself doesn't quite have just a "xd_transform" function, but they did have examples showing how to do it, so I ended up using that. (Although I haven't benchmarked it yet because there's a bug somewhere else in my code 🙂 ) The data I'm working with can be several MB but the transforms are in 16x16x3 chunks, so not terribly large and easily doable in cache. |
I think RustFFT would benefit from something built in that does this. It seems like a common request, and easy enough to get wrong that people would benefit from a central utility. I unfortunately don't have a lot of motivation for side projects right now, but if someone else makes a PR for a n-d FFT, tests it, etc I'd be happy to accept. |
Hi, author of ndrustfft here; I crossed this issue by chance. The topic seems to be quite important because of its relevance to image processing and numerical computation, so I decided to do some tests. Assuming we have a two-dimensional array of size n x n, the two approaches are: "transpose"
The transpose is done out of place, hopefully effciently with transposes very similar to "ndrustfft"
The code can be found here: Here is a performance comparison (time in ms): FFT along outer axis (transpose is not necessary)
FFT along inner axis (transpose is necessary)
So I think the transpose-based approach is promising. The advantages are I don't know how much time I have to pursue this topic further, but I hope this has given a little insight. |
hey I wasn't sure if I should post here or on #90 . Are you open to PRs for this? What are the constraints? I was thinking about doing something similar to how burn handles multiple tensor implementations: providing a trait that could be implemented on matrix/tensor types |
Hi, I have a case where I need to implement a 3D FFT. This crate doesn't seem to have an existing utility function for it. I figured I could potentially create my own by combining multiple 1D FFTs, but it seems to have resulted in garbage output. Could an example be added to the repository of how to do a multidimensional transform correctly with this crate? (Even better would be if there were wrapper functions provided by the crate.)
My current attempt looks like this:
The text was updated successfully, but these errors were encountered: