コード例 #1
0
ファイル: skew_tableau.py プロジェクト: odellus/sage
    def cardinality(self):
        """
        Returns the number of standard skew tableaux with shape of the skew
        partition skp.  This uses a formula due to Aitken
        (see Cor. 7.16.3 of [Sta1999]_).

        EXAMPLES::

            sage: StandardSkewTableaux([[3, 2, 1], [1, 1]]).cardinality()
            8
        """
        outer, inner = self.skp
        m = len(outer)
        n = sum(outer) - sum(inner)
        outer = list(outer)
        inner = list(inner) + [0]*(m-len(inner))
        a = zero_matrix(QQ, m)
        for i in range(m):
            for j in range(m):
                v = outer[i] - inner[j] - i + j
                if v < 0:
                    a[i,j] = 0
                else:
                    a[i,j] = 1/factorial(v)
        return ZZ(factorial(n) * a.det())
コード例 #2
0
ファイル: skew_tableau.py プロジェクト: chenkenshin/sage
    def cardinality(self):
        """
        Returns the number of standard skew tableaux with shape of the skew
        partition skp.  This uses a formula due to Aitken
        (see Cor. 7.16.3 of [Sta1999]_).

        EXAMPLES::

            sage: StandardSkewTableaux([[3, 2, 1], [1, 1]]).cardinality()
            8
        """
        outer, inner = self.skp
        m = len(outer)
        n = sum(outer) - sum(inner)
        outer = list(outer)
        inner = list(inner) + [0] * (m - len(inner))
        a = zero_matrix(QQ, m)
        for i in range(m):
            for j in range(m):
                v = outer[i] - inner[j] - i + j
                if v < 0:
                    a[i, j] = 0
                else:
                    a[i, j] = 1 / factorial(v)
        return ZZ(factorial(n) * a.det())
コード例 #3
0
    def number_of_classes(self, invertible=False, q=None):
        """
        Return the number of similarity classes of matrices of type ``self``.

        IMPUT:

        - ``invertible`` -- Boolean; return number of invertible classes if set
          to ``True``

        - ``q`` -- An integer or an indeterminate

        EXAMPLES::

            sage: tau = SimilarityClassType([[1, [1]], [1, [1]]])
            sage: tau.number_of_classes()
            1/2*q^2 - 1/2*q
        """
        if q is None:
            q = ZZ["q"].gen()
        if self.size() == 0:
            return q.parent().one()
        list_of_degrees = [PT.degree() for PT in self]
        maximum_degree = max(list_of_degrees)
        numerator = prod(
            [
                prod([primitives(d + 1, invertible=invertible, q=q) - i for i in range(list_of_degrees.count(d + 1))])
                for d in range(maximum_degree)
            ]
        )
        tau_list = list(self)
        D = dict((i, tau_list.count(i)) for i in tau_list)
        denominator = reduce(mul, [factorial(D[primary_type]) for primary_type in D.keys()])
        return numerator / denominator
コード例 #4
0
    def number_of_classes(self, invertible=False, q=None):
        """
        Return the number of similarity classes of matrices of type ``self``.

        IMPUT:

        - ``invertible`` -- Boolean; return number of invertible classes if set
          to ``True``

        - ``q`` -- An integer or an indeterminate

        EXAMPLES::

            sage: tau = SimilarityClassType([[1, [1]], [1, [1]]])
            sage: tau.number_of_classes()
            1/2*q^2 - 1/2*q
        """
        if q is None:
            q = ZZ['q'].gen()
        if self.size() == 0:
            return q.parent().one()
        list_of_degrees = [PT.degree() for PT in self]
        maximum_degree = max(list_of_degrees)
        numerator = prod([
            prod([
                primitives(d + 1, invertible=invertible, q=q) - i
                for i in range(list_of_degrees.count(d + 1))
            ]) for d in range(maximum_degree)
        ])
        tau_list = list(self)
        D = dict((i, tau_list.count(i)) for i in tau_list)
        denominator = reduce(
            mul, [factorial(D[primary_type]) for primary_type in D.keys()])
        return numerator / denominator