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

Commit

Permalink
sage.categories.map.Map: Add __matmul__
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Aug 4, 2020
1 parent e8d7924 commit a982dd8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/sage/categories/map.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -820,9 +820,12 @@ cdef class Map(Element):
else:
raise NotImplementedError("_call_with_args not overridden to accept arguments for %s" % type(self))

def __mul__(self, right):
def __matmul__(self, right):
r"""
The multiplication * operator is operator composition
Operator composition
Both the multiplication operator ``*`` and the matrix-multiplication operator ``@``
are operator composition.
IMPLEMENTATION:
Expand Down Expand Up @@ -858,6 +861,8 @@ cdef class Map(Element):
Generic morphism:
From: Integer Ring
To: Rational Field
sage: phi_yz @ phi_xy == phi_yz * phi_xy
True
If ``right`` is a ring homomorphism given by the images of
generators, then it is attempted to form the composition
Expand Down Expand Up @@ -896,6 +901,9 @@ cdef class Map(Element):
raise TypeError("self (=%s) domain must equal right (=%s) codomain" % (self, right))
return self._composition(right)

def __mul__(self, right):
return self.__matmul__(right)

def _composition(self, right):
"""
Composition of maps, which generically returns a :class:`CompositeMap`.
Expand Down

0 comments on commit a982dd8

Please sign in to comment.