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

Commit

Permalink
fix comparison of morphisms
Browse files Browse the repository at this point in the history
  • Loading branch information
xcaruso committed Apr 3, 2020
1 parent 318a179 commit 1ce658d
Showing 1 changed file with 52 additions and 10 deletions.
62 changes: 52 additions & 10 deletions src/sage/rings/polynomial/skew_polynomial_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,29 @@
# https://www.gnu.org/licenses/
# ***************************************************************************

from __future__ import print_function, absolute_import, division

from sage.structure.richcmp import op_EQ
from sage.misc.prandom import randint
from sage.misc.cachefunc import cached_method
from sage.rings.infinity import Infinity
from sage.structure.category_object import normalize_names
import sage.misc.latex as latex

from sage.structure.unique_representation import UniqueRepresentation
from sage.structure.element import Element
from sage.rings.ring import Algebra
from sage.rings.ring import Field
from sage.categories.algebras import Algebras
from sage.rings.integer import Integer
from sage.rings.ring import Field

from sage.categories.morphism import Morphism, IdentityMorphism
from sage.rings.polynomial.skew_polynomial_element import SkewPolynomialBaseringInjection
from sage.structure.category_object import normalize_names
from sage.misc.prandom import randint
from sage.rings.morphism import RingHomomorphism
from sage.categories.homset import Hom
from sage.categories.morphism import Morphism
from sage.categories.morphism import IdentityMorphism
from sage.categories.map import Section
from sage.rings.morphism import RingHomomorphism

from sage.rings.polynomial.polynomial_element import PolynomialBaseringInjection
import sage.misc.latex as latex
from sage.rings.polynomial.polynomial_ring import PolynomialRing_general
from sage.rings.polynomial.skew_polynomial_element import SkewPolynomial
from sage.rings.polynomial.skew_polynomial_element import SkewPolynomialBaseringInjection


# Helper functions
Expand Down Expand Up @@ -1032,6 +1031,28 @@ def _call_ (self, x):
mod = 0
return self.codomain()(l)

def _richcmp_(self, right, op):
r"""
Compare this morphism with ``right``
TESTS::
sage: k.<a> = GF(5^3)
sage: S.<x> = SkewPolynomialRing(k, k.frobenius_endomorphism())
sage: Z = S.centre()
sage: iota = S.coerce_map_from(Z)
sage: sigma = iota.section()
sage: s = loads(dumps(sigma))
sage: s == sigma
True
sage: s is sigma
False
"""
if op == op_EQ:
return (self.domain() is right.domain()) and (self.codomain() is right.codomain())
return NotImplemented


class SkewPolynomialCenterInjection(RingHomomorphism):
r"""
Expand Down Expand Up @@ -1104,6 +1125,27 @@ def _call_(self,x):
l += [ self._embed(c) ] + lz
return self._codomain (l)

def _richcmp_(self, right, op):
r"""
Compare this morphism with ``right``
TESTS::
sage: k.<a> = GF(5^3)
sage: S.<x> = SkewPolynomialRing(k, k.frobenius_endomorphism())
sage: Z = S.centre()
sage: iota = S.coerce_map_from(Z)
sage: i = loads(dumps(iota))
sage: i == iota
True
sage: i is iota
False
"""
if op == op_EQ:
return (self.domain() is right.domain()) and (self.codomain() is right.codomain())
return NotImplemented

def section(self):
r"""
Return a section of this morphism
Expand Down

0 comments on commit 1ce658d

Please sign in to comment.