Ticket #5487: tableau-content-5487-AM.patch

File tableau-content-5487-AM.patch, 2.2 KB (added by andrew.mathas, 13 years ago)
  • sage/combinat/all.py

    diff -r bb8fd27a29c5 sage/combinat/all.py
    a b  
    4343from partition_algebra import SetPartitionsAk, SetPartitionsPk, SetPartitionsTk, SetPartitionsIk, SetPartitionsBk, SetPartitionsSk, SetPartitionsRk, SetPartitionsRk, SetPartitionsPRk
    4444
    4545#Tableaux
    46 from tableau import Tableau, Tableaux, StandardTableaux, SemistandardTableaux
     46from tableau import Tableau, StandardTableau, Tableaux, StandardTableaux, SemistandardTableaux
    4747from skew_tableau import SkewTableau, StandardSkewTableaux, SemistandardSkewTableaux
    4848from ribbon import Ribbon, StandardRibbons
    4949from ribbon_tableau import RibbonTableaux, RibbonTableau, MultiSkewTableau, SemistandardMultiSkewTableaux
  • sage/combinat/tableau.py

    diff -r bb8fd27a29c5 sage/combinat/tableau.py
    a b  
    14171417            lres[i] = ll[i] - ll[i-1]
    14181418        return lres
    14191419
     1420def StandardTableau(t):
     1421    """
     1422    Returns the standard tableau object corresponding to t.
     1423   
     1424    Note that Sage uses the English convention for partitions and
     1425    tableaux.
     1426   
     1427    EXAMPLES::
     1428   
     1429        sage: t = StandardTableau([[1,2,3],[4,5]]); t
     1430        [[1, 2, 3], [4, 5]]
     1431        sage: t.shape()
     1432        [3, 2]
     1433        sage: t.is_standard()
     1434        True
     1435    """
     1436    if isinstance(t, StandardTableau_class):
     1437        return t
     1438    elif t in StandardTableaux_all():
     1439        return StandardTableau_class(t)
     1440    raise ValueError, "not a standard tableau"
     1441
     1442class StandardTableau_class(Tableau_class):
     1443   
     1444    def content(self, k):
     1445        """
     1446        Returns the content of ``k`` in a standard tableau. That is, if
     1447        ``k`` appears in row `r` and column `c` of the tableau then we
     1448        return `c-r`.
     1449       
     1450        EXAMPLES:
     1451            sage: StandardTableau([[1,2],[3,4]]).content(3)
     1452            -1
     1453         
     1454        """
     1455        for r in range(len(self)):
     1456          try:
     1457            c=self[r].index(k)
     1458            return c-r
     1459          except:
     1460            pass
     1461        raise ValueError, '%d does not appear in tableau'%k
    14201462
    14211463def from_chain(chain):
    14221464    """