Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplifications in some libgap calls #38660

Merged
merged 1 commit into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/sage/algebras/quantum_groups/quantum_group_gap.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ def counit(self, elt):
constant = R(str(ext_rep.pop(2 * i))) # Pop the coefficient
break
# To reconstruct, we need the following
F = libgap.eval('ElementsFamily')(libgap.eval('FamilyObj')(self._libgap))
F = self._libgap.FamilyObj().ElementsFamily()
elt = F.ObjByExtRep(ext_rep)
co = self._libgap.CounitMap()
return R(str(co(elt))) + constant
Expand Down Expand Up @@ -2330,7 +2330,7 @@ def _construct_monomial(self, k):
sage: B._construct_monomial((3,0,1))
F[a1]^(3)*F[a2]
"""
F = libgap.eval('ElementsFamily')(libgap.eval('FamilyObj')(self._libgap))
F = self._libgap.FamilyObj().ElementsFamily()
one = self._libgap_base.One()
data = []
for i, val in enumerate(k):
Expand Down Expand Up @@ -2684,7 +2684,7 @@ def _unpickle_generic_element(parent, data):
sage: loads(dumps(x)) == x # indirect doctest
True
"""
F = libgap.eval('ElementsFamily')(libgap.eval('FamilyObj')(parent._libgap))
F = parent._libgap.FamilyObj().ElementsFamily()
ret = []
# We need to multiply by this to get the right type in GAP
one = parent._libgap_base.One()
Expand Down
33 changes: 17 additions & 16 deletions src/sage/groups/perm_gps/permgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2974,20 +2974,21 @@ def semidirect_product(self, N, mapping, check=True):
raise ValueError(msg)

# create a parallel list of the automorphisms of N in GAP
libgap.eval('N := Group({})'.format(list(N.gens())))
gens_string = ",".join(str(x) for x in N.gens())
homomorphism_cmd = 'alpha := GroupHomomorphismByImages(N, N, [{0}],[{1}])'
libgap.eval('morphisms := []')
N_gap = libgap.eval(f'Group({list(N.gens())})')
morphisms = libgap.eval('[]')
libgap_gens = N_gap.GeneratorsOfGroup()
for alpha in mapping[1]:
images_string = ",".join(str(alpha(n)) for n in N.gens())
libgap.eval(homomorphism_cmd.format(gens_string, images_string))
libgap.eval('Add(morphisms, alpha)')
images = [alpha(g) for g in N.gens()]
alpha_gap = N_gap.GroupHomomorphismByImages(N_gap,
libgap_gens, images)
morphisms.Add(alpha_gap)
# create the necessary homomorphism from self into the
# automorphism group of N in GAP
libgap.eval('H := Group({0})'.format(mapping[0]))
libgap.eval('phi := GroupHomomorphismByImages(H, AutomorphismGroup(N),{},morphisms)'.format(mapping[0]))
libgap.eval('sdp := SemidirectProduct(H, phi, N)')
return PermutationGroup(gap_group='sdp')
H = libgap.eval(f'Group({mapping[0]})')
phi = H.GroupHomomorphismByImages(N_gap.AutomorphismGroup(),
H.GeneratorsOfGroup(), morphisms)
sdp = H.SemidirectProduct(phi, N_gap)
return PermutationGroup(gap_group=sdp)

def holomorph(self):
r"""
Expand Down Expand Up @@ -3047,11 +3048,11 @@ def holomorph(self):

- Kevin Halasz (2012-08-14)
"""
libgap.eval('G := Group({})'.format(list(self.gens())))
libgap.eval('aut := AutomorphismGroup(G)')
libgap.eval('alpha := InverseGeneralMapping(NiceMonomorphism(aut))')
libgap.eval('product := SemidirectProduct(NiceObject(aut),alpha,G)')
return PermutationGroup(gap_group='product')
G = libgap.eval(f'Group({list(self.gens())})')
aut = G.AutomorphismGroup()
alpha = aut.NiceMonomorphism().InverseGeneralMapping()
product = aut.NiceObject().SemidirectProduct(alpha, G)
return PermutationGroup(gap_group=product)

def subgroup(self, gens=None, gap_group=None, domain=None, category=None, canonicalize=True, check=True):
"""
Expand Down
Loading