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


Python combinat.CombinatorialObject类代码示例

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


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

示例1: __init__

    def __init__(self, core, parent):
        """
        TESTS::

            sage: C = Cores(4,3)
            sage: c = C([2,1]); c
            [2, 1]
            sage: type(c)
            <class 'sage.combinat.core.Cores_length_with_category.element_class'>
            sage: c.parent()
            4-Cores of length 3
            sage: TestSuite(c).run()

            sage: C = Cores(3,3)
            sage: C([2,1])
            Traceback (most recent call last):
            ...
            ValueError: [2, 1] is not a 3-core
        """
        k = parent.k
        part = Partition(core)
        if not part.is_core(k):
            raise ValueError, "%s is not a %s-core"%(part, k)
        CombinatorialObject.__init__(self, core)
        Element.__init__(self, parent)
开发者ID:biasse,项目名称:sage,代码行数:25,代码来源:core.py

示例2: __init__

    def __init__(self, lst):
        """
        TESTS::

            sage: ParkingFunction([1, 1, 2, 2, 5, 6])
            [1, 1, 2, 2, 5, 6]
        """
        if not is_a(lst):
            raise ValueError("%s is not a parking function." % lst)
        CombinatorialObject.__init__(self, lst)
开发者ID:Etn40ff,项目名称:sage,代码行数:10,代码来源:parking_functions.py

示例3: __init__

    def __init__(self, parent, x):
        """
        Initialize ``self``.

        EXAMPLES::

            sage: mst = MultiSkewTableau([ [[None,1],[2,3]], [[1,2],[2]] ])
            sage: TestSuite(mst).run()
        """
        CombinatorialObject.__init__(self, x)
        Element.__init__(self, parent)
开发者ID:acrlakshman,项目名称:sage,代码行数:11,代码来源:ribbon_tableau.py

示例4: __init__

    def __init__(self, parent, tau):
        """
        Initialize ``self``.

        EXAMPLES::

            sage: elt =  SimilarityClassType([[3, [3, 2, 1]], [2, [2, 1]]])
            sage: TestSuite(elt).run()
        """
        CombinatorialObject.__init__(self, sorted(tau, key=lambda PT: (PT.degree(), PT.partition())))
        Element.__init__(self, parent)
开发者ID:jhpalmieri,项目名称:sage,代码行数:11,代码来源:similarity_class_type.py

示例5: __init__

    def __init__(self, parent, vecpar):
        """
        Initialize ``self``.

        EXAMPLES::

            sage: elt =  VectorPartition([[3, 2, 1], [2, 2, 1]])
            sage: TestSuite(elt).run()
        """
        CombinatorialObject.__init__(self, sorted(vecpar))
        Element.__init__(self, parent)
开发者ID:CETHop,项目名称:sage,代码行数:11,代码来源:vector_partition.py

示例6: __init__

    def __init__(self, parent, lst):
        """
        Initialize ``self``.

        EXAMPLES::

            sage: D = Derangements(4)
            sage: elt = D([4,3,2,1])
            sage: TestSuite(elt).run()
        """
        CombinatorialObject.__init__(self, lst)
        Element.__init__(self, parent)
开发者ID:bukzor,项目名称:sage,代码行数:12,代码来源:derangements.py

示例7: __init__

    def __init__(self, parent, t):
        r"""
        Initialize a composition tableau.

        TESTS::

            sage: t = CompositionTableaux()([[1],[2,2]])
            sage: s = CompositionTableaux(3)([[1],[2,2]])
            sage: s==t
            True
            sage: t.parent()
            Composition Tableaux
            sage: s.parent()
            Composition Tableaux of size 3 and maximum entry 3
            sage: r = CompositionTableaux()(s)
            sage: r.parent()
            Composition Tableaux
        """
        if isinstance(t, CompositionTableau):
            Element.__init__(self, parent)
            CombinatorialObject.__init__(self, t._list)
            return

        # CombinatorialObject verifies that t is a list
        # We must verify t is a list of lists
        if not all(isinstance(row, list) for row in t):
            raise ValueError("A composition tableau must be a list of lists.")

        if not map(len,t) in Compositions():
            raise ValueError("A composition tableau must be a list of non-empty lists.")

        # Verify rows weakly decrease from left to right
        for row in t:
            if any(row[i] < row[i+1] for i in range(len(row)-1)):
                raise ValueError("Rows must weakly decrease from left to right.")

        # Verify leftmost column strictly increases from top to bottom
        first_col = [row[0] for row in t if t!=[[]]]
        if any(first_col[i] >= first_col[i+1] for i in range(len(t)-1)):
            raise ValueError("Leftmost column must strictly increase from top to bottom.")

        # Verify triple condition
        l = len(t)
        m = max(map(len,t)+[0])
        TT = [row+[0]*(m-len(row)) for row in t]
        for i in range(l):
            for j in range(i+1,l):
                for k in range(1,m):
                    if TT[j][k] != 0 and TT[j][k] >= TT[i][k] and TT[j][k] <= TT[i][k-1]:
                        raise ValueError("Triple condition must be satisfied.")

        Element.__init__(self, parent)
        CombinatorialObject.__init__(self, t)
开发者ID:amitjamadagni,项目名称:sage,代码行数:53,代码来源:composition_tableau.py

示例8: __init__

 def __init__(self,parent,data):
     i = len(data)-1
     while i >= 0 and len(data[i]) == 0:
         data.pop()
         i -= 1
     self.rows = len(data)
     if data == []:
         self.cols = 0
     else:
         self.cols = max([len(r) for r in data])
     self.data = data
     CombinatorialObject.__init__(self, data)
     Element.__init__(self, parent)
开发者ID:LucasRoesler,项目名称:Sage-Generalize-Young-Walls,代码行数:13,代码来源:gyw.py

示例9: __init__

    def __init__(self, parent, list):
        """
        EXAMPLES::

            sage: from sage.combinat.crystals.tensor_product import ImmutableListWithParent, TestParent
            sage: l = ImmutableListWithParent(TestParent(), [1,2,3])
            sage: l.parent()
            A parent for tests
            sage: parent(l)
            A parent for tests
            sage: TestSuite(l).run(skip = "_test_category")
        """
        Element.__init__(self, parent)
        CombinatorialObject.__init__(self, list)
开发者ID:odellus,项目名称:sage,代码行数:14,代码来源:tensor_product.py

示例10: __init__

    def __init__(self, shape=None, rigging_list=None, vacancy_nums=None):
        r"""
        Initialize by the rigged partition.

        Note that this only performs checks to see that the sizes match up.

        INPUT:

        - ``shape`` -- (Default: ``None``) The shape

        - ``rigging_list`` -- (Default: ``None``) The riggings

        - ``vacancy_nums`` -- (Default: ``None``) The vacancy numbers

        TESTS::

            sage: sage.combinat.rigged_configurations.rigged_partition.RiggedPartition()
            (/)
            <BLANKLINE>
            sage: RP = sage.combinat.rigged_configurations.rigged_partition.RiggedPartition([2,1], [0,0], [1, 0])
            sage: RP
            1[ ][ ]0
            0[ ]0
            <BLANKLINE>
            sage: TestSuite(RP).run()
        """
        if shape is None:
            CombinatorialObject.__init__(self, [])
            self.vacancy_numbers = []
            self.rigging = []
        else:
            CombinatorialObject.__init__(self, shape)

            if vacancy_nums is not None:
                if len(shape) != len(vacancy_nums):
                    raise ValueError("Mismatch between shape and vacancy numbers")

                self.vacancy_numbers = list(vacancy_nums)
            else:
                self.vacancy_numbers = [None] * len(shape)

            if rigging_list is not None:

                if len(shape) != len(rigging_list):
                    raise ValueError("Mismatch between shape and rigging list")

                self.rigging = list(rigging_list)
            else:
                self.rigging = [None] * len(shape)
开发者ID:drupel,项目名称:sage,代码行数:49,代码来源:rigged_partition.py

示例11: __init__

 def __init__(self, parent, labels, list):
     """
     EXAMPLES::
     
         sage: from sage.combinat.species.structure import GenericSpeciesStructure
         sage: a = GenericSpeciesStructure(None, [2,3,4], [1,2,3])
         sage: a
         [2, 3, 4]
         sage: a.parent() is None
         True
         sage: a == loads(dumps(a))
         True
     """
     self._parent = parent
     self._labels = labels
     CombinatorialObject.__init__(self, list)
开发者ID:bgxcpku,项目名称:sagelib,代码行数:16,代码来源:structure.py

示例12: __init__

    def __init__(self,parent,data):
        r"""
        EXAMPLES::

            sage: Y = CrystalOfGeneralizedYoungWalls(2)
            sage: mg = Y.module_generators[0]
            sage: TestSuite(mg).run()
        """
        i = len(data)-1
        while i >= 0 and len(data[i]) == 0:
            data.pop()
            i -= 1
        self.rows = len(data)
        if data == []:
            self.cols = 0
        else:
            self.cols = max([len(r) for r in data])
        self.data = data
        CombinatorialObject.__init__(self, data)
        Element.__init__(self, parent)
开发者ID:odellus,项目名称:sage,代码行数:20,代码来源:generalized_young_walls.py


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