Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit cdc060f

Browse files
Release Managervbraun
authored andcommitted
Trac #18018: implement componentwise comparison of tableaux
Implement a method that compares two tableaux and tells whether one is less than or equal to the other in every component. URL: http://trac.sagemath.org/18018 Reported by: opechenik Ticket author(s): Oliver Pechenik Reviewer(s): Darij Grinberg
2 parents 4945224 + ba5143c commit cdc060f

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

src/sage/combinat/tableau.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,6 +1581,55 @@ def cells_containing(self, i):
15811581
cell_list.append((r,c))
15821582
return cell_list
15831583

1584+
def leq(self, secondtab):
1585+
"""
1586+
Check whether each entry of ``self`` is less-or-equal to the
1587+
corresponding entry of a further tableau ``secondtab``.
1588+
1589+
INPUT:
1590+
1591+
- ``secondtab`` -- a tableau of the same shape as ``self``
1592+
1593+
EXAMPLES:
1594+
1595+
sage: T = Tableau([[1, 2], [3]])
1596+
sage: S = Tableau([[1, 3], [3]])
1597+
sage: G = Tableau([[2, 1], [4]])
1598+
sage: H = Tableau([[1, 2], [4]])
1599+
sage: T.leq(S)
1600+
True
1601+
sage: T.leq(T)
1602+
True
1603+
sage: T.leq(G)
1604+
False
1605+
sage: T.leq(H)
1606+
True
1607+
sage: S.leq(T)
1608+
False
1609+
sage: S.leq(G)
1610+
False
1611+
sage: S.leq(H)
1612+
False
1613+
sage: G.leq(H)
1614+
False
1615+
sage: H.leq(G)
1616+
False
1617+
1618+
TESTS::
1619+
1620+
sage: StandardTableau(T).leq(S)
1621+
True
1622+
sage: T.leq(SemistandardTableau(S))
1623+
True
1624+
"""
1625+
if not secondtab in Tableaux():
1626+
raise TypeError(secondtab + " must be a tableau")
1627+
sh = self.shape()
1628+
if sh != secondtab.shape():
1629+
raise TypeError("the tableaux must be the same shape")
1630+
return all( self[a][b] <= secondtab[a][b] for a in xrange(len(self))
1631+
for b in xrange(len(self[a])) )
1632+
15841633
def k_weight(self, k):
15851634
"""
15861635
Return the `k`-weight of ``self``.

0 commit comments

Comments
 (0)