예제 #1
0
    def __init__(self, A):
        """
        EXAMPLES::

            sage: AlgebraModules(QQ['a'])
            Category of algebra modules over Univariate Polynomial Ring in a over Rational Field
            sage: AlgebraModules(QQ['a,b']) # todo: not implemented (QQ['a,b'] should be in Algebras(QQ))
            sage: AlgebraModules(FreeAlgebra(QQ,2,'a,b'))
            Traceback (most recent call last):
            ...
            TypeError: A (=Free Algebra on 2 generators (a, b) over Rational Field) must be a commutative algebra
            sage: AlgebraModules(QQ)
            Traceback (most recent call last):
            ...
            TypeError: A (=Rational Field) must be a commutative algebra

        TESTS::

            sage: TestSuite(AlgebraModules(QQ['a'])).run()
        """
        from sage.categories.commutative_algebras import CommutativeAlgebras
        if not hasattr(A, "base_ring") or not A in CommutativeAlgebras(
                A.base_ring()):
            raise TypeError("A (=%s) must be a commutative algebra" % A)
        Category_module.__init__(self, A)
예제 #2
0
    def __init__(self, K):
        """
        EXAMPLES::

            sage: VectorSpaces(QQ)
            Category of vector spaces over Rational Field
            sage: VectorSpaces(ZZ)
            Traceback (most recent call last):
            ...
            AssertionError: The base ring must be a field.

        TESTS::

            sage: C = QQ^10      # vector space
            sage: TestSuite(C).run()
            sage: TestSuite(VectorSpaces(QQ)).run()
        """
        Category_module.__init__(self, K)
예제 #3
0
    def __init__(self, K):
        """
        EXAMPLES::

            sage: VectorSpaces(QQ)
            Category of vector spaces over Rational Field
            sage: VectorSpaces(ZZ)
            Traceback (most recent call last):
            ...
            AssertionError: The base ring must be a field.

        TESTS::

            sage: C = QQ^10      # vector space
            sage: TestSuite(C).run()
            sage: TestSuite(VectorSpaces(QQ)).run()
        """
        Category_module.__init__(self, K)
예제 #4
0
    def __init__(self, A):
        """
        EXAMPLES::

            sage: AlgebraModules(QQ['a'])
            Category of algebra modules over Univariate Polynomial Ring in a over Rational Field
            sage: AlgebraModules(QQ['a,b']) # todo: not implemented (QQ['a,b'] should be in Algebras(QQ))
            sage: AlgebraModules(FreeAlgebra(QQ,2,'a,b'))
            Traceback (most recent call last):
            ...
            TypeError: A (=Free Algebra on 2 generators (a, b) over Rational Field) must be a commutative algebra
            sage: AlgebraModules(QQ)
            Traceback (most recent call last):
            ...
            TypeError: A (=Rational Field) must be a commutative algebra

        TESTS::

            sage: TestSuite(AlgebraModules(QQ['a'])).run()
        """
        from sage.categories.commutative_algebras import CommutativeAlgebras
        if not hasattr(A, "base_ring") or not A in CommutativeAlgebras(A.base_ring()):
            raise TypeError("A (=%s) must be a commutative algebra"%A)
        Category_module.__init__(self, A)