Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
use the change from #31489
Browse files Browse the repository at this point in the history
  • Loading branch information
dimpase committed Jun 2, 2021
1 parent 7ee7b58 commit 101bd74
Showing 1 changed file with 63 additions and 7 deletions.
70 changes: 63 additions & 7 deletions src/sage/groups/abelian_gps/abelian_group_gap.py
Expand Up @@ -364,11 +364,10 @@ def _element_constructor_(self, x, check=True):
if len(exp) != len(gens_gap):
raise ValueError("input does not match the number of generators")
x = self.one()
for i in range(len(exp)):
if orders[i] > 0:
x *= gens_gap[i]**(exp[i] % orders[i])
else:
x *= gens_gap[i]**exp[i]
for g, e, m in zip(gens_gap, exp, orders):
if m != 0:
e = e % m
x *= g**e
x = x.gap()
return self.element_class(self, x, check=check)

Expand Down Expand Up @@ -795,8 +794,7 @@ def __init__(self, ambient, gens):
category = category.Finite()
else:
category = category.Infinite()
# FIXME: Tell the category that it is a Subobjects() category
# category = category.Subobjects()
category = category.Subobjects()
AbelianGroup_gap.__init__(self, G, ambient=ambient, category=category)

def _repr_(self):
Expand Down Expand Up @@ -837,6 +835,64 @@ def __reduce__(self):
gens = tuple([amb(g) for g in self.gens()])
return amb.subgroup, (gens,)

def lift(self, x):
"""
Coerce to the ambient group.
The terminology comes from the category framework and the more general notion of a subquotient.
INPUT:
- ``x`` -- an element of this subgroup
OUTPUT:
The corresponding element of the ambient group
EXAMPLES::
sage: from sage.groups.abelian_gps.abelian_group_gap import AbelianGroupGap
sage: G = AbelianGroupGap([4])
sage: g = G.gen(0)
sage: H = G.subgroup([g^2])
sage: h = H.gen(0); h
f2
sage: h.parent()
Subgroup of Abelian group with gap, generator orders (4,) generated by (f2,)
sage: H.lift(h)
f2
sage: H.lift(h).parent()
Abelian group with gap, generator orders (4,)
"""
return self.ambient()(x)

def retract(self, x):
"""
Convert an element of the ambient group into this subgroup.
The terminology comes from the category framework and the more general notion of a subquotient.
INPUT:
- ``x`` -- an element of the ambient group that actually lies in this subgroup.
OUTPUT:
The corresponding element of this subgroup
EXAMPLES::
sage: from sage.groups.abelian_gps.abelian_group_gap import AbelianGroupGap
sage: G = AbelianGroupGap([4])
sage: g = G.gen(0)
sage: H = G.subgroup([g^2])
sage: H.retract(g^2)
f2
sage: H.retract(g^2).parent()
Subgroup of Abelian group with gap, generator orders (4,) generated by (f2,)
"""
return self(x)

class AbelianGroupQuotient_gap(AbelianGroup_gap):
r"""
Quotients of abelian groups by a subgroup.
Expand Down

0 comments on commit 101bd74

Please sign in to comment.