#13257: Coercion from `ZZ['x']` to `Integers(n)['x']` is VERY slow
----------------------------+-----------------------------------------------
Reporter: jlopez | Owner: robertwb
Type: defect | Status: new
Priority: major | Milestone: sage-5.7
Component: coercion | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: | Stopgaps:
----------------------------+-----------------------------------------------
Comment (by tscrim):
The main problem is in compiled files (which is why `%prun` doesn't see
it). In particular `polynomial_modz_flint.pyx` `_element_constructor_`
calls `Polynomial_template`'s `__init__()` which converts `a` into a list
of coefficients, which then reconstructs the polynomial by adding
individual monomials together.
Where the time is taken is each time a monomial is added, a new polynomial
is created. A partial solution is to convert polynomial inputs in
`_element_consturctor_` to a list and do that (this runs fast because it
just does the coefficient coercion and sets the coefficient list of the
new polynomial). I haven't looked too deeply into a general solution yet
(I don't quite know if this is the only case where this slowdown occurs),
but I would suspect one exists.
Best,[[BR]]
Travis
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13257#comment:4>
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.