#20561: Return cycle type of a permutation
-------------------------------------+-------------------------------------
Reporter: andrew.mathas | Owner:
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-7.2
Component: group theory | Resolution:
Keywords: permutation, | Merged in:
cycle type | Reviewers:
Authors: Andrew Mathas | Work issues:
Report Upstream: N/A | Commit:
Branch: | b9acb7729e678ee46ef6db66a694c3040db830d0
u/andrew.mathas/return_cycle_type_of_a_permutation| Stopgaps:
Dependencies: |
-------------------------------------+-------------------------------------
Comment (by vdelecroix):
On a random example '''all''' the time is taken by actually constructing
the partition.
{{{
sage: S = SymmetricGroup(20)
sage: S.random
S.random_element S.random_element_of_length
sage: p = S.random_element()
sage: %timeit c = p.cycle_tuples()
1000000 loops, best of 3: 1.04 µs per loop
sage: c = p.cycle_tuples()
sage: %timeit l = map(len, c)
1000000 loops, best of 3: 382 ns per loop
sage: l = map(len, c)
sage: %timeit ls = sorted(l, reverse=True)
1000000 loops, best of 3: 889 ns per loop
sage: ls = sorted(l, reverse=True)
sage: %timeit p = Partition(ls)
10000 loops, best of 3: 14.5 µs per loop
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/20561#comment:9>
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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.