Exemplo n.º 1
0
    def _get_action_(self, other, op, self_is_left):
        """
        EXAMPLES::

            sage: A = FormalSums(RR).get_action(RR); A     # indirect doctest
            Right scalar multiplication by Real Field with 53 bits of precision on Abelian Group of all Formal Finite Sums over Real Field with 53 bits of precision

            sage: A = FormalSums(ZZ).get_action(QQ); A
            Right scalar multiplication by Rational Field on Abelian Group of all Formal Finite Sums over Rational Field
            with precomposition on left by Conversion map:
              From: Abelian Group of all Formal Finite Sums over Integer Ring
              To:   Abelian Group of all Formal Finite Sums over Rational Field
            sage: A = FormalSums(QQ).get_action(ZZ); A
            Right scalar multiplication by Integer Ring on Abelian Group of all Formal Finite Sums over Rational Field
        """
        if op is operator.mul and isinstance(other, Parent):
            extended = self.base_extend(other)
            if self_is_left:
                action = RightModuleAction(other, extended)
                if extended is not self:
                    action = PrecomposedAction(
                        action, extended._internal_coerce_map_from(self), None)
            else:
                action = LeftModuleAction(other, extended)
                if extended is not self:
                    action = PrecomposedAction(
                        action, None, extended._internal_coerce_map_from(self))
            return action
Exemplo n.º 2
0
 def get_action_impl(self, other, op, self_is_left):
     """
     EXAMPLES::
     
         sage: A = FormalSums(RR).get_action(RR); A
         Right scalar multiplication by Real Field with 53 bits of precision on Abelian Group of all Formal Finite Sums over Real Field with 53 bits of precision
         
         sage: A = FormalSums(ZZ).get_action(QQ); A
         Right scalar multiplication by Rational Field on Abelian Group of all Formal Finite Sums over Rational Field
         with precomposition on left by Call morphism:
           From: Abelian Group of all Formal Finite Sums over Integer Ring
           To:   Abelian Group of all Formal Finite Sums over Rational Field
         sage: A = FormalSums(QQ).get_action(ZZ); A
         Right scalar multiplication by Integer Ring on Abelian Group of all Formal Finite Sums over Rational Field
     """
     import operator
     from sage.structure.coerce import LeftModuleAction, RightModuleAction
     from sage.categories.action import PrecomposedAction
     if op is operator.mul and isinstance(other, Parent):
         extended = self.base_extend(other)
         if self_is_left:
             action = RightModuleAction(other, extended)
             if extended is not self:
                 action = PrecomposedAction(action,
                                            extended.coerce_map_from(self),
                                            None)
         else:
             action = LeftModuleAction(other, extended)
             if extended is not self:
                 action = PrecomposedAction(action, None,
                                            extended.coerce_map_from(self))
         return action