#6812: Enumerate integer vectors modulo to the action of a Permutation Group
------------------------------------------------------------------+---------
Reporter: nborie |
Owner: nborie
Type: enhancement |
Status: needs_review
Priority: major |
Milestone: sage-5.1
Component: combinatorics |
Resolution:
Keywords: enumeration, integer, list, permutation, group | Work
issues: long time tests, information about listing infinite sets
Report Upstream: N/A |
Reviewers: Karl-Dieter Crisman, Simon King
Authors: Nicolas Borie | Merged
in:
Dependencies: |
Stopgaps:
------------------------------------------------------------------+---------
Comment (by SimonKing):
For example:
{{{
sage: cython("""
....: def test1(list L1, list L2, int step):
....: cdef int i
....: for i in range(step):
....: if L1[i]>L2[i]:
....: return 1
....: if L1[i]<L2[i]:
....: return -1
....: return 0
....: def test2(list L1, list L2, int step):
....: cdef int i
....: for i in range(step):
....: if L1[i]!=L2[i]:
....: break
....: if i<step:
....: if L1[i]<L2[i]:
....: return -1
....: if L1[i]>L2[i]:
....: return 1
....: return 0
....: """)
sage: L1 = [1]*10+[1,2,3,4,5]
sage: L2 = [1]*10+[5,4,3,2,1,0]
sage: test1(L1,L2,9)
0
sage: test2(L1,L2,9)
0
sage: test1(L1,L2,14)
-1
sage: test2(L1,L2,14)
-1
sage: test1(L2,L1,14)
1
sage: test2(L2,L1,14)
1
sage: %timeit test1(L1,L2,14)
625 loops, best of 3: 1.41 µs per loop
sage: %timeit test2(L1,L2,14)
625 loops, best of 3: 872 ns per loop
sage: %timeit test1(L2,L1,14)
625 loops, best of 3: 1.22 µs per loop
sage: %timeit test2(L2,L1,14)
625 loops, best of 3: 976 ns per loop
sage: %timeit test1(L1,L2,10)
625 loops, best of 3: 1.17 µs per loop
sage: %timeit test2(L1,L2,10)
625 loops, best of 3: 872 ns per loop
}}}
So, it seems to make a small but noticeable difference.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6812#comment:74>
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.