From 9d47dfbe9cea17eb2f8a36d57c6abb66932987de Mon Sep 17 00:00:00 2001 From: David Roe Date: Mon, 19 Aug 2024 02:27:31 -0400 Subject: [PATCH] Use libgap for Galois groups, fix some latex errors --- lmfdb/galois_groups/main.py | 4 ++-- lmfdb/galois_groups/transitive_group.py | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lmfdb/galois_groups/main.py b/lmfdb/galois_groups/main.py index d25ad15444..ea5376bb52 100644 --- a/lmfdb/galois_groups/main.py +++ b/lmfdb/galois_groups/main.py @@ -4,7 +4,7 @@ import re from flask import abort, render_template, request, url_for, redirect, make_response -from sage.all import ZZ, latex, gap +from sage.all import ZZ, latex, libgap from lmfdb import db from lmfdb.app import app @@ -30,7 +30,7 @@ # logger = make_logger("GG") try: - G = gap.TransitiveGroup(9, 2) + G = libgap.TransitiveGroup(9, 2) except Exception: logger.fatal("It looks like the SPKGes gap_packages and database_gap are not installed on the server. Please install them via 'sage -i ...' and try again.") diff --git a/lmfdb/galois_groups/transitive_group.py b/lmfdb/galois_groups/transitive_group.py index d7a84e8f1e..cb6591cc07 100644 --- a/lmfdb/galois_groups/transitive_group.py +++ b/lmfdb/galois_groups/transitive_group.py @@ -3,7 +3,7 @@ from lmfdb import db -from sage.all import ZZ, gap, cached_function, lazy_attribute, Permutations, QQ +from sage.all import ZZ, libgap, cached_function, lazy_attribute, Permutations, QQ, SymmetricGroup import os import yaml from flask import render_template @@ -154,9 +154,10 @@ def generator_string(self): def gapgroupnt(self): if int(self.n()) == 1: - G = gap.SmallGroup(1, 1) + G = libgap.SmallGroup(1, 1) else: - G = gap('Group(['+self.generator_string()+'])') + gens = [SymmetricGroup(self.n())([tuple(cyc) for cyc in g]) for g in self.gens()] + G = libgap.Group([g._libgap_() for g in gens]) return G def num_conjclasses(self): @@ -176,7 +177,7 @@ def getisom(self): # assumes isomorphism is in _data wag = self.wag imgs = [Permutations(self.n()).unrank(z) for z in self._data['isomorphism']] - imgs = [gap("PermList(%s)"%str(z)) for z in imgs] + imgs = [libgap.PermList(z) for z in imgs] return wag.G.GroupHomomorphismByImagesNC(self.gapgroupnt(), wag.G_gens(), imgs) @lazy_attribute @@ -204,16 +205,15 @@ 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(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 = [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 = [libgap.CycleLengths(x, list(range(1,n+1))) for x in cc] inds = [n-len(z) for z in cc2] cc2 = [compress_cycle_type(z) for z in cc2] ans = [[cc[j], cc[j].Order(), ccn[j], cc2[j],cclabels[j],inds[j]] for j in range(len(cc))] @@ -605,10 +605,10 @@ def cclasses(n, t): """ cc = group.conjclasses for c in cc: - html += '' + str(c[3]) + '' - html += '' + str(c[2]) + '' - html += '' + str(c[1]) + '' - html += '' + str(c[0]) + '' + html += f'${c[3]}$' + html += f'${c[2]}$' + html += f'${c[1]}$' + html += f'${c[0]}$' html += """ """