Skip to content

Commit

Permalink
Merge pull request LMFDB#6028 from jwj61/cycletypes
Browse files Browse the repository at this point in the history
Write cycle types with multiplicity
  • Loading branch information
roed314 committed May 7, 2024
2 parents 734a3f5 + a80c2bc commit c1ed9be
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lmfdb/galois_groups/transitive_group.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import re
from collections import defaultdict
from collections import defaultdict, Counter

from lmfdb import db

Expand Down Expand Up @@ -69,6 +69,9 @@ def cyclestrings(perm):
a = ['('+','.join([str(u) for u in v])+')' for v in perm]
return ''.join(a)

def compress_cycle_type(ct):
bits = [(str(z), f'^{{{c}}}' if c>1 else '' ) for z, c in sorted(Counter(ct).items(),reverse=True)]
return ','.join(z + e for z,e in bits)
############ Galois group object


Expand Down Expand Up @@ -188,7 +191,6 @@ def characters(self):
def conjclasses(self):
g = self.gapgroupnt()
n = self.n()
gap.set('cycletype', 'function(el, n) local ct; ct := CycleLengths(el, [1..n]); ct := ShallowCopy(ct); Sort(ct); ct := Reversed(ct); return(ct); end;')
wag = self.wag
self.conjugacy_classes = wag.conjugacy_classes
if int(n) == 1:
Expand All @@ -202,19 +204,17 @@ def conjclasses(self):
for j in range(len(self.conjugacy_classes)):
self.conjugacy_classes[j].force_repr(str(cc[j]))
ccn = [z.size for z in self.conjugacy_classes]
cc2 = [gap("cycletype("+str(x)+","+str(n)+")") for x in cc]
cc2 = [gap(f"CycleLengths({x}, [1..{n}])") for x in cc]
cclabels = [z.label for z in self.conjugacy_classes]
else:
cc = g.ConjugacyClasses()
ccn = [x.Size() for x in cc]
cclabels = ['' for z in cc]
cc = [x.Representative() for x in cc]
cc2 = [x.cycletype(n) for x in cc]
cc2 = [gap(f"CycleLengths({x}, [1..{n}])") for x in cc]
for j in range(len(self.conjugacy_classes)):
self.conjugacy_classes[j].force_repr(' ')
cc2 = [str(x) for x in cc2]
cc2 = [re.sub(r"\[", '', x) for x in cc2]
cc2 = [re.sub(r"\]", '', x) for x in cc2]
cc2 = [compress_cycle_type(z) for z in cc2]
ans = [[cc[j], cc[j].Order(), ccn[j], cc2[j],cclabels[j]] for j in range(len(cc))]
return ans

Expand Down

0 comments on commit c1ed9be

Please sign in to comment.