本文整理汇总了Python中sage.combinat.combinat.CombinatorialObject.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python CombinatorialObject.__init__方法的具体用法?Python CombinatorialObject.__init__怎么用?Python CombinatorialObject.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.combinat.combinat.CombinatorialObject
的用法示例。
在下文中一共展示了CombinatorialObject.__init__方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sage.combinat.combinat import CombinatorialObject [as 别名]
# 或者: from sage.combinat.combinat.CombinatorialObject import __init__ [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: __init__
# 需要导入模块: from sage.combinat.combinat import CombinatorialObject [as 别名]
# 或者: from sage.combinat.combinat.CombinatorialObject import __init__ [as 别名]
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)
示例3: __init__
# 需要导入模块: from sage.combinat.combinat import CombinatorialObject [as 别名]
# 或者: from sage.combinat.combinat.CombinatorialObject import __init__ [as 别名]
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)
示例4: __init__
# 需要导入模块: from sage.combinat.combinat import CombinatorialObject [as 别名]
# 或者: from sage.combinat.combinat.CombinatorialObject import __init__ [as 别名]
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)
示例5: __init__
# 需要导入模块: from sage.combinat.combinat import CombinatorialObject [as 别名]
# 或者: from sage.combinat.combinat.CombinatorialObject import __init__ [as 别名]
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)
示例6: __init__
# 需要导入模块: from sage.combinat.combinat import CombinatorialObject [as 别名]
# 或者: from sage.combinat.combinat.CombinatorialObject import __init__ [as 别名]
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)
示例7: __init__
# 需要导入模块: from sage.combinat.combinat import CombinatorialObject [as 别名]
# 或者: from sage.combinat.combinat.CombinatorialObject import __init__ [as 别名]
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)
示例8: __init__
# 需要导入模块: from sage.combinat.combinat import CombinatorialObject [as 别名]
# 或者: from sage.combinat.combinat.CombinatorialObject import __init__ [as 别名]
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)
示例9: __init__
# 需要导入模块: from sage.combinat.combinat import CombinatorialObject [as 别名]
# 或者: from sage.combinat.combinat.CombinatorialObject import __init__ [as 别名]
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)
示例10: __init__
# 需要导入模块: from sage.combinat.combinat import CombinatorialObject [as 别名]
# 或者: from sage.combinat.combinat.CombinatorialObject import __init__ [as 别名]
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)
示例11: __init__
# 需要导入模块: from sage.combinat.combinat import CombinatorialObject [as 别名]
# 或者: from sage.combinat.combinat.CombinatorialObject import __init__ [as 别名]
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)
示例12: __init__
# 需要导入模块: from sage.combinat.combinat import CombinatorialObject [as 别名]
# 或者: from sage.combinat.combinat.CombinatorialObject import __init__ [as 别名]
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)