46
46
fix_exponent_re = re .compile (r"\^(-\d+|\d\d+)" )
47
47
perm_re = re .compile (r"^\(\d+(,\d+)*\)(,?\(\d+(,\d+)*\))*$" )
48
48
49
+
49
50
def label_sortkey (label ):
50
51
L = []
51
52
for piece in label .split ("." ):
@@ -58,12 +59,15 @@ def label_sortkey(label):
58
59
L .append (x )
59
60
return L
60
61
62
+
61
63
def is_atomic (s ):
62
64
return not any (sym in s for sym in ["." , ":" , r"\times" , r"\rtimes" , r"\wr" ])
63
65
66
+
64
67
def sub_paren (s ):
65
68
return s if is_atomic (s ) else "(%s)" % s
66
69
70
+
67
71
def group_names_pretty (label ):
68
72
# Avoid using this function if you have the tex_name available without a database lookup
69
73
if isinstance (label , str ):
@@ -85,6 +89,7 @@ def group_names_pretty(label):
85
89
else :
86
90
return label
87
91
92
+
88
93
def group_pretty_image (label ):
89
94
# Avoid using this function if you have the tex_name available without a database lookup
90
95
pretty = group_names_pretty (label )
@@ -97,15 +102,18 @@ def group_pretty_image(label):
97
102
return str (img )
98
103
# we should not get here
99
104
105
+
100
106
def create_gens_list (genslist ):
101
107
# For Magma
102
108
gens_list = [f"G.{ i } " for i in genslist ]
103
109
return str (gens_list ).replace ("'" , "" )
104
110
111
+
105
112
def create_gap_assignment (genslist ):
106
113
# For GAP
107
114
return " " .join (f"{ var_name (j )} := G.{ i } ;" for j , i in enumerate (genslist ))
108
115
116
+
109
117
def create_magma_assignment (G ):
110
118
used = [u - 1 for u in sorted (G .gens_used )]
111
119
rel_ords = [ZZ (p ) for p in G .PCG .FamilyPcgs ().RelativeOrders ()]
@@ -126,36 +134,38 @@ def create_magma_assignment(G):
126
134
power *= rel_ords [i0 ]
127
135
return str (names ).replace ("'" , '"' )
128
136
129
- def split_matrix_list (longList ,d ):
137
+
138
+ def split_matrix_list (longList , d ):
130
139
# for code snippets, turns d^2 list into d lists of length d for Gap matrices
131
- return [longList [i :i + d ] for i in range (0 ,d ** 2 ,d )]
140
+ return [longList [i :i + d ] for i in range (0 , d ** 2 , d )]
141
+
132
142
133
- def split_matrix_list_ZN (longList ,d , Znfld ):
143
+ def split_matrix_list_ZN (longList , d , Znfld ):
134
144
longList = [f"ZmodnZObj({ x } ,{ Znfld } )" for x in longList ]
135
- return str ([longList [i :i + d ] for i in range (0 ,d ** 2 ,d )]).replace ("'" , "" )
145
+ return str ([longList [i :i + d ] for i in range (0 , d ** 2 , d )]).replace ("'" , "" )
136
146
137
147
138
- def split_matrix_list_Fp (longList ,d , e ):
139
- return [longList [i :i + d ]* e for i in range (0 ,d ** 2 ,d )]
148
+ def split_matrix_list_Fp (longList , d , e ):
149
+ return [longList [i :i + d ]* e for i in range (0 , d ** 2 , d )]
140
150
141
151
142
- def split_matrix_list_Fq (longList ,d , Fqfld ):
152
+ def split_matrix_list_Fq (longList , d , Fqfld ):
143
153
# for gap definition of Fq
144
154
longList = [f"0*Z({ Fqfld } )" if x == - 1 else f"Z({ Fqfld } )^{ x } " for x in longList ] #-1 distinguishes 0 from z^0
145
- return str ([longList [i :i + d ] for i in range (0 ,d ** 2 ,d )]).replace ("'" , "" )
155
+ return str ([longList [i :i + d ] for i in range (0 , d ** 2 , d )]).replace ("'" , "" )
146
156
147
157
148
- def split_matrix_Fq_add_al (longList ,d ):
158
+ def split_matrix_Fq_add_al (longList , d ):
149
159
# for magma definition of Fq
150
160
longList = [0 if x == - 1 else 1 if x == 0 else f"al^{ x } " for x in longList ]
151
- return str ([longList [i :i + d ] for i in range (0 ,d ** 2 ,d )]).replace ("'" , "" )
161
+ return str ([longList [i :i + d ] for i in range (0 , d ** 2 , d )]).replace ("'" , "" )
152
162
153
163
154
164
# Functions below are for conjugacy class searches
155
165
def gp_label_to_cc_data (gp ):
156
166
gp_ord , gp_counter = gp .split ("." )
157
167
gp_order = int (gp_ord )
158
- if re .fullmatch (r'\d+' ,gp_counter ):
168
+ if re .fullmatch (r'\d+' , gp_counter ):
159
169
return gp_order , int (gp_counter )
160
170
return gp_order , class_to_int (gp_counter ) + 1
161
171
@@ -1918,7 +1928,6 @@ def _matrix_coefficient_data(self, rep_type, as_str=False):
1918
1928
R = rf"\F_{{{ q } }}"
1919
1929
else :
1920
1930
R = GF (q , modulus = "primitive" , names = ('a' ,))
1921
- (a ,) = R ._first_ngens (1 )
1922
1931
N , k = q .is_prime_power (get_data = True )
1923
1932
if k == 1 :
1924
1933
# Might happen for Lie
@@ -1942,7 +1951,7 @@ def decode_as_matrix(self, code, rep_type, as_str=False, LieType=False, ListForm
1942
1951
if rep_type == "GLFq" :
1943
1952
q = N ** k
1944
1953
R = GF (q , modulus = "primitive" , names = ('a' ,))
1945
- ( a ,) = R ._first_ngens ( 1 ) # need a for powers
1954
+ a = R .gen () # need a for powers
1946
1955
L = ZZ (code ).digits (N )
1947
1956
1948
1957
def pad (X , m ):
0 commit comments