Пример #1
0
    def __init__(self, semigroup, module, on_basis, side="left"):
        """
        Initialize ``self``.

        EXAMPLES::

            sage: G = SymmetricGroup(4)
            sage: M = CombinatorialFreeModule(QQ, ['v'])
            sage: from sage.modules.with_basis.representation import Representation
            sage: on_basis = lambda g,m: M.term(m, g.sign())
            sage: R = Representation(G, M, on_basis)
            sage: R._test_representation()
        """
        if side not in ["left", "right"]:
            raise ValueError('side must be "left" or "right"')
        self._left_repr = (side == "left")
        self._on_basis = on_basis
        self._module = module
        indices = module.basis().keys()
        cat = Modules(module.base_ring()).WithBasis()
        if 'FiniteDimensional' in module.category().axioms():
            cat = cat.FiniteDimensional()
        Representation_abstract.__init__(self,
                                         semigroup,
                                         module.base_ring(),
                                         indices,
                                         category=cat,
                                         **module.print_options())
Пример #2
0
    def __init__(self, relations):
        """
        Initialization of ``self``.

        TESTS::

            sage: from sage.modules.module_functors import QuotientModuleFunctor
            sage: B = (2/3)*ZZ^2
            sage: F = QuotientModuleFunctor(B)
            sage: TestSuite(F).run()
        """
        R = relations.category().base_ring()
        ConstructionFunctor.__init__(self, Modules(R), Modules(R))
        self._relations = relations
        def representation(self, s):
            """
            Return the representation of `s` as a linear morphism acting on ``self``

            INPUT:
            - `s` -- an element of the semigroup acting on ``self``

            EXAMPLES::

                sage: S = AperiodicMonoids().Finite().example(5); S
                sage: A = S.simple_module(3)
                sage: pi = S.monoid_generators()
                sage: pi
                Finite family {1: 11345, 2: 12245, 3: 12335, 4: 12344, -1: 22345, -4: 12355, -3: 12445, -2: 13345}
                sage: phi = A.representation(pi[1])
                Generic endomorphism of A quotient of Free module generated by {33444, 33334, 33344, 34444} endowed with an action of The finite H-trivial monoid of order preserving maps on {1, .., 5} over Rational Field
                sage: phi(A.an_element())
                2*B[11144] + 2*B[11444] + 3*B[11114]
                sage: phi.matrix()
                [1 0 0 0]
                [0 0 0 0]
                [0 0 1 0]
                [0 1 0 1]
            """
            from sage.categories.homset import End
            import functools
            return SetMorphism(
                End(self,
                    Modules(self.base_ring()).WithBasis().FiniteDimensional()),
                functools.partial(self.action, s))
Пример #4
0
    def __init__(self, O, C, R):
        r"""
        INPUT:
            - `O` -- An action of a group `G` on a monoid as implemented in :class:`~fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basismonoids.NNMonoid`.
            - `C` -- A monoid of charcters `G -> K` for a ring `K`. As implemented in :class:`~fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basismonoids.CharacterMonoid_class`.
            - `R` -- A representation of `G` on some `K`-algebra or module `A`.
                     As implemented in :class:`~fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basismonoids.TrivialRepresentation`.
        
        TESTS::
            sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_functor import EquivariantMonoidPowerSeriesModuleFunctor
            sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import NNMonoid, TrivialRepresentation, TrivialCharacterMonoid
            sage: F = EquivariantMonoidPowerSeriesModuleFunctor(NNMonoid(), TrivialCharacterMonoid("1", ZZ), TrivialRepresentation("1", ZZ))
        """
        if O.group() != C.group():
            raise ValueError(
                "The action on S and the characters must have the same group")
        if R.base_ring() != C.codomain():
            #            if C.codomain().has_coerce_map_from(R.base_ring()) :
            #                pass
            #            el
            if R.base_ring().has_coerce_map_from(C.codomain()):
                pass
            else:
                raise ValueError(
                    "character codomain and representation base ring must be coercible"
                )

        self.__O = O
        self.__C = C
        self.__R = R

        ConstructionFunctor.__init__(self, Modules(R.base_ring()),
                                     CommutativeAdditiveGroups())
Пример #5
0
    def extra_super_categories(self):
        r"""
        Adds :class:`VectorSpaces` to the super categories of ``self`` if
        the base ring is a field.

        EXAMPLES::

            sage: Modules(QQ).Super().extra_super_categories()
            [Category of vector spaces over Rational Field]
            sage: Modules(ZZ).Super().extra_super_categories()
            []

        This makes sure that ``Modules(QQ).Super()`` returns an
        instance of :class:`SuperModules` and not a join category of
        an instance of this class and of ``VectorSpaces(QQ)``::

            sage: type(Modules(QQ).Super())
            <class 'sage.categories.super_modules.SuperModules_with_category'>

        .. TODO::

            Get rid of this workaround once there is a more systematic
            approach for the alias ``Modules(QQ)`` -> ``VectorSpaces(QQ)``.
            Probably the latter should be a category with axiom, and
            covariant constructions should play well with axioms.
        """
        from sage.categories.modules import Modules
        from sage.categories.fields import Fields
        base_ring = self.base_ring()
        if base_ring in Fields:
            return [Modules(base_ring)]
        else:
            return []
Пример #6
0
    def __init__(self, base_ring, cell_complex, cohomology=False, category=None):
        """
        Initialize ``self``.

        EXAMPLES::

            sage: RP2 = simplicial_complexes.ProjectivePlane()
            sage: H = RP2.homology_with_basis(QQ)
            sage: TestSuite(H).run()
            sage: H = RP2.homology_with_basis(GF(2))
            sage: TestSuite(H).run()
            sage: H = RP2.cohomology_ring(GF(2))
            sage: TestSuite(H).run()
            sage: H = RP2.cohomology_ring(GF(5))
            sage: TestSuite(H).run()
            sage: H = simplicial_complexes.ComplexProjectivePlane().cohomology_ring()
            sage: TestSuite(H).run()
        """
        # phi is the associated chain contraction.
        # M is the homology chain complex.
        phi, M = cell_complex.algebraic_topological_model(base_ring)
        if cohomology:
            phi = phi.dual()
            # We only need the rank of M in each degree, and since
            # we're working over a field, we don't need to dualize M
            # if working with cohomology.
        category = Modules(base_ring).WithBasis().Graded().FiniteDimensional().or_subcategory(category)
        self._contraction = phi
        self._complex = cell_complex
        self._cohomology = cohomology
        self._graded_indices = {deg: range(M.free_module_rank(deg))
                                for deg in range(cell_complex.dimension()+1)}
        indices = [(deg, i) for deg in self._graded_indices
                   for i in self._graded_indices[deg]]
        CombinatorialFreeModule.__init__(self, base_ring, indices, category=category)
Пример #7
0
    def __init__(self, vbundle, domain):
        r"""
        Construct the free module of sections over a trivial part of a vector
        bundle.

        TESTS::

            sage: M = Manifold(3, 'M', structure='top')
            sage: X.<x,y,z> = M.chart()
            sage: E = M.vector_bundle(2, 'E')
            sage: from sage.manifolds.section_module import SectionFreeModule
            sage: C0 = SectionFreeModule(E, M); C0
            Free module C^0(M;E) of sections on the 3-dimensional topological
             manifold M with values in the real vector bundle E of rank 2
            sage: C0 is E.section_module(force_free=True)
            True
            sage: TestSuite(C0).run()

        """
        from .scalarfield import ScalarField
        self._domain = domain
        name = "C^0({};{})".format(domain._name, vbundle._name)
        latex_name = r'C^0({};{})'.format(domain._latex_name,
                                          vbundle._latex_name)
        base_space = vbundle.base_space()
        self._base_space = base_space
        self._vbundle = vbundle
        cat = Modules(domain.scalar_field_algebra()).FiniteDimensional()
        FiniteRankFreeModule.__init__(self, domain.scalar_field_algebra(),
                               vbundle.rank(), name=name,
                               latex_name=latex_name,
                               start_index=base_space._sindex,
                               output_formatter=ScalarField.coord_function,
                               category=cat)
Пример #8
0
    def __init__(self, field, category=None):
        """
        Initialize the space of differentials of the function field.

        TESTS::

            sage: K.<x>=FunctionField(GF(4)); _.<Y>=K[]
            sage: L.<y>=K.extension(Y^3+x+x^3*Y)
            sage: W = L.space_of_differentials()
            sage: TestSuite(W).run()
        """
        Parent.__init__(self,
                        base=field,
                        category=Modules(field).FiniteDimensional().WithBasis(
                        ).or_subcategory(category))

        # Starting from the base rational function field, find the first
        # generator x of an intermediate function field that doesn't map to zero
        # by the derivation map and use dx as our base differential.

        der = field.derivation()
        for F in reversed(
                field._intermediate_fields(field.rational_function_field())):
            if der(F.gen()) != 0:
                break

        self._derivation = der
        self._gen_base_differential = F.gen()
        self._gen_derivative_inv = ~der(F.gen())  # used for fast computation
Пример #9
0
 def __init__(self, vector_field_module, tensor_type):
     domain = vector_field_module._domain
     dest_map = vector_field_module._dest_map
     kcon = tensor_type[0]
     lcov = tensor_type[1]
     name = "T^(" + str(kcon) + "," + str(lcov) + ")(" + domain._name
     latex_name = r"\mathcal{T}^{(" + str(kcon) + "," + str(lcov) + r")}\left(" + \
                  domain._latex_name
     if dest_map is domain._identity_map:
         name += ")"
         latex_name += r"\right)"
     else:
         name += "," + dest_map._name + ")"
         latex_name += "," + dest_map._latex_name + r"\right)"
     self._vmodule = vector_field_module
     self._tensor_type = tensor_type
     self._name = name
     self._latex_name = latex_name
     # the member self._ring is created for efficiency (to avoid calls to
     # self.base_ring()):
     self._ring = domain.scalar_field_algebra()
     Parent.__init__(self, base=self._ring, category=Modules(self._ring))
     self._domain = domain
     self._dest_map = dest_map
     self._ambient_domain = vector_field_module._ambient_domain
Пример #10
0
    def __init__(self, vector_field_module, tensor_type):
        r"""
        Construct a module of tensor fields taking values on a (a priori) not
        parallelizable differentiable manifold.

        TESTS::

            sage: M = Manifold(2, 'M') # the 2-dimensional sphere S^2
            sage: U = M.open_subset('U') # complement of the North pole
            sage: c_xy.<x,y> = U.chart() # stereographic coordinates from the North pole
            sage: V = M.open_subset('V') # complement of the South pole
            sage: c_uv.<u,v> = V.chart() # stereographic coordinates from the South pole
            sage: M.declare_union(U,V)   # S^2 is the union of U and V
            sage: xy_to_uv = c_xy.transition_map(c_uv, (x/(x^2+y^2), y/(x^2+y^2)),
            ....:                intersection_name='W', restrictions1= x^2+y^2!=0,
            ....:                restrictions2= u^2+v^2!=0)
            sage: XM = M.vector_field_module()
            sage: from sage.manifolds.differentiable.tensorfield_module import TensorFieldModule
            sage: T21 = TensorFieldModule(XM, (2,1)); T21
            Module T^(2,1)(M) of type-(2,1) tensors fields on the 2-dimensional
             differentiable manifold M
            sage: T21 is M.tensor_field_module((2,1))
            True
            sage: TestSuite(T21).run(skip='_test_elements')

        In the above test suite, ``_test_elements`` is skipped because of the
        ``_test_pickling`` error of the elements (to be fixed in
        :class:`~sage.manifolds.differentiable.tensorfield.TensorField`)

        """
        domain = vector_field_module._domain
        dest_map = vector_field_module._dest_map
        kcon = tensor_type[0]
        lcov = tensor_type[1]
        name = "T^({},{})({}".format(kcon, lcov, domain._name)
        latex_name = r"\mathcal{{T}}^{{({},{})}}\left({}".format(
            kcon, lcov, domain._latex_name)
        if dest_map is not domain.identity_map():
            dm_name = dest_map._name
            dm_latex_name = dest_map._latex_name
            if dm_name is None:
                dm_name = "unnamed map"
            if dm_latex_name is None:
                dm_latex_name = r"\mathrm{unnamed\; map}"
            name += "," + dm_name
            latex_name += "," + dm_latex_name
        self._name = name + ")"
        self._latex_name = latex_name + r"\right)"
        self._vmodule = vector_field_module
        self._tensor_type = tensor_type
        # the member self._ring is created for efficiency (to avoid calls to
        # self.base_ring()):
        self._ring = domain.scalar_field_algebra()
        Parent.__init__(self, base=self._ring, category=Modules(self._ring))
        self._domain = domain
        self._dest_map = dest_map
        self._ambient_domain = vector_field_module._ambient_domain
Пример #11
0
    def super_categories(self):
        """
        EXAMPLES::

            sage: Algebras(ZZ).super_categories()
            [Category of rings, Category of modules over Integer Ring]
        """
        R = self.base_ring()
        return [Rings(), Modules(R)]
Пример #12
0
    def super_categories(self):
        """
        EXAMPLES::

            sage: VectorSpaces(QQ).super_categories()
            [Category of modules over Rational Field]
        """
        R = self.base_field()
        return [Modules(R, dispatch=False)]
    def extra_super_categories_disabled(self):
        """
        EXAMPLES::

            sage: C = FiniteSemigroups().CharacterRings(QQ)
            sage: C.is_subcategory(Modules(QQ).WithBasis())
            True
        """
        from sage.categories.modules import Modules
        return [Modules(self.base_ring()).WithBasis()]
Пример #14
0
    def __init__(self, vector_field_module, degree):
        r"""
        Construction a module of multivector fields.

        TESTS:

        Module of 2-vector fields on a non-parallelizable 2-dimensional
        manifold::

            sage: M = Manifold(2, 'M')
            sage: U = M.open_subset('U') ; V = M.open_subset('V')
            sage: M.declare_union(U,V)   # M is the union of U and V
            sage: c_xy.<x,y> = U.chart() ; c_uv.<u,v> = V.chart()
            sage: transf = c_xy.transition_map(c_uv, (x+y, x-y),
            ....:             intersection_name='W', restrictions1= x>0,
            ....:             restrictions2= u+v>0)
            sage: inv = transf.inverse()
            sage: from sage.manifolds.differentiable.multivector_module import \
            ....:                                      MultivectorModule
            sage: A = MultivectorModule(M.vector_field_module(), 2) ; A
            Module A^2(M) of 2-vector fields on the 2-dimensional
             differentiable manifold M
            sage: TestSuite(A).run(skip='_test_elements')

        In the above test suite, ``_test_elements`` is skipped because
        of the ``_test_pickling`` error of the elements (to be fixed in
        :class:`sage.manifolds.differentiable.tensorfield.TensorField`)

        """
        domain = vector_field_module._domain
        dest_map = vector_field_module._dest_map
        name = "A^{}(".format(degree) + domain._name
        latex_name = r"A^{{{}}}\left({}".format(degree,
                                                domain._latex_name)
        if dest_map is not domain.identity_map():
            dm_name = dest_map._name
            dm_latex_name = dest_map._latex_name
            if dm_name is None:
                dm_name = "unnamed map"
            if dm_latex_name is None:
                dm_latex_name = r"\mathrm{unnamed\; map}"
            name += "," + dm_name
            latex_name += "," + dm_latex_name
        self._name = name + ")"
        self._latex_name = latex_name + r"\right)"
        self._vmodule = vector_field_module
        self._degree = degree
        # the member self._ring is created for efficiency (to avoid
        # calls to self.base_ring()):
        self._ring = domain.scalar_field_algebra()
        Parent.__init__(self, base=self._ring,
                        category=Modules(self._ring))
        self._domain = domain
        self._dest_map = dest_map
        self._ambient_domain = vector_field_module._ambient_domain
Пример #15
0
    def __init__(self, base):
        """
        Initialize ``self``.

        EXAMPLES::

            sage: from sage.algebras.tensor_algebra import TensorAlgebraFunctor
            sage: F = TensorAlgebraFunctor(Rings())
            sage: TestSuite(F).run()
        """
        ConstructionFunctor.__init__(self, Modules(base), Algebras(base))
Пример #16
0
    def super_categories(self):
        """
        The list of super categories of this category.

        EXAMPLES::

            sage: from sage.categories.lambda_bracket_algebras import LambdaBracketAlgebras
            sage: LambdaBracketAlgebras(QQ).super_categories()
            [Category of vector spaces over Rational Field]
        """
        return [Modules(self.base_ring())]
Пример #17
0
 def super_categories(self):
     """
     EXAMPLES::
     
         sage: from sage.categories.modsym_space_category import ModularSymbolSpaces
         sage: ModularSymbolSpaces(QQ).super_categories()
         [Category of vector spaces over Rational Field]
         sage: ModularSymbolSpaces(ZZ).super_categories()
         [Category of modules over Integer Ring]
     """
     from sage.categories.modules import Modules
     return [Modules(self.base_ring())]
Пример #18
0
    def super_categories(self):
        """
        EXAMPLES::

            sage: LieAlgebras(QQ).super_categories()
            [Category of vector spaces over Rational Field]
        """
        # We do not also derive from (Magmatic) algebras since we don't want *
        #   to be our Lie bracket
        # Also this doesn't inherit the ability to add axioms like Associative
        #   and Unital, both of which do not make sense for Lie algebras
        return [Modules(self.base_ring())]
Пример #19
0
    def __init__(self, semigroup, base_ring):
        """
        Initialize ``self``.

        EXAMPLES::

            sage: G = groups.permutation.PGL(2, 3)
            sage: V = G.trivial_representation()
            sage: TestSuite(V).run()
        """
        cat = Modules(base_ring).WithBasis().FiniteDimensional()
        Representation_abstract.__init__(self, semigroup, base_ring, ['v'], category=cat)
    def super_categories(self):
        """
        Return the super categories of ``self``.

        EXAMPLES::

            sage: from sage.categories.quantum_group_representations import QuantumGroupRepresentations
            sage: QuantumGroupRepresentations(ZZ['q'].fraction_field()).super_categories()
            [Category of vector spaces over
             Fraction Field of Univariate Polynomial Ring in q over Integer Ring]
        """
        return [Modules(self.base_ring())]
Пример #21
0
    def __init__(self, Lam):
        """
        Initialize ``self``.

        EXAMPLES::

            sage: Lambda = RootSystem(['A',3,1]).weight_lattice(extended=true).fundamental_weights()
            sage: V = IntegrableRepresentation(Lambda[1]+Lambda[2]+Lambda[3])

        Some methods required by the category are not implemented::

            sage: TestSuite(V).run()  # known bug (#21387)
        """
        CategoryObject.__init__(self, base=ZZ, category=Modules(ZZ))

        self._Lam = Lam
        self._P = Lam.parent()
        self._Q = self._P.root_system.root_lattice()

        # Store some extra simple computations that appear in tight loops
        self._Lam_rho = self._Lam + self._P.rho()

        self._cartan_matrix = self._P.root_system.cartan_matrix()
        self._cartan_type = self._P.root_system.cartan_type()

        self._classical_rank = self._cartan_type.classical().rank()
        self._index_set = self._P.index_set()
        self._index_set_classical = self._cartan_type.classical().index_set()
        self._cminv = self._cartan_type.classical().cartan_matrix().inverse()

        self._ddict = {}
        self._mdict = {tuple(0 for i in self._index_set): 1}
        # Coerce a classical root into the root lattice Q
        from_cl_root = lambda h: self._Q._from_dict(h._monomial_coefficients)
        self._classical_roots = [
            from_cl_root(al) for al in self._Q.classical().roots()
        ]
        self._classical_positive_roots = [
            from_cl_root(al) for al in self._Q.classical().positive_roots()
        ]
        self._a = self._cartan_type.a()  # This is not cached
        self._ac = self._cartan_type.dual().a()  # This is not cached
        self._eps = {i: self._a[i] / self._ac[i] for i in self._index_set}
        E = Matrix.diagonal([self._eps[i] for i in self._index_set_classical])
        self._ip = (self._cartan_type.classical().cartan_matrix() *
                    E).inverse()

        # Extra data for the twisted cases
        if not self._cartan_type.is_untwisted_affine():
            self._classical_short_roots = frozenset(
                al for al in self._classical_roots
                if self._inner_qq(al, al) == 2)
Пример #22
0
        def extra_super_categories(self):
            """
            TESTS:

            Check that Hom sets of Hecke modules are in the correct
            category (see :trac:`17359`)::

                sage: HeckeModules(ZZ).Homsets().super_categories()
                [Category of modules over Integer Ring, Category of homsets]
                sage: HeckeModules(QQ).Homsets().super_categories()
                [Category of vector spaces over Rational Field, Category of homsets]
            """
            from sage.categories.modules import Modules
            return [Modules(self.base_ring())]
Пример #23
0
    def __init__(self, Lam):
        """
        Initialize ``self``.

        EXAMPLES::

            sage: Lambda = RootSystem(['A',3,1]).weight_lattice(extended=true).fundamental_weights()
            sage: V = IntegrableRepresentation(Lambda[1]+Lambda[2]+Lambda[3])
            sage: TestSuite(V).run()
        """
        CategoryObject.__init__(self, base=ZZ, category=Modules(ZZ))

        if not Lam.parent().cartan_type().is_affine() or not Lam.parent(
        )._extended:
            raise ValueError(
                "the parent of %s must be an extended affine root lattice" %
                Lam)
        self._Lam = Lam
        self._P = Lam.parent()
        self._Q = self._P.root_system.root_lattice()

        self._cartan_matrix = self._P.root_system.cartan_matrix()
        self._cartan_type = self._P.root_system.cartan_type()
        if not self._cartan_type.is_untwisted_affine():
            raise NotImplementedError(
                "integrable representations are only implemented for untwisted affine types"
            )
        self._classical_rank = self._cartan_type.classical().rank()
        self._index_set = self._P.index_set()
        self._index_set_classical = self._cartan_type.classical().index_set()
        self._cminv = self._cartan_type.classical().cartan_matrix().inverse()

        self._ddict = {}
        self._mdict = {tuple(0 for i in self._index_set): 1}
        # Coerce a classical root into the root lattice Q
        from_cl_root = lambda h: self._Q._from_dict(h._monomial_coefficients)
        self._classical_roots = [
            from_cl_root(al) for al in self._Q.classical().roots()
        ]
        self._classical_positive_roots = [
            from_cl_root(al) for al in self._Q.classical().positive_roots()
        ]
        self._a = self._cartan_type.a()  # This is not cached
        self._ac = self._cartan_type.dual().a()  # This is not cached
        self._eps = {i: self._a[i] / self._ac[i] for i in self._index_set}
        self._coxeter_number = sum(self._a)
        self._dual_coxeter_number = sum(self._ac)
        E = Matrix.diagonal([self._eps[i] for i in self._index_set_classical])
        self._ip = (self._cartan_type.classical().cartan_matrix() *
                    E).inverse()
Пример #24
0
 def __init__(self, B, S) :
     r"""
     INPUT:
         - `B` -- A ring.
         - `S` -- A monoid as in :class:`~from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids.NNMonoid`
     
     TESTS::
         sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_functor import MonoidPowerSeriesModuleFunctor
         sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import NNMonoid
         sage: F = MonoidPowerSeriesModuleFunctor(ZZ, NNMonoid(False))
     """
     self.__S = S
     
     ConstructionFunctor.__init__(self, Modules(B), CommutativeAdditiveGroups())
Пример #25
0
        def twisted_invariant_module(self, G, chi,
                                     action=operator.mul,
                                     action_on_basis=None,
                                     side='left',
                                     **kwargs):
            r"""
            Create the isotypic component of the action of ``G`` on
            ``self`` with irreducible character given by ``chi``.

            .. SEEALSO::

                -:class:`~sage.modules.with_basis.invariant.FiniteDimensionalTwistedInvariantModule`

            INPUT:

            - ``G`` -- a finitely-generated group
            - ``chi`` -- a list/tuple of character values or an instance of
              :class:`~sage.groups.class_function.ClassFunction_gap`
            - ``action`` -- a function (default: :obj:`operator.mul`)
            - ``action_on_basis`` -- (optional) define the action of ``g``
              on the basis of ``self``
            - ``side`` -- ``'left'`` or ``'right'`` (default: ``'right'``);
              which side of ``self`` the elements of ``S`` acts

            OUTPUT:

            - :class:`~sage.modules.with_basis.invariant.FiniteDimensionalTwistedInvariantModule`

            EXAMPLES::

                sage: M = CombinatorialFreeModule(QQ, [1,2,3])
                sage: G = SymmetricGroup(3)
                sage: def action(g,x): return(M.term(g(x))) # permute coordinates
                sage: T = M.twisted_invariant_module(G, [2,0,-1], action_on_basis=action)
                sage: import __main__; __main__.action = action
                sage: TestSuite(T).run()
            """

            if action_on_basis is not None:
                from sage.modules.with_basis.representation import Representation
                from sage.categories.modules import Modules
                category = kwargs.pop('category', Modules(self.base_ring()).WithBasis())
                M = Representation(G, self, action_on_basis, side=side, category=category)
            else:
                M = self

            from sage.modules.with_basis.invariant import FiniteDimensionalTwistedInvariantModule
            return FiniteDimensionalTwistedInvariantModule(M, G, chi,
                                                          action, side, **kwargs)
Пример #26
0
    def __init__(self, vbundle, domain):
        r"""
        Construct the module of continuous sections over a vector bundle.

        TESTS::

            sage: M = Manifold(1, 'S^1', latex_name=r'S^1', start_index=1,
            ....:               structure='topological')
            sage: U = M.open_subset('U')
            sage: c_x.<x> = U.chart()
            sage: V = M.open_subset('V')
            sage: c_u.<u> = V.chart()
            sage: M.declare_union(U, V)
            sage: x_to_u = c_x.transition_map(c_u, 1/x, intersection_name='W',
            ....:                   restrictions1= x!=0, restrictions2= u!=0)
            sage: W = U.intersection(V)
            sage: u_to_x = x_to_u.inverse()
            sage: E = M.vector_bundle(1, 'E')
            sage: phi_U = E.trivialization('phi_U', latex_name=r'\varphi_U',
            ....:                          domain=U)
            sage: phi_V = E.trivialization('phi_V', latex_name=r'\varphi_V',
            ....:                          domain=V)
            sage: transf = phi_U.transition_map(phi_V, [[-1]])
            sage: C0 = E.section_module(); C0
            Module C^0(S^1;E) of sections on the 1-dimensional topological
             manifold S^1 with values in the real vector bundle E of rank 1
            sage: TestSuite(C0).run()

        """
        base_space = vbundle.base_space()
        if not domain.is_subset(base_space):
            raise ValueError("domain must be a subset of base space")
        if vbundle._diff_degree == infinity:
            repr_deg = "infinity"  # to skip the "+" in repr(infinity)
            latex_deg = r"\infty"  # to skip the "+" in latex(infinity)
        else:
            repr_deg = r"{}".format(vbundle._diff_degree)
            latex_deg = r"{}".format(vbundle._diff_degree)
        self._name = "C^{}({};{})".format(repr_deg, domain._name,
                                          vbundle._name)
        self._latex_name = r"C^{" + latex_deg + r"}" + \
                           r"({};{})".format(domain._latex_name,
                                             vbundle._latex_name)
        self._vbundle = vbundle
        self._domain = domain
        self._base_space = vbundle.base_space()
        self._ring = domain.scalar_field_algebra()
        self._def_frame = None
        Parent.__init__(self, base=self._ring, category=Modules(self._ring))
Пример #27
0
    def __init__(self, field, category=None):
        """
        Initialize the space of differentials of the function field.

        TESTS::

            sage: K.<x>=FunctionField(GF(4)); _.<Y>=K[]
            sage: L.<y>=K.extension(Y^3+x+x^3*Y)
            sage: W = L.space_of_differentials()
            sage: TestSuite(W).run()
        """
        Parent.__init__(self,
                        base=field,
                        category=Modules(field).FiniteDimensional().WithBasis(
                        ).or_subcategory(category))
Пример #28
0
    def __init__(self, generator):
        r"""
        TESTS::

            sage: sys.path.append(os.getcwd()); from mac_lane import * # optional: standalone
            sage: isinstance(DiscreteValueGroup(0), DiscreteValueGroup)
            True

        """
        from sage.categories.modules import Modules
        self._generator = generator

        # We can not set the facade to DiscreteValuationCodomain since there
        # are some issues with iterated facades currently
        UniqueRepresentation.__init__(self)
        Parent.__init__(self, facade=QQ, category=Modules(ZZ))
Пример #29
0
    def __init__(self, generator):
        r"""
        TESTS::

            sage: from sage.rings.valuation.value_group import DiscreteValueGroup
            sage: isinstance(DiscreteValueGroup(0), DiscreteValueGroup)
            True

        """
        from sage.categories.modules import Modules
        self._generator = generator

        # We can not set the facade to DiscreteValuationCodomain since there
        # are some issues with iterated facades currently
        UniqueRepresentation.__init__(self)
        Parent.__init__(self, facade=QQ, category=Modules(ZZ))
Пример #30
0
    def __init__(self, k, p=None, prec_cap=None, base=None, character=None,
                 adjuster=None, act_on_left=False, dettwist=None,
                 act_padic=False, implementation=None):
        """
        See ``OverconvergentDistributions_abstract`` for full documentation.

        EXAMPLES::

            sage: from sage.modular.pollack_stevens.distributions import OverconvergentDistributions
            sage: D = OverconvergentDistributions(2, 3, 5); D
            Space of 3-adic distributions with k=2 action and precision cap 5
            sage: type(D)
            <class 'sage.modular.pollack_stevens.distributions.OverconvergentDistributions_class_with_category'>

        `p` must be a prime, but `p=6` below, which is not prime::

            sage: OverconvergentDistributions(k=0, p=6, prec_cap=10)
            Traceback (most recent call last):
            ...
            ValueError: p must be prime
        """
        if not isinstance(base, ring.Ring):
            raise TypeError("base must be a ring")
        from sage.rings.padics.pow_computer import PowComputer
        # should eventually be the PowComputer on ZpCA once that uses longs.
        Dist, WeightKAction = get_dist_classes(p, prec_cap, base,
                                               self.is_symk(), implementation)
        self.Element = Dist
        # if Dist is Dist_long:
        #     self.prime_pow = PowComputer(p, prec_cap, prec_cap, prec_cap)
        Parent.__init__(self, base, category=Modules(base))
        self._k = k
        self._p = p
        self._prec_cap = prec_cap
        self._character = character
        self._adjuster = adjuster
        self._dettwist = dettwist

        if self.is_symk() or character is not None:
            self._act = WeightKAction(self, character, adjuster, act_on_left,
                                      dettwist, padic=act_padic)
        else:
            self._act = WeightKAction(self, character, adjuster, act_on_left,
                                      dettwist, padic=True)

        self._populate_coercion_lists_(action_list=[self._act])