#13257: Coercion from `ZZ['x']` to `Integers(n)['x']` is VERY slow
------------------------------------+---------------------------------------
Reporter: jlopez | Owner: robertwb
Type: defect | Status: needs_review
Priority: major | Milestone: sage-5.7
Component: coercion | Resolution:
Keywords: days45 | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Travis Scrimshaw | Merged in:
Dependencies: | Stopgaps:
------------------------------------+---------------------------------------
Changes (by tscrim):
* keywords: => days45
* status: needs_work => needs_review
Comment:
I've changed the fix to have `Polynomial_template` just convert the input
polynomial into a list of coefficients and then pass that list back as a
corresponding call the the ''original'' class's `__init__()` (rather than
back to `Polynomial_template`) to take advantage of the specific
implementations. This doesn't work quite as well for `GF2`, but that was
significantly faster before anyways.
My timings with the patch:
{{{
sage: a = ZZ['x'](range(100000))
sage: R = Integers(3)['x']
sage: %time L = R(a)
CPU times: user 0.22 s, sys: 0.05 s, total: 0.26 s
Wall time: 0.35 s
sage: type(L)
sage.rings.polynomial.polynomial_zmod_flint.Polynomial_zmod_flint
sage: S = GF(3)['x']
sage: %time L = S(a)
CPU times: user 0.22 s, sys: 0.00 s, total: 0.22 s
Wall time: 0.26 s
sage: type(L)
sage.rings.polynomial.polynomial_zmod_flint.Polynomial_zmod_flint
sage: T = GF(2)['x'] % different because it uses NTL
CPU times: user 1.40 s, sys: 0.00 s, total: 1.40 s
Wall time: 1.50 s
sage: %time L = T(list(a))
CPU times: user 1.06 s, sys: 0.00 s, total: 1.06 s
Wall time: 1.16 s
sage: type(L)
sage.rings.polynomial.polynomial_gf2x.Polynomial_GF2X
}}}
Ready for review again.
Thanks,[[BR]]
Travis
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13257#comment:8>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.