#7415: improve cycle decomposition
-----------------------------+----------------------------------------------
Reporter: ylchapuy | Owner: mhansen
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-combinat
Component: combinatorics | Keywords: permutation
Work_issues: | Author: Yann Laigle-Chapuy
Reviewer: | Merged:
-----------------------------+----------------------------------------------
Changes (by ylchapuy):
* status: new => needs_review
Comment:
For the record,
before:
{{{
sage: p= Permutations(1000)[1234567123413251514514513541]
sage: timeit('p.to_cycles()')
125 loops, best of 3: 5.27 ms per loop
sage: timeit('p.to_cycles(singletons=False)')
125 loops, best of 3: 4.37 ms per loop
sage: p= Permutations(1000).random_element()
sage: timeit('p.to_cycles()')
5 loops, best of 3: 440 ms per loop
sage: timeit('p.to_cycles(singletons=False)')
5 loops, best of 3: 441 ms per loop
}}}
after:
{{{
sage: p= Permutations(1000)[1234567123413251514514513541]
sage: timeit('p.to_cycles()')
125 loops, best of 3: 4.68 ms per loop
sage: timeit('p.to_cycles(singletons=False)')
125 loops, best of 3: 2.35 ms per loop
sage: p= Permutations(1000).random_element()
sage: timeit('p.to_cycles()')
25 loops, best of 3: 21.1 ms per loop
sage: timeit('p.to_cycles(singletons=False)')
25 loops, best of 3: 23.3 ms per loop
}}}
it can be slightly slower for small permutations with `singletons=False`
(because of the way we construct L), but I think it's worth it.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7415#comment:1>
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
-~----------~----~----~----~------~----~------~--~---