# HG changeset patch
# User Andrew Mathas
# Date 1239754348 25200
# Node ID 46cd80c77302454a829ddf1a4e63634db93f5d75
# Parent 8a735e485328348e5f13a523804d3ebda5366d5e
add content function for tableaux (#5487)
diff r 8a735e485328 r 46cd80c77302 sage/combinat/all.py
a

b


43  43  from partition_algebra import SetPartitionsAk, SetPartitionsPk, SetPartitionsTk, SetPartitionsIk, SetPartitionsBk, SetPartitionsSk, SetPartitionsRk, SetPartitionsRk, SetPartitionsPRk 
44  44  
45  45  #Tableaux 
46   from tableau import Tableau, Tableaux, StandardTableaux, SemistandardTableaux 
 46  from tableau import Tableau, StandardTableau, Tableaux, StandardTableaux, SemistandardTableaux 
47  47  from skew_tableau import SkewTableau, StandardSkewTableaux, SemistandardSkewTableaux 
48  48  from ribbon import Ribbon, StandardRibbons 
49  49  from ribbon_tableau import RibbonTableaux, RibbonTableau, MultiSkewTableau, SemistandardMultiSkewTableaux 
diff r 8a735e485328 r 46cd80c77302 sage/combinat/tableau.py
a

b


1417  1417  lres[i] = ll[i]  ll[i1] 
1418  1418  return lres 
1419  1419  
 1420  def 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  
 1442  class 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 `cr`. 
 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 cr 
 1459  except: 
 1460  pass 
 1461  raise ValueError, '%d does not appear in tableau'%k 
1420  1462  
1421  1463  def from_chain(chain): 
1422  1464  """ 