Skip to content

Convert partitions into skew partitions automatically #40580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions src/sage/combinat/skew_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@
sage: SkewPartition([[4,3,1],[2]]).outer_corners()
[(0, 3), (1, 2), (2, 0)]

Any partition `p` can be viewed as a skew partition
`p / ()`. This is implemented as a default conversion::

sage: SkewPartition([2,2,1])
[2, 2, 1] / []
sage: SkewPartition(Partition([2]))
[2] / []

AUTHORS:

- Mike Hansen: Initial version
Expand Down Expand Up @@ -183,18 +191,36 @@ def __classcall_private__(cls, skp):
[2, 1]
sage: skp.outer()
[3, 2, 1]

Partitions can be converted into skew partitions::

sage: skp = SkewPartition([3,3,2]); skp
[3, 3, 2] / []
sage: skp = SkewPartition(Partition([3,3,2])); skp
[3, 3, 2] / []
sage: skp = SkewPartition([]); skp
[] / []
"""
skp = [_Partitions(p) for p in skp]
if skp not in SkewPartitions():
try:
skp_list = [_Partitions(p) for p in skp]
except ValueError:
if skp in _Partitions:
return SkewPartitions()([_Partitions(skp), _Partitions([])])
raise ValueError("invalid skew partition: %s" % p)
if skp_list not in SkewPartitions():
if not skp_list:
return SkewPartitions()([_Partitions([]), _Partitions([])])
raise ValueError("invalid skew partition: %s" % skp)
return SkewPartitions()(skp)
return SkewPartitions()(skp_list)

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

sage: skp = SkewPartition([[3,2,1],[2,1]])
sage: TestSuite(skp).run()
sage: skp = SkewPartition([3,2,1])
sage: TestSuite(skp).run()
"""
CombinatorialElement.__init__(self, parent,
[_Partitions(skp[0]), _Partitions(skp[1])])
Expand Down
Loading