本文整理汇总了Python中sage.combinat.partition.Partition.is_core方法的典型用法代码示例。如果您正苦于以下问题:Python Partition.is_core方法的具体用法?Python Partition.is_core怎么用?Python Partition.is_core使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.combinat.partition.Partition
的用法示例。
在下文中一共展示了Partition.is_core方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sage.combinat.partition import Partition [as 别名]
# 或者: from sage.combinat.partition.Partition import is_core [as 别名]
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)
示例2: __classcall_private__
# 需要导入模块: from sage.combinat.partition import Partition [as 别名]
# 或者: from sage.combinat.partition.Partition import is_core [as 别名]
def __classcall_private__(cls, part, k):
r"""
Implements the shortcut ``Core(part, k)`` to ``Cores(k,l)(part)``
where `l` is the length of the core.
TESTS::
sage: c = Core([2,1],4); c
[2, 1]
sage: c.parent()
4-Cores of length 3
sage: type(c)
<class 'sage.combinat.core.Cores_length_with_category.element_class'>
sage: Core([2,1],3)
Traceback (most recent call last):
...
ValueError: [2, 1] is not a 3-core
"""
if isinstance(part, cls):
return part
part = Partition(part)
if not part.is_core(k):
raise ValueError, "%s is not a %s-core"%(part, k)
l = sum(part.k_boundary(k).row_lengths())
return Cores(k, l)(part)