Coerce actions

class sage.structure.coerce_actions.ActOnAction

Bases: sage.structure.coerce_actions.GenericAction

Class for actions defined via the _act_on_ method.

class sage.structure.coerce_actions.ActedUponAction

Bases: sage.structure.coerce_actions.GenericAction

Class for actions defined via the _acted_upon_ method.

class sage.structure.coerce_actions.GenericAction

Bases: sage.categories.action.Action

codomain()

Returns the “codomain” of this action, i.e. the Parent in which the result elements live. Typically, this should be the same as the acted upon set.

EXAMPLES:

sage: A = sage.structure.coerce_actions.ActedUponAction(MatrixSpace(ZZ, 2), Cusps, True)
sage: A.codomain()
Set P^1(QQ) of all cusps
sage: A = sage.structure.coerce_actions.ActOnAction(SymmetricGroup(3), QQ['x,y,z'], False)
sage: A.codomain()
Multivariate Polynomial Ring in x, y, z over Rational Field
class sage.structure.coerce_actions.IntegerMulAction
Bases: sage.categories.action.Action
class sage.structure.coerce_actions.LAction
Bases: sage.categories.action.Action
class sage.structure.coerce_actions.LeftModuleAction
Bases: sage.structure.coerce_actions.ModuleAction
class sage.structure.coerce_actions.ModuleAction

Bases: sage.categories.action.Action

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
Bases: sage.categories.action.Action
class sage.structure.coerce_actions.RAction
Bases: sage.categories.action.Action
class sage.structure.coerce_actions.RightModuleAction

Bases: sage.structure.coerce_actions.ModuleAction

is_inplace
sage.structure.coerce_actions.detect_element_action(X, Y, X_on_left)

Returns an action of X on Y or Y on X as defined by elements X, if any.

EXAMPLES:

sage: from sage.structure.coerce_actions import detect_element_action
sage: detect_element_action(ZZ['x'], ZZ, False)
Left scalar multiplication by Integer Ring on Univariate Polynomial Ring in x over Integer Ring
sage: detect_element_action(ZZ['x'], QQ, True)
Right scalar multiplication by Rational Field on Univariate Polynomial Ring in x over Integer Ring
sage: detect_element_action(Cusps, MatrixSpace(ZZ, 2), False)
Left action by Full MatrixSpace of 2 by 2 dense matrices over Integer Ring on Set P^1(QQ) of all cusps
sage: detect_element_action(Cusps, MatrixSpace(ZZ, 2), True),
(None,)
sage: detect_element_action(ZZ, QQ, True),
(None,)

TESTS:

This test checks that the issue in Trac #7718 has been fixed:

sage: class MyParent(Parent):
...    def an_element(self):
...        pass
...
sage: A = MyParent()
sage: detect_element_action(A, ZZ, True)
...
RuntimeError: an_element() returned None
sage.structure.coerce_actions.parent(x)

Previous topic

The Coercion Model

Next topic

Coerce maps

This Page