Skip to content

Commit

Permalink
Add generators for GAP
Browse files Browse the repository at this point in the history
  • Loading branch information
roed314 committed Jun 22, 2024
1 parent 2800d4a commit 84175ae
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
4 changes: 2 additions & 2 deletions lmfdb/groups/abstract/code.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ not-implemented:
magma: |
// (not yet implemented)
gap: |
\\\\ (not yet implemented)
# (not yet implemented)
presentation:
comment: Define the group with the given generators and relations
magma: G := PCGroup({pccodelist}); {gens} := Explode({used_gens});
gap: G := PcGroupCode({pccode},{ordgp});
gap: G := PcGroupCode({pccode},{ordgp}); gens := GeneratorsOfGroup(G); {gens_assign}


permutation:
Expand Down
30 changes: 17 additions & 13 deletions lmfdb/groups/abstract/web_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,13 @@ def group_pretty_image(label):
# we should not get here

def create_gens_list(genslist):
used_gens = "["
for i in genslist:
used_gens = used_gens + "G." + str(i) + ","
used_gens = used_gens[:-1] + "]"
return used_gens
# For Magma
gens_list = [f"G.{i}" for i in genslist]
return str(gens_list).replace("'", "")

def create_gens_assignment(genslist):
# For GAP; gens := GeneratorsOfGroup(G); has already been included
return " ".join(f"{var_name(j)} := gens[{i}];" for j, i in enumerate(genslist))

def split_matrix_list(longList,d):
# for code snippets, turns d^2 list into d lists of length d for Gap matrices
Expand Down Expand Up @@ -2635,13 +2637,14 @@ def code_snippets(self):
code = yaml.load(open(os.path.join(_curdir, "code.yaml")), Loader=yaml.FullLoader)
code['show'] = { lang:'' for lang in code['prompt'] }
if "PC" in self.representations:
gens = self.presentation_raw(as_str = False)
gens = self.presentation_raw(as_str=False)
pccodelist = self.representations["PC"]["pres"]
pccode = self.representations["PC"]["code"]
ordgp = self.order
used_gens = create_gens_list(self.representations["PC"]["gens"])
gens_assign = create_gens_assignment(self.representations["PC"]["gens"])
else:
gens, pccodelist, pccode, ordgp, used_gens = None, None, None, None, None
gens, pccodelist, pccode, ordgp, used_gens, gens_assign = None, None, None, None, None, None
if "Perm" in self.representations:
rdata = self.representations["Perm"]
perms = ", ".join(self.decode_as_perm(g, as_str=True) for g in rdata["gens"])
Expand Down Expand Up @@ -2687,12 +2690,13 @@ def code_snippets(self):
# nFq, Fq, LFq, LFqsplit = None, None, None, None

data = {'gens' : gens, 'pccodelist': pccodelist, 'pccode': pccode,
'ordgp': ordgp, 'used_gens' : used_gens, 'deg' : deg, 'perms' : perms,
'nZ' : nZ, 'nFp' : nFp, 'nZN' : nZN, 'nZq': nZq, #'nFq' : nFq,
'Fp' : Fp, 'N' : N, 'Zq' : Zq, #'Fq' : Fq,
'LZ' : LZ, 'LFp': LFp, 'LZN' : LZN, 'LZq' : LZq, #'LFq': LFq,
'LZsplit' : LZsplit, 'LZNsplit' : LZNsplit, 'LZqsplit' :LZqsplit,
# 'LFpsplit' : LFpsplit, 'LFqsplit' : LFqsplit, # add for GLFq GAP
'ordgp': ordgp, 'used_gens': used_gens, 'gens_assign': gens_assign,
'deg': deg, 'perms' : perms,
'nZ': nZ, 'nFp': nFp, 'nZN': nZN, 'nZq': nZq, #'nFq': nFq,
'Fp': Fp, 'N': N, 'Zq': Zq, #'Fq': Fq,
'LZ': LZ, 'LFp': LFp, 'LZN': LZN, 'LZq': LZq, #'LFq': LFq,
'LZsplit': LZsplit, 'LZNsplit': LZNsplit, 'LZqsplit': LZqsplit,
# 'LFpsplit': LFpsplit, 'LFqsplit': LFqsplit, # add for GLFq GAP
}
for prop in code:
for lang in code['prompt']:
Expand Down

0 comments on commit 84175ae

Please sign in to comment.