Skip to content

Commit 3441558

Browse files
author
Release Manager
committed
gh-36200: Fixing the iterator of SemistandardMultiSkewTableaux <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes #1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> Fixes #36196 as the iterator does not update the position as it goes through the word. <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #36200 Reported by: Travis Scrimshaw Reviewer(s): Frédéric Chapoton
2 parents 307712d + eed72b2 commit 3441558

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

src/sage/combinat/ribbon_tableau.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,9 @@ def __contains__(self, x):
10831083
return all(xi.is_semistandard() for xi in x)
10841084

10851085
def __iter__(self):
1086-
"""
1086+
r"""
1087+
Iterate over ``self``.
1088+
10871089
EXAMPLES::
10881090
10891091
sage: sp = SkewPartitions(3).list()
@@ -1098,6 +1100,21 @@ def __iter__(self):
10981100
34
10991101
sage: RibbonTableaux(a,weight,k).cardinality()
11001102
34
1103+
1104+
TESTS:
1105+
1106+
Check that :issue:`36196` is fixed::
1107+
1108+
sage: shapes = [[[1], [0]], [[1], [0]], [[1], [0]]]
1109+
sage: weight = [1, 1, 1]
1110+
sage: SMST = SemistandardMultiSkewTableaux(shapes, weight)
1111+
sage: list(SMST)
1112+
[[[[1]], [[2]], [[3]]],
1113+
[[[2]], [[1]], [[3]]],
1114+
[[[1]], [[3]], [[2]]],
1115+
[[[2]], [[3]], [[1]]],
1116+
[[[3]], [[1]], [[2]]],
1117+
[[[3]], [[2]], [[1]]]]
11011118
"""
11021119
parts = self._shape
11031120
mu = self._weight
@@ -1122,9 +1139,12 @@ def __iter__(self):
11221139
S = SkewTableaux()
11231140
for lk in l:
11241141
pos = 0 # Double check this
1125-
restmp = [S.from_shape_and_word(parts[0], [lk[j] for j in range(s[0])])]
1142+
lk = list(lk)
1143+
w = lk[:s[0]]
1144+
restmp = [S.from_shape_and_word(parts[0], w)]
11261145
for i in range(1, len(parts)):
1127-
w = [lk[j] for j in range(pos + s[i - 1], pos + s[i - 1] + s[i])]
1146+
pos += s[i-1]
1147+
w = lk[pos: pos + s[i]]
11281148
restmp.append(S.from_shape_and_word(parts[i], w))
11291149
yield self.element_class(self, restmp)
11301150

0 commit comments

Comments
 (0)