Ticket #14763: trac_14763-rereview-dg.patch

File trac_14763-rereview-dg.patch, 4.3 KB (added by darij, 8 years ago)

minor changes to Travis's review

  • sage/combinat/partition.py

    # 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 
    16221622                conj.extend([i]*(p[i-1] - p[i]))
    16231623            return Partition(conj)
    16241624
    1625     def suter_diagonal_slide(self, n, exp=1):
     1625    def suter_diagonal_slide(self, n, exp=1, check=True):
    16261626        r"""
    16271627        Return the image of ``self`` in `Y_n` under Suter's diagonal slide
    16281628        `\sigma_n`, where the notations used are those defined in [Sut2002]_.
    class Partition(CombinatorialObject, Ele 
    16331633        than `n`, including the empty partition.
    16341634
    16351635        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
    16371638        `(\lambda_2 + 1, \lambda_3 + 1, \ldots, \lambda_m + 1,
    16381639        \underbrace{1, 1, \ldots, 1}_{n - m - \lambda_1\text{ ones}})`.
    16391640        In other words, it pads the partition with trailing zeroes
    class Partition(CombinatorialObject, Ele 
    16501651
    16511652            There are two *non-equivalent* definitions for `\sigma_n` in
    16521653            [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.)
    16541656       
    16551657        INPUT:
    16561658
    16571659        - ``n`` -- nonnegative integer
    16581660
    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`
    16601666
    16611667        OUTPUT:
    16621668       
    class Partition(CombinatorialObject, Ele 
    17221728        Check for ``exp = 0``::
    17231729
    17241730            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)
    17261732            True
    17271733
    17281734        Check for invalid input::
    class Partition(CombinatorialObject, Ele 
    17421748           Europ. J. Combinatorics (2002) 23, 233--238.
    17431749           http://www.sciencedirect.com/science/article/pii/S0195669801905414
    17441750        """
     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
    17451755        if exp == 0:
    17461756            return self
    17471757
    class Partition(CombinatorialObject, Ele 
    17501760            leng = self.length()
    17511761            if leng == 0:   # Taking extra care about the empty partition.
    17521762                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")
    17551763            res = [i + 1 for i in self._list[1:]]
    17561764            res += [1] * (n - leng - self._list[0])
    17571765            return Partition(res)
    class Partition(CombinatorialObject, Ele 
    17611769            leng = self.length()
    17621770            if leng == 0:   # Taking extra care about the empty partition.
    17631771                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")
    17661772            res = [n - leng - 1]
    17671773            res.extend([i - 1 for i in self._list if i > 1])
    17681774            return Partition(res)
    class Partition(CombinatorialObject, Ele 
    17731779        if exp < n/2:
    17741780            while exp > 0:
    17751781                exp -= 1
    1776                 sc = sc.suter_diagonal_slide(n)
     1782                sc = sc.suter_diagonal_slide(n, check=False)
    17771783        else:
    17781784            exp = -exp
    17791785            while exp < 0:
    17801786                exp += 1
    1781                 sc = sc.suter_diagonal_slide(n, exp=-1)
     1787                sc = sc.suter_diagonal_slide(n, exp=-1, check=False)
    17821788        return sc
    17831789
    17841790    @combinatorial_map(name="reading tableau")