Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

""" 

Coercion methods for categories 

  

The purpose of this Cython module is to hold special coercion methods, 

which are inserted by their respective categories. 

""" 

  

from __future__ import absolute_import, division, print_function 

  

from sage.structure.element cimport Element 

cimport cython 

  

  

@cython.binding 

def _mul_parent(self, other): 

r""" 

Return the product of the two elements, calculated using 

the ``product`` method of the parent. 

  

This is inserted by :meth:`Magmas.ParentMethods.__init_extra__` as 

default implementation of ``Magmas.ElementMethods._mul_`` if 

``product`` is implemented in the parent. 

  

INPUT: 

  

- ``other`` -- an element of the parent of ``self`` 

  

OUTPUT: 

  

- an element of the parent of ``self`` 

  

EXAMPLES:: 

  

sage: S = Semigroups().example("free") 

sage: x = S('a'); y = S('b') 

sage: x._mul_parent(y) 

'ab' 

  

.. SEEALSO:: 

  

- :meth:`Magmas.ElementMethods._mul_parent` 

- :meth:`Magmas.ElementMethods.__init_extra__` 

- :meth:`Magmas.ParentMethods.product` 

  

This is :meth:`Magmas.ElementMethods._mul_parent`, implemented as 

a Cython method in :mod:`sage.categories.coercion_methods`:: 

  

sage: x._mul_parent.__func__ is Magmas.ElementMethods._mul_parent.__func__ 

True 

sage: x._mul_parent.__func__ is sage.categories.coercion_methods._mul_parent 

True 

""" 

return (<Element>self)._parent.product(self, other)