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

Commit

Permalink
Revert "hack to make * compose isogenies and isomorphisms correctly"
Browse files Browse the repository at this point in the history
This reverts commit 6e34c55.
  • Loading branch information
yyyyx4 committed Aug 20, 2021
1 parent 69a15a2 commit c24d57f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 34 deletions.
46 changes: 30 additions & 16 deletions src/sage/schemes/elliptic_curves/ell_curve_isogeny.py
Original file line number Diff line number Diff line change
Expand Up @@ -3567,22 +3567,6 @@ def formal(self,prec=20):
# Overload Morphism methods that we want to
#

def _composition_(self, other, homset):
r"""
Return the composition of this isogeny with another
elliptic-curve morphism.
"""
if not isinstance(other, EllipticCurveHom):
raise TypeError(f'cannot compose {type(self)!r} with {type(other)!r}')

# This is a temporary hack: See WeierstrassIsomorphism._composition_.
if isinstance(other, WeierstrassIsomorphism):
output = copy(self)
output._set_pre_isomorphism(other)
return output

return EllipticCurveHom._composition_(self, other, homset)

def is_injective(self):
r"""
Return ``True`` if and only if this isogeny has trivial
Expand Down Expand Up @@ -3662,6 +3646,36 @@ def is_zero(self):
"""
return self.degree().is_zero()

def post_compose(self, left):
r"""
Return the post-composition of this isogeny with ``left``.
EXAMPLES::
sage: E = EllipticCurve(j=GF(7)(0))
sage: phi = EllipticCurveIsogeny(E, [ E((0,1)), E((0,-1))])
sage: phi.post_compose(phi)
Traceback (most recent call last):
...
NotImplementedError: post-composition of isogenies not yet implemented
"""
raise NotImplementedError("post-composition of isogenies not yet implemented")

def pre_compose(self, right):
r"""
Return the pre-composition of this isogeny with ``right``.
EXAMPLES::
sage: E = EllipticCurve(j=GF(7)(0))
sage: phi = EllipticCurveIsogeny(E, [ E((0,1)), E((0,-1))])
sage: phi.pre_compose(phi)
Traceback (most recent call last):
...
NotImplementedError: pre-composition of isogenies not yet implemented
"""
raise NotImplementedError("pre-composition of isogenies not yet implemented")

def n(self):
r"""
Numerical Approximation inherited from Map (through morphism),
Expand Down
24 changes: 6 additions & 18 deletions src/sage/schemes/elliptic_curves/weierstrass_morphism.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def isomorphisms(E, F, JustOne=False):
return ans


class WeierstrassIsomorphism(EllipticCurveHom, baseWI):
class WeierstrassIsomorphism(baseWI, EllipticCurveHom):
r"""
Class representing a Weierstrass isomorphism between two elliptic curves.
"""
Expand Down Expand Up @@ -590,10 +590,9 @@ def __invert__(self):
winv = baseWI.__invert__(self).tuple()
return WeierstrassIsomorphism(self._codomain, winv, self._domain)

def _composition_(self, other, homset):
def __mul__(self, other):
r"""
Return the composition of this WeierstrassIsomorphism and another
elliptic-curve morphism.
Return the composition of this WeierstrassIsomorphism and the other,
WeierstrassMorphisms can be composed using ``*`` if the
codomain & domain match: `(w1*w2)(X)=w1(w2(X))`, so we require
Expand All @@ -610,22 +609,11 @@ def _composition_(self, other, homset):
sage: (w2*w1)(P) == w2(w1(P))
True
"""
if not isinstance(other, EllipticCurveHom):
raise TypeError(f'cannot compose {type(self)!r} with {type(other)!r}')

if isinstance(other, WeierstrassIsomorphism):
if self._domain != other._codomain:
raise ValueError("Domain of first argument must equal codomain of second")
if self._domain == other._codomain:
w = baseWI.__mul__(self, other)
return WeierstrassIsomorphism(other._domain, w.tuple(), self._codomain)

# This is a temporary hack until a new class for composite isogenies has been
# implemented and various combinations of EllipticCurveHom instantiations can
# be composed in a more uniform and principled way. See #32388.
import copy
output = copy.copy(other)
output._set_post_isomorphism(self)
return output
else:
raise ValueError("Domain of first argument must equal codomain of second")

def __repr__(self):
r"""
Expand Down

0 comments on commit c24d57f

Please sign in to comment.