Coerce actions

class sage.structure.coerce_actions.IntegerMulAction
__init__()
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
__invert__()

EXAMPLES:

sage: from sage.structure.coerce_actions import IntegerMulAction
sage: act = IntegerMulAction(ZZ, CDF)        
sage: ~act
...
TypeError: No generic module division by Z.
static __new__()
T.__new__(S, ...) -> a new object with type S, a subtype of T
_call_()

EXAMPLES:

sage: from sage.structure.coerce_actions import IntegerMulAction
sage: act = IntegerMulAction(ZZ, GF(101))
sage: act(3, 9)
27
sage: act(3^689, 9)
42
sage: 3^689 * mod(9, 101)
42

Use round off error to verify this is doing actual repeated addition instead of just multiplying:

sage: act = IntegerMulAction(ZZ, RR)
sage: act(49, 1/49) == 49*RR(1/49)
False
_repr_name_()

EXAMPLES:

sage: from sage.structure.coerce_actions import IntegerMulAction
sage: IntegerMulAction(ZZ, GF(5))
Left Integer Multiplication by Integer Ring on Finite Field of size 5
class sage.structure.coerce_actions.LAction
__init__()
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
static __new__()
T.__new__(S, ...) -> a new object with type S, a subtype of T
_call_()
class sage.structure.coerce_actions.LeftModuleAction
static __new__()
T.__new__(S, ...) -> a new object with type S, a subtype of T
_call_()

A left module action is an action that takes the ring element as the first argument (the left side) and the module element as the second argument (the right side).

EXAMPLES:

sage: from sage.structure.coerce_actions import LeftModuleAction
sage: R.<x> = QQ['x']
sage: A = LeftModuleAction(ZZ, R)
sage: A(5, x+1)
5*x + 5
sage: R.<x> = ZZ['x']
sage: A = LeftModuleAction(QQ, R)
sage: A(1/2, x+1)
1/2*x + 1/2
sage: A._call_(1/2, x+1) # safe only when arguments have exactly the correct parent
1/2*x + 1/2
class sage.structure.coerce_actions.ModuleAction
__init__()
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
static __new__()
T.__new__(S, ...) -> a new object with type S, a subtype of T
_repr_name_()

The default name of this action type, which is has a sane default.

EXAMPLES:

sage: from sage.structure.coerce_actions import LeftModuleAction, RightModuleAction
sage: A = LeftModuleAction(ZZ, ZZ['x']); A
Left scalar multiplication by Integer Ring on Univariate Polynomial Ring in x over Integer Ring
sage: A._repr_name_()
'scalar multiplication'
sage: RightModuleAction(GF(5), GF(5)[['t']])
Right scalar multiplication by Finite Field of size 5 on Power Series Ring in t over Finite Field of size 5
codomain()

The codomain of self, which may or may not be equal to the domain.

EXAMPLES:

sage: from sage.structure.coerce_actions import LeftModuleAction
sage: A = LeftModuleAction(QQ, ZZ['x,y,z'])
sage: A.codomain()
Multivariate Polynomial Ring in x, y, z over Rational Field
domain()

The domain of self, which is the module that is being acted on.

EXAMPLES:

sage: from sage.structure.coerce_actions import LeftModuleAction
sage: A = LeftModuleAction(QQ, ZZ['x,y,z'])
sage: A.domain()
Multivariate Polynomial Ring in x, y, z over Integer Ring
class sage.structure.coerce_actions.PyScalarAction
static __new__()
T.__new__(S, ...) -> a new object with type S, a subtype of T
class sage.structure.coerce_actions.RAction
__init__()
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
static __new__()
T.__new__(S, ...) -> a new object with type S, a subtype of T
_call_()
class sage.structure.coerce_actions.RightModuleAction
static __new__()
T.__new__(S, ...) -> a new object with type S, a subtype of T
_call_()

A right module action is an action that takes the module element as the first argument (the left side) and the ring element as the second argument (the right side).

EXAMPLES:

sage: from sage.structure.coerce_actions import RightModuleAction
sage: R.<x> = QQ['x']
sage: A = RightModuleAction(ZZ, R)
sage: A(x+5, 2)
2*x + 10
sage: A._call_(x+5, 2) # safe only when arguments have exactly the correct parent
2*x + 10
is_inplace
sage.structure.coerce_actions.parent()

Previous topic

The Coercion Model

Next topic

Coerce maps

This Page