本文整理汇总了Python中sage.combinat.partition.Partition.keys方法的典型用法代码示例。如果您正苦于以下问题:Python Partition.keys方法的具体用法?Python Partition.keys怎么用?Python Partition.keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.combinat.partition.Partition
的用法示例。
在下文中一共展示了Partition.keys方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: marking_iterator
# 需要导入模块: from sage.combinat.partition import Partition [as 别名]
# 或者: from sage.combinat.partition.Partition import keys [as 别名]
def marking_iterator(profile,left=None,standard=False):
r"""
Returns the marked profile associated to a partition
EXAMPLES::
sage: import surface_dynamics.interval_exchanges.rauzy_class_cardinality as rcc
sage: p = Partition([3,2,2])
sage: list(rcc.marking_iterator(p))
[(1, 2, 0),
(1, 2, 1),
(1, 3, 0),
(1, 3, 1),
(1, 3, 2),
(2, 2, 2),
(2, 2, 3),
(2, 3, 2)]
"""
e = Partition(sorted(profile,reverse=True)).to_exp_dict()
if left is not None:
assert(left in e)
if left is not None: keys = [left]
else: keys = e.keys()
for m in keys:
if standard: angles = range(1,m-1)
else: angles = range(0,m)
for a in angles:
yield (1,m,a)
for m_l in keys:
for m_r in e:
if m_l != m_r or e[m_l] > 1:
yield (2,m_l,m_r)