-
-
Notifications
You must be signed in to change notification settings - Fork 517
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
Implement Field._gcd_univariate_polynomial() #18461
Comments
This comment has been minimized.
This comment has been minimized.
Commit: |
comment:3
This looks good to me. Yet, I have not been able to reproduce the slowdown you mention without the new method: May you give some details? |
comment:4
I just tested again with the following setup:
With this branch (i.e. with
With this branch after removing
I don't have an explanation for the discrepancy between the slowest and fastest runs; as far as I know there is no caching. For complicated polynomials, the difference is undoubtedly smaller because most time is spent in |
Reviewer: Bruno Grenet |
comment:5
Ok, I reproduced the same slowdown if |
Changed branch from u/pbruin/18461-Field_gcd_univariate_polynomial to |
The goal of this ticket is to implement a Cython method
Field._gcd_univariate_polynomial()
using the standard Euclidean algorithm. This is much faster thanFields.ParentMethods._gcd_univariate_polynomial()
, which callsEuclideanDomains.ElementMethods.gcd()
, since both are Python methods. (The_gcd_univariate_polynomial
mechanism was introduced in #13442.)The following bug can then be fixed by just removing
PolynomialRealDense.gcd()
, which does not take into account the case where one of the arguments ofgcd
is zero:Removing this method without implementing
Field._gcd_univariate_polynomial()
(falling back on Python code) is about twice as slow; with this ticket there is no slowdown.Similarly, to make
CC
andQQbar
use the new method instead of Python code, we also remove the now obsoletePolynomial_generic_field.gcd()
.CC: @saraedum
Component: basic arithmetic
Keywords: polynomial gcd
Author: Peter Bruin
Branch/Commit:
908ace7
Reviewer: Bruno Grenet
Issue created by migration from https://trac.sagemath.org/ticket/18461
The text was updated successfully, but these errors were encountered: