Hi, in sage 4.0 there's new code to compare subgroups which fixes
problems I had earlier;
http://groups.google.com/group/sage-support/browse_thread/thread/533747d48a1f29eb/958047c513936be1?lnk=gst&q=jerome+Lefebvre#958047c513936be1
Which is totally great.
But, it feels much slower. For example, here is some code that will
generate all subgroups of the symmetric group.
in genSub1 I manually compare all the subgroup generated by comparing
their list of elements. In genSub2, the comparison is done via the new
code. It seems if I'm comparing only a few groups, it's much faster,
but as I'm comparing more and more, things get very slow.
# Here I compare all my groups by comparing their list
def genSub1(n):
G = SymmetricGroup(n)
subgroups = []
J = []
L = G.list()
# Run over all tuples of n/2 elements in the group
# generate subgroups using those tuples
# keep only those that are new
for v in IntegerModRing(G.order())**ceil(n/2):
H = G.subgroup([L[a] for a in v])
if H.list() not in J:
subgroups.append(H)
J.append(H.list())
return subgroups
# Here I compare them using sage built in comparaison
def genSub2(n):
G = SymmetricGroup(n)
subgroups = []
L = G.list()
# Run over all tuples of n/2 elements in the group
# generate subgroups using those tuples
# keep only those that are new
for v in IntegerModRing(G.order())**ceil(n/2):
H = G.subgroup([L[a] for a in v])
if H not in subgroups:
subgroups.append(H)
return subgroups
print "**GEN 1**"
timeit('genSub1(1)')
timeit('genSub1(2)')
timeit('genSub1(3)')
timeit('genSub1(4)',number=1)
print "**GEN 2**"
timeit('genSub2(1)')
timeit('genSub2(2)')
timeit('genSub2(3)')
timeit('genSub2(4)',number=1)
I will then get
**GEN 1**
25 loops, best of 3: 22.9 ms per loop
5 loops, best of 3: 41.4 ms per loop
5 loops, best of 3: 672 ms per loop
1 loops, best of 3: 20.4 s per loop
**GEN 2**
25 loops, best of 3: 11.5 ms per loop
25 loops, best of 3: 29.9 ms per loop
5 loops, best of 3: 1.7 s per loop
1 loops, best of 3: 153 s per loop
Thank you,
Jerome
--~--~---------~--~----~------------~-------~--~----~
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-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---