# HG changeset patch
# User darij grinberg <darijgrinberg@gmail.com>
# Date 1371546397 25200
# Node ID aa7f503968cc68f92f1b915db44483804da50f4d
# Parent 114ecbdc53a3a670a4c8f91bc3f23ccbc30a40fe
#14763: response to review patch
diff git a/sage/combinat/partition.py b/sage/combinat/partition.py
a

b

class Partition(CombinatorialObject, Ele 
1622  1622  conj.extend([i]*(p[i1]  p[i])) 
1623  1623  return Partition(conj) 
1624  1624  
1625   def suter_diagonal_slide(self, n, exp=1): 
 1625  def suter_diagonal_slide(self, n, exp=1, check=True): 
1626  1626  r""" 
1627  1627  Return the image of ``self`` in `Y_n` under Suter's diagonal slide 
1628  1628  `\sigma_n`, where the notations used are those defined in [Sut2002]_. 
… 
… 
class Partition(CombinatorialObject, Ele 
1633  1633  than `n`, including the empty partition. 
1634  1634  
1635  1635  The map `\sigma_n` sends a partition 
1636   `(\lambda_1, \lambda_2, \ldots, \lambda_m) \in Y_n` to the partition 
 1636  `(\lambda_1, \lambda_2, \ldots, \lambda_m) \in Y_n` with 
 1637  `\lambda_m > 0` to the partition 
1637  1638  `(\lambda_2 + 1, \lambda_3 + 1, \ldots, \lambda_m + 1, 
1638  1639  \underbrace{1, 1, \ldots, 1}_{n  m  \lambda_1\text{ ones}})`. 
1639  1640  In other words, it pads the partition with trailing zeroes 
… 
… 
class Partition(CombinatorialObject, Ele 
1650  1651  
1651  1652  There are two *nonequivalent* definitions for `\sigma_n` in 
1652  1653  [Sut2002]_. Here are using the formulaic one, not the one using 
1653   the four steps. 
 1654  the four steps. (The definition using the four steps actually 
 1655  defines `\sigma_n^{1}` instead.) 
1654  1656  
1655  1657  INPUT: 
1656  1658  
1657  1659   ``n``  nonnegative integer 
1658  1660  
1659    ``exp``  (default: 1) how many times `\sigma_n` should be applied 
 1661   ``exp``  (default: `1`) integer specifying how many times 
 1662  `\sigma_n` should be applied 
 1663  
 1664   ``check``  (default: ``True``) Boolean specifying whether to 
 1665  verify that ``self`` indeed lies in `Y_n` 
1660  1666  
1661  1667  OUTPUT: 
1662  1668  
… 
… 
class Partition(CombinatorialObject, Ele 
1722  1728  Check for ``exp = 0``:: 
1723  1729  
1724  1730  sage: P = Partitions(4) 
1725   sage: all(p == p.suter_diagonal_slide(7, 0) for p in P) 
 1731  sage: all(p == p.suter_diagonal_slide(7, exp=0) for p in P) 
1726  1732  True 
1727  1733  
1728  1734  Check for invalid input:: 
… 
… 
class Partition(CombinatorialObject, Ele 
1742  1748  Europ. J. Combinatorics (2002) 23, 233238. 
1743  1749  http://www.sciencedirect.com/science/article/pii/S0195669801905414 
1744  1750  """ 
 1751  if check: 
 1752  if self.length() > 0 and self.hook_length(0, 0) >= n: # Check for valid input 
 1753  raise ValueError("the hook length must be less than n") 
 1754  
1745  1755  if exp == 0: 
1746  1756  return self 
1747  1757  
… 
… 
class Partition(CombinatorialObject, Ele 
1750  1760  leng = self.length() 
1751  1761  if leng == 0: # Taking extra care about the empty partition. 
1752  1762  return Partition([1] * (n  1)) 
1753   if self.hook_length(0, 0) >= n: # Check for valid input 
1754   raise ValueError("the hook length must be less than n") 
1755  1763  res = [i + 1 for i in self._list[1:]] 
1756  1764  res += [1] * (n  leng  self._list[0]) 
1757  1765  return Partition(res) 
… 
… 
class Partition(CombinatorialObject, Ele 
1761  1769  leng = self.length() 
1762  1770  if leng == 0: # Taking extra care about the empty partition. 
1763  1771  return Partition([n  1]) 
1764   if self.hook_length(0, 0) >= n: # Check for valid input 
1765   raise ValueError("the hook length must be less than n") 
1766  1772  res = [n  leng  1] 
1767  1773  res.extend([i  1 for i in self._list if i > 1]) 
1768  1774  return Partition(res) 
… 
… 
class Partition(CombinatorialObject, Ele 
1773  1779  if exp < n/2: 
1774  1780  while exp > 0: 
1775  1781  exp = 1 
1776   sc = sc.suter_diagonal_slide(n) 
 1782  sc = sc.suter_diagonal_slide(n, check=False) 
1777  1783  else: 
1778  1784  exp = exp 
1779  1785  while exp < 0: 
1780  1786  exp += 1 
1781   sc = sc.suter_diagonal_slide(n, exp=1) 
 1787  sc = sc.suter_diagonal_slide(n, exp=1, check=False) 
1782  1788  return sc 
1783  1789  
1784  1790  @combinatorial_map(name="reading tableau") 