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


Python Partition.add_cell方法代码示例

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


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

示例1: affine_grassmannian_to_core

# 需要导入模块: from sage.combinat.partition import Partition [as 别名]
# 或者: from sage.combinat.partition.Partition import add_cell [as 别名]
        def affine_grassmannian_to_core(self):
            r"""
            Bijection between affine Grassmannian elements of type `A_k^{(1)}` and `(k+1)`-cores.

            INPUT:

            - ``self`` -- an affine Grassmannian element of some affine Weyl group of type `A_k^{(1)}`

            Recall that an element `w` of an affine Weyl group is
            affine Grassmannian if all its all reduced words end in 0, see :meth:`is_affine_grassmannian`.

            OUTPUT:

            - a `(k+1)`-core

            See also :meth:`affine_grassmannian_to_partition`.

            EXAMPLES::

                sage: W = WeylGroup(['A',2,1])
                sage: w = W.from_reduced_word([0,2,1,0])
                sage: la = w.affine_grassmannian_to_core(); la
                [4, 2]
                sage: type(la)
                <class 'sage.combinat.core.Cores_length_with_category.element_class'>
                sage: la.to_grassmannian() == w
                True

                sage: w = W.from_reduced_word([0,2,1])
                sage: w.affine_grassmannian_to_core()
                Traceback (most recent call last):
                ...
                ValueError: Error! this only works on type 'A' affine Grassmannian elements
            """
            from sage.combinat.partition import Partition
            from sage.combinat.core import Core

            if not self.is_affine_grassmannian() or not self.parent().cartan_type().letter == "A":
                raise ValueError("Error! this only works on type 'A' affine Grassmannian elements")
            out = Partition([])
            rword = self.reduced_word()
            kp1 = self.parent().n
            for i in range(len(rword)):
                for c in (x for x in out.outside_corners() if (x[1] - x[0]) % kp1 == rword[-i - 1]):
                    out = out.add_cell(c[0], c[1])
            return Core(out._list, kp1)
开发者ID:novoselt,项目名称:sage,代码行数:48,代码来源:affine_weyl_groups.py


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