#11684: Obtaining coefficients of polynomials over finite fields is extremely
slow
---------------------------+------------------------------------------------
Reporter: johanbosman | Owner: tbd
Type: defect | Status: needs_review
Priority: major | Milestone: sage-4.7.2
Component: performance | Keywords: polynomials, finite fields
Work_issues: | Upstream: N/A
Reviewer: | Author: Johan Bosman
Merged: | Dependencies: #11685
---------------------------+------------------------------------------------
Comment(by SimonKing):
The code of `list()` currently does `[self[i] for i in
range(celement_len(&self.x, _parent))]`. You improved the `__getitem__`
method.
But still, calling the `__getitem__` method over and over again seems to
create a lot of overhead. I am sure that NTL provides a method that
returns the list of coefficients. So, why not use that instead?
And if that is impossible, note that most lines of `__getitem__` are
concerned with preparatory steps, namely:
{{{
cdef ZZ_pE_c c_pE
cdef cparent _parent
_parent = get_cparent(self._parent)
_parent[0].restore()
c_pE = ZZ_pEX_coeff(self.x, i)
K = self._parent.base_ring()
}}}
I am pretty sure that it is possible to do these preparatory steps only
''once''. Hence, I suggest to be a bit more "explicit" in the `list()`
method, rather than calling `self[i]`.
Of course, in addition to that, one should also keep your improvement of
`__getitem__`.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11684#comment:2>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.