-
-
Notifications
You must be signed in to change notification settings - Fork 656
Closed
Milestone
Description
This seems to be part of what's going wrong in #33156:
sage: R.<x> = GF(31337)[]
sage: f = R.random_element(degree=999)
sage: g = R.random_element(degree=9999)
sage: S.<y> = R.quotient(f)
sage: %timeit g(y)
188 ms ± 1.74 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
sage: %timeit (g%f)(y)
16.4 ms ± 31 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
sage: %timeit S(g%f)
2.97 ms ± 185 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
This patch adds an optimized code path for evaluation at generators of (quotients of) polynomial rings isomorphic to the polynomial's parent. With the new code, g(y)
is about as fast as S(g)
.
The following cases are handled: {univariate polynomial rings, multivariate polynomial rings, quotients of univariate polynomial rings} over the same base.
We also speed up evaluation at monomials in another polynomial ring in a similar way.
Component: algebra
Author: Lorenz Panny, Marc Mezzarobba, Travis Scrimshaw
Branch/Commit: 9a6e4b2
Reviewer: Marc Mezzarobba, Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/33165