Exemplo n.º 1
0
        def extra_super_categories(self):
            """
            EXAMPLES::

                sage: Hom(ZZ^3, ZZ^3).category().extra_super_categories() # todo: not implemented
                [Category of algebras over Integer Ring]
            """
            from algebras import Algebras
            return [Algebras(self.base_category.base_ring())]
Exemplo n.º 2
0
    def super_categories(self):
        """
        EXAMPLES::

            sage: Algebras(QQ).Semisimple().super_categories()
            [Category of algebras over Rational Field]
        """
        R = self.base_ring()
        return [Algebras(R)]
Exemplo n.º 3
0
    def super_categories(self):
        """
        EXAMPLES::

            sage: CommutativeAlgebras(QQ).super_categories()
            [Category of algebras over Rational Field, Category of commutative rings]
        """
        R = self.base_ring()
        return [Algebras(R), CommutativeRings()]
Exemplo n.º 4
0
    def super_categories(self):
        """
        EXAMPLES::

            sage: MatrixAlgebras(QQ).super_categories()
            [Category of algebras over Rational Field]
        """
        from algebras import Algebras
        R = self.base_ring()
        return [Algebras(R)]
Exemplo n.º 5
0
    def __contains__(self, A):
        """
        EXAMPLES::

            sage: QQ['a'] in CommutativeAlgebras(QQ)
            True
            sage: QQ['a,b'] in CommutativeAlgebras(QQ)
            True
            sage: FreeAlgebra(QQ,2,'a,b') in CommutativeAlgebras(QQ)
            False

        TODO: get rid of this method once all commutative algebras in
        Sage declare themselves in this category
        """
        return super(CommutativeAlgebras, self).__contains__(A) or \
            (A in Algebras(self.base_ring()) and hasattr(A, "is_commutative") and A.is_commutative())
            def _orthogonal_decomposition(self, generators=None):
                r"""
                Return a maximal list of orthogonal quasi-idempotents of
                this finite dimensional semisimple commutative algebra.

                INPUT:

                - ``generators`` -- a list of generators of
                  ``self`` (default: the basis of ``self``)

                OUTPUT:

                A list of quasi-idempotent elements of ``self``.

                Each quasi-idempotent `e` spans a one
                dimensional (non unital) subalgebra of
                ``self``, and cannot be decomposed as a sum
                `e=e_1+e_2` of quasi-idempotents elements.
                All together, they form a basis of ``self``.

                Up to the order and scalar factors, the result
                is unique. In particular it does not depend on
                the provided generators which are only used
                for improved efficiency.

                ALGORITHM:

                Thanks to Schur's Lemma, a commutative
                semisimple algebra `A` is a direct sum of
                dimension 1 subalgebras. The algorithm is
                recursive and proceeds as follows:

                0. If `A` is of dimension 1, return a non zero
                   element.

                1. Otherwise: find one of the generators such
                   that the morphism `x \mapsto ax` has at
                   least two (right) eigenspaces.

                2. Decompose both eigenspaces recursively.

                EXAMPLES:

                We compute an orthogonal decomposition of the
                center of the algebra of the symmetric group
                `S_4`::

                    sage: Z4 = SymmetricGroup(4).algebra(QQ).center()
                    sage: Z4._orthogonal_decomposition()
                    [B[0] + B[1] + B[2] + B[3] + B[4],
                     B[0] + 1/3*B[1] - 1/3*B[2] - 1/3*B[4],
                     B[0] + B[2] - 1/2*B[3],
                     B[0] - 1/3*B[1] - 1/3*B[2] + 1/3*B[4],
                     B[0] - B[1] + B[2] + B[3] - B[4]]

                .. TODO::

                    Improve speed by using matrix operations
                    only, or even better delegating to a
                    multivariate polynomial solver.
                """
                if self.dimension() == 1:
                    return self.basis().list()

                category = Algebras(self.base_ring()).Semisimple().WithBasis().FiniteDimensional().Commutative().Subobjects()

                if generators is None:
                    generators = self.basis().list()

                # Searching for a good generator ...
                for gen in generators:
                    # Computing the eigenspaces of the
                    # linear map x -> gen*x
                    phi = self.module_morphism(
                        on_basis=lambda i:
                        gen*self.term(i),
                        codomain=self)
                    eigenspaces = phi.matrix().eigenspaces_right()

                    if len(eigenspaces) >= 2:
                        # Gotcha! Let's split the algebra according to the eigenspaces
                        subalgebras = [
                            self.submodule(map(self.from_vector, eigenspace.basis()),
                                           category=category)
                            for eigenvalue, eigenspace in eigenspaces]

                        # Decompose recursively each eigenspace
                        return [idempotent.lift()
                                for subalgebra in subalgebras
                                for idempotent in subalgebra._orthogonal_decomposition()]
                # TODO: Should this be an assertion check?
                raise Exception("Unable to fully decompose %s!"%self)