diff --git a/src/sage/combinat/diagram.py b/src/sage/combinat/diagram.py index 2da21bbe3e0..38b4a9166ef 100644 --- a/src/sage/combinat/diagram.py +++ b/src/sage/combinat/diagram.py @@ -42,10 +42,10 @@ class Diagram(ClonableArray, metaclass=InheritComparisonClasscallMetaclass): r""" - Combinatorial diagrams with positions indexed by rows in columns. + Combinatorial diagrams with positions indexed by rows and columns. The positions are indexed by rows and columns as in a matrix. For example, - a Ferrer's diagram is a diagram obtained from a partition + a Ferrers diagram is a diagram obtained from a partition `\lambda = (\lambda_0, \lambda_1, \ldots, \lambda_{\ell})`, where the cells are in rows `i` for `0 \leq i \leq \ell` and the cells in row `i` consist of `(i,j)` for `0 \leq j < \lambda_i`. In English notation, the @@ -57,7 +57,7 @@ class Diagram(ClonableArray, metaclass=InheritComparisonClasscallMetaclass): EXAMPLES: - To create an arbirtrary diagram, pass a list of all cells:: + To create an arbitrary diagram, pass a list of all cells:: sage: from sage.combinat.diagram import Diagram sage: cells = [(0,0), (0,1), (1,0), (1,1), (4,4), (4,5), (4,6), (5,4), (7, 6)] @@ -469,7 +469,7 @@ def check(self): sage: D.check() In the next two examples, a bad diagram is passed. - The first example fails because one cells is indexed by negative + The first example fails because one cell is indexed by negative integers:: sage: D = Diagram([(0,0), (0,-3), (2,2), (2,4)]) diff --git a/src/sage/combinat/specht_module.py b/src/sage/combinat/specht_module.py index 3a238c7eeb0..afd454b0dab 100644 --- a/src/sage/combinat/specht_module.py +++ b/src/sage/combinat/specht_module.py @@ -394,6 +394,15 @@ def specht_module_spanning_set(D, SGA=None): sage: specht_module_spanning_set([(0,0), (1,1), (2,1)], SGA) (() - (2,3), -(1,2) + (1,3,2), (1,2,3) - (1,3), -() + (2,3), -(1,2,3) + (1,3), (1,2) - (1,3,2)) + + TESTS: + + Verify that diagrams bigger than the rank work:: + + sage: specht_module_spanning_set([(0,0), (3,5)]) + ([1, 2], [2, 1]) + sage: specht_module_spanning_set([(0,0), (5,3)]) + ([1, 2], [2, 1]) """ n = len(D) if SGA is None: @@ -401,10 +410,12 @@ def specht_module_spanning_set(D, SGA=None): SGA = SymmetricGroupAlgebra(QQ, n) elif SGA.group().rank() != n - 1: raise ValueError("the rank does not match the size of the diagram") - row_diagram = [set() for _ in range(n)] - col_diagram = [set() for _ in range(n)] - for i,cell in enumerate(D): - x,y = cell + nr = max((c[0] for c in D), default=0) + 1 + nc = max((c[1] for c in D), default=0) + 1 + row_diagram = [set() for _ in range(nr)] + col_diagram = [set() for _ in range(nc)] + for i, cell in enumerate(D): + x, y = cell row_diagram[x].add(i) col_diagram[y].add(i) # Construct the row and column stabilizer elements @@ -412,17 +423,17 @@ def specht_module_spanning_set(D, SGA=None): col_stab = SGA.zero() B = SGA.basis() for w in B.keys(): - # Remember that the permutation w is 1-based - row_perm = [set() for _ in range(n)] - col_perm = [set() for _ in range(n)] - for i,cell in enumerate(D): - x,y = cell - row_perm[x].add(w(i+1)-1) - col_perm[y].add(w(i+1)-1) - if row_diagram == row_perm: - row_stab += B[w] - if col_diagram == col_perm: - col_stab += w.sign() * B[w] + # Remember that the permutation w is 1-based + row_perm = [set() for _ in range(nr)] + col_perm = [set() for _ in range(nc)] + for i, cell in enumerate(D): + x, y = cell + row_perm[x].add(w(i+1)-1) + col_perm[y].add(w(i+1)-1) + if row_diagram == row_perm: + row_stab += B[w] + if col_diagram == col_perm: + col_stab += w.sign() * B[w] gen = col_stab * row_stab return tuple([b * gen for b in B])