-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Implement bluestein algorithm for prime size FFT (Trac #579) #1177
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
Comments
Milestone changed to |
Milestone changed to |
Milestone changed to |
@endolith wrote on 2009-12-01 From #1104: According to http://www.fftw.org/fftw-paper-ieee.pdf FFTW implements Bluestein's algorithm. A python implementation is available at http://www.mail-archive.com/numpy-discussion@scipy.org/msg01812.html Also, here is [http://healpix.jpl.nasa.gov/html/libfftpack/bluestein_8c-source.html Bluestein algorithm] written for a C port of fftpack, [http://healpix.jpl.nasa.gov/html/libfftpack/group__fftgroup.html#_details described here] |
So as I understand it, the Bluestein algorithm was originally developed to do FFTs, and then the concept was expanded into the Chirp Z-transform, and DFT and zoom-FFT are special cases of CZT (CZT does spirals through Z plane, while circles and arcs are subtypes of spiral), so if we have a CZT then this can do the prime FFTs and zoom FFTs. Turns out this has already been submitted to SciPy under public domain by Paul Kienzle and Nadav Horesh: [SciPy-user] Chirp Z transform and it works:
@stefanv said:
The submission probably does belong in scipy.fftpack because it's specialized and has classes to generate functions, etc. But this bug is for numpy, should some variant be included in numpy too, or should it all be in numpy? |
There's also https://github.com/cournape/numpy/compare/bluestein which "is only an implementation optimization to deal with fft size which cannot be factorized in small factors" and doesn't include zoom FFT etc. So pull request that and put the other solution in scipy? |
So I started merging the CZT functions by Paul Kienzle and Nadav Horesh, and modified it to have good accuracy as a prime-length FFT replacement.
The CZT requires pre-computing large chirp signals, though, which means calling it like this isn't as efficient as it could be. Their code has classes that create a function for a specific-length transform so that it can be called repeatedly on multiple arrays of the same length and the chirps are only generated once. Still, the inefficient function version is faster for prime sizes above ~500:
Should a simplified FFT-only version of this be added to NumPy? I think in FFTW they always pre-compute which algorithm will be fastest anyway, before applying it to lots of data? So generating the chirps would be part of that. |
Numpy 1.17 contains an FFT implementation supporting Bluestein's algorithm. |
@mreineck Which pull request is that from? |
It's #11888 |
Cool, one more closed issue :), thanks @mreineck. |
Yes, Bluestein's algorithm is used in all sorts of transforms if they have a length containing too large prime factors. Unfortunately, if Bluestein is used, a real-valued transform has no speed benefit compared to a complex-valued one any more, since the FFTs carried out within Bluestein's algorithm are intrinsically complex-valued, but at least the O(N**2) scaling is avoided. |
Original ticket http://projects.scipy.org/numpy/ticket/579 on 2007-09-14 by @cournape, assigned to unknown.
See #1104 and http://en.wikipedia.org/wiki/Bluestein's_FFT_algorithm
The text was updated successfully, but these errors were encountered: