You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current polynomial multiplication has a runtime of O(n^2). This is fine for some cases (especially lower degree polynomials), but is suboptimal, as it is relatively easy to reduce the runtime using a Fast Fourier Transformation to O(n log n). This would be a considerable speedup for higher degree polynomials.
I think it would be best to perhaps use the currrent algorithm for polynomials of low degree, as it is undoubtedly faster for these kinds, but for higher degree polynomials switch to the more complex, but asymptotically faster FFT. The switching point should of course be determined by the implementation details.
If this is something worth considering, I think there would be three ways to go about using this method:
Use an existing FFT crate which is significantly faster than what would be used in this crate, which in turn significantly improve the runtime of many things using polynomials.
Create a custom implementation of the FFT algorithm. This would mean that the crate has less dependencies, and would therefore be more portable.
You could also possibly use a feature flag to indicate use of an external FFT library, which would include the best of both worlds: It would allow for people who need an efficient implementation to use the external library for the multiplication, and those who care more about portability to use the slower version.
If you think that the second option sounds appealing, I would be willing to write an implementation of the algorithm.
The text was updated successfully, but these errors were encountered:
@jonasvanderschaaf Thanks for great suggestion!
I did not consider an effective algorithm for polynomial multiplication. Thank you again for your good point.
I think the second idea is really attractive if possible. If you implement such an algorithm, than I'll definitely merge it with the next version.
To implement a Fast Fourier Transform, I would need to have access to some implementation of complex numbers. This would probably mean that the addition of this feature would have to be moved to version 0.31, as #35 (complex number support) is also scheduled for this version.
The current polynomial multiplication has a runtime of O(n^2). This is fine for some cases (especially lower degree polynomials), but is suboptimal, as it is relatively easy to reduce the runtime using a Fast Fourier Transformation to O(n log n). This would be a considerable speedup for higher degree polynomials.
I think it would be best to perhaps use the currrent algorithm for polynomials of low degree, as it is undoubtedly faster for these kinds, but for higher degree polynomials switch to the more complex, but asymptotically faster FFT. The switching point should of course be determined by the implementation details.
If this is something worth considering, I think there would be three ways to go about using this method:
If you think that the second option sounds appealing, I would be willing to write an implementation of the algorithm.
The text was updated successfully, but these errors were encountered: