#10184: class group iterator is too slow
-----------------------------+----------------------------------------------
Reporter: thome | Owner: davidloeffler
Type: enhancement | Status: new
Priority: minor | Milestone:
Component: number fields | Keywords:
Author: | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
-----------------------------+----------------------------------------------
the class group iterator takes evey element in turn, and computes the
product of the g^i's. Sure powers are computed by repeated squaring, but
for iterators this is suboptimal.
On my laptop, from this situation...
{{{
sage: K.<v>=NumberField(x^4 + 514*x^2 + 64321)
sage: OK=K.maximal_order()
sage: G=K.class_group()
sage: time _=G.list()
CPU times: user 2.48 s, sys: 0.05 s, total: 2.53 s
Wall time: 2.53 s
}}}
the attached patch improves to...
{{{
sage: K.<v>=NumberField(x^4 + 514*x^2 + 64321)
sage: OK=K.maximal_order()
sage: G=K.class_group()
sage: time _=G.list()
CPU times: user 0.45 s, sys: 0.00 s, total: 0.45 s
Wall time: 0.44 s
}}}
which is a tad better.
doctest included (actually the previous doctest wasn't doing much, this
one is slightly more thorough).
Note: while the code would work for any abelian group, I believe it makes
sense only when the group operation is sufficiently non-trivial.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10184>
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.