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

Commit

Permalink
Merge branch 'u/caruso/21413/class_ring_extension' of git://trac.sage…
Browse files Browse the repository at this point in the history
…math.org/sage into 21413_ring_extensions
  • Loading branch information
roed314 committed Sep 7, 2019
2 parents bdf4b23 + 656ec77 commit 2379f40
Show file tree
Hide file tree
Showing 10 changed files with 1,319 additions and 6 deletions.
5 changes: 5 additions & 0 deletions src/sage/categories/action.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ cdef class PrecomposedAction(Action):
cdef class ActionEndomorphism(Morphism):
cdef Action _action
cdef Element _g

cdef class BaseActionOnRing(Action):
cdef _base
cdef _algebra
cdef _defining_morphism
64 changes: 64 additions & 0 deletions src/sage/categories/action.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -573,3 +573,67 @@ cdef class ActionEndomorphism(Morphism):
return (~self._action)(self._g)


cdef class BaseActionOnRing(Action):
r"""
This class implements the left action of the base on the
ring given an extension ``ring``/``base``
See also :func:`RingExtension`
EXAMPLES::
sage: K = GF(5^2); z2 = K.gen()
sage: L = GF(5^4); z4 = L.gen()
sage: E = RingExtension(L, K, K.frobenius_endomorphism())
sage: z2 * E(z4) # indirect doctest
4*z4^3 + 3*z4^2 + 2*z4 + 2
sage: z2^5 * z4
4*z4^3 + 3*z4^2 + 2*z4 + 2
We underline that the action in only defined on the left::
sage: E(z4) * z2
z4^3 + 2*z4^2 + 4*z4 + 3
sage: z4 * z2
z4^3 + 2*z4^2 + 4*z4 + 3
AUTHOR:
- Xavier Caruso (2016)
"""
def __init__(self, algebra):
r"""
TESTS::
sage: from sage.categories.action import BaseActionOnRing
sage: BaseActionOnRing(ZZ)
Traceback (most recent call last):
...
TypeError: Integer Ring is not an instance of AlgebraFromMorphism
"""
from sage.rings.algebra_from_morphism import AlgebraFromMorphism
if not isinstance(algebra, AlgebraFromMorphism):
raise TypeError("%s is not an instance of AlgebraFromMorphism" % algebra)
self._base = algebra.base_ring()
self._algebra = algebra
self._defining_morphism = algebra.defining_morphism()

import operator
Action.__init__(self, self._base, algebra, op=operator.mul)

cpdef _call_(self, scalar, element):
r"""
Return the action of ``scalar`` on ``element``
EXAMPLE::
sage: K = GF(5^2); z2 = K.gen()
sage: L = GF(5^4); z4 = L.gen()
sage: E = RingExtension(L, K, K.frobenius_endomorphism())
sage: z2 * E(z4) # indirect doctest
4*z4^3 + 3*z4^2 + 2*z4 + 2
"""
result = self._defining_morphism(scalar) * element.element_in_ring()
return self._algebra(result)

0 comments on commit 2379f40

Please sign in to comment.