当前位置: 首页>>代码示例>>Python>>正文


Python Partition.centralizer_size方法代码示例

本文整理汇总了Python中sage.combinat.partition.Partition.centralizer_size方法的典型用法代码示例。如果您正苦于以下问题:Python Partition.centralizer_size方法的具体用法?Python Partition.centralizer_size怎么用?Python Partition.centralizer_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sage.combinat.partition.Partition的用法示例。


在下文中一共展示了Partition.centralizer_size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _delta_irr_rec

# 需要导入模块: from sage.combinat.partition import Partition [as 别名]
# 或者: from sage.combinat.partition.Partition import centralizer_size [as 别名]
def _delta_irr_rec(p, marking):
    r"""
    Internal recursive function called by :func:`delta_irr`.
    """
    if len(p) == 0:
        return 0

    if marking[0] == 1:
        m = marking[1]
        a = marking[2]
        i = p.index(m)
        pp = Partition(p._list[:i]+p._list[i+1:]) # the partition p'

        N = (-1)**a* delta_std(
                pp._list + [m+2],
                (1,m+2,m-a))

        for m1 in xrange(1,m-1,2):
            m2 = m-m1-1
            for a1 in xrange(max(0,a-m2),min(a,m1)):
                a2 = a - a1 - 1
                for p1,p2 in bidecompositions(pp):
                    l1 = sorted([m1]+p1._list,reverse=True)
                    l2 = sorted([m2+2]+p2._list,reverse=True)
                    N += (-1)**a2*(_delta_irr_rec(Partition(l1),(1,m1,a1)) *
                        spin_difference_for_standard_permutations(Partition(l2),(1,m2+2,m2-a2)))
        return N

    elif marking[0] == 2:
        m1 = marking[1]
        m2 = marking[2]
        i1 = p.index(m1)
        i2 = p.index(m2)
        if m1 == m2: i2 += 1
        if i2 < i1: i1,i2 = i2,i1
        pp = Partition(p._list[:i1] + p._list[i1+1:i2] + p._list[i2+1:])

        N = d(Partition(sorted(pp._list+[m1+m2+1],reverse=True))) /  pp.centralizer_size()
        # nb of standard permutations that corrresponds to extension of good
        # guys

        for p1,p2 in bidecompositions(Partition(pp)):
            for k1 in xrange(1,m1,2): # remove (k1|.) (k2 o m_2)
                k2 = m1-k1-1
                q1 = Partition(sorted(p1._list+[k1],reverse=True))
                q2 = Partition(sorted(p2._list+[k2+m2+1],reverse=True))
                for a in xrange(k1): # a is a angle
                    N += _delta_irr_rec(q1, (1,k1,a)) * d(q2) / p2.centralizer_size()

            for k1 in xrange(1,m2,2): # remove (m_1 o k1) (k2|.)
                k2 = m2-k1-1
                l1 = sorted(p1._list+[m1,k1],reverse=True)
                l2 = sorted(p2._list+[k2+2],reverse=True)
                for a in xrange(1,k2+1): # a is an angle for standard perm
                    N += (_delta_irr_rec(Partition(l1), (2,m1,k1)) *
                        spin_difference_for_standard_permutations(Partition(l2), (1,k2+2,a)))

        for m in pp.to_exp_dict(): # remove (m_1 o k_1) (k_2 o m_2) for k1+k2+1 an other zero
            q = pp._list[:]
            del q[q.index(m)]
            for p1,p2 in bidecompositions(Partition(q)):
                for k1 in xrange(1,m,2):
                    k2 = m-k1-1
                    q1 = Partition(sorted(p1._list+[m1,k1],reverse=True))
                    q2 = Partition(sorted(p2._list+[k2+m2+1],reverse=True))
                    N += _delta_irr_rec(q1, (2,m1,k1)) * d(q2) / p2.centralizer_size()

        return N
开发者ID:Fougeroc,项目名称:flatsurf-package,代码行数:70,代码来源:rauzy_class_cardinality.py


注:本文中的sage.combinat.partition.Partition.centralizer_size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。