Ticket #13742: trac_13742_reviewer1.patch

File trac_13742_reviewer1.patch, 3.2 KB (added by ncohen, 8 years ago)

removing some of check_input=False

  • sage/combinat/integer_vector_weighted.py

    # HG changeset patch
    # User Dmitrii Pasechnik <dimpase@gmail.com>
    # Date 1353745800 -28800
    # Node ID 35e9dc53b31834bf5b2e9aef81c8906b56d667e3
    # Parent  d31813c790585c745100c8bf7723d2e628004f2a
    fixes for WeightedIntegerVector etc
    
    diff --git a/sage/combinat/integer_vector_weighted.py b/sage/combinat/integer_vector_weighted.py
    a b  
    33
    44.. WARNING::
    55
    6    This file uses the :class:`Permutation_class` class with the flag
    7    ``check_input = False``. It should not. Do not trust the
    8    results. See :trac:`13742`.
     6   The list(self) function in this file used the :class:`Permutation_class` class improperly, returning
     7   the list of, generally speaking, invalid permutations (repeated entries, including 0).
    98"""
    109#*****************************************************************************
    1110#       Copyright (C) 2007 Mike Hansen <mhansen@gmail.com>,
     
    3130def WeightedIntegerVectors(n, weight):
    3231    """
    3332    Returns the combinatorial class of integer vectors of n weighted by
    34     weight.
     33    weight, that is, the nonnegative integer vectors `(v_1,\\dots,v_{length(weight)})`
     34    satisfying `\\sum_i v_i weight[i]==n`.
    3535   
    3636    EXAMPLES::
    3737   
     
    163163
    164164        perm = Word(self.weight).standard_permutation()
    165165        l = [x for x in sorted(self.weight)]
    166         return [perm._left_to_right_multiply_on_right(Permutation_class(x, check_input = False)) for x in self._recfun(self.n,l)]
    167            
     166        return [perm.action(_) for _ in self._recfun(self.n,l)]
  • sage/combinat/permutation.py

    diff --git a/sage/combinat/permutation.py b/sage/combinat/permutation.py
    a b  
    1212   :trac:`13742`). This is dangerous. In particular, the
    1313   :meth:`Permutation_class._left_to_right_multiply_on_right` method (which can
    1414   be called trough multiplication) disables the input checks (see
    15    :method:`Permutation`). This should not happen. Do not trust the results.
     15   :meth:`Permutation`). This should not happen. Do not trust the results.
    1616
    1717AUTHORS:
    1818
     
    10021002        #different sizes
    10031003        new_rp = rp[:] + [i+1 for i in range(len(rp), len(self))]
    10041004        new_p1 = self[:] + [i+1 for i in range(len(self), len(rp))]
    1005         return Permutation([ new_rp[i-1] for i in new_p1 ], check_input = False)
     1005        return Permutation([ new_rp[i-1] for i in new_p1 ])
    10061006
    10071007    def __call__(self, i):
    10081008        r"""
     
    27082708        Returns the pair of standard tableaux obtained by running the
    27092709        Robinson-Schensted Algorithm on self.
    27102710
    2711         .. WARNING::
    2712 
    2713             The following examples do not check their input. This is wrong. See
    2714             :trac:`13742`.
    2715 
    27162711        EXAMPLES::
    27172712
    2718             sage: Permutation([6,2,3,1,7,5,4], check_input = False).robinson_schensted()
     2713            sage: Permutation([6,2,3,1,7,5,4]).robinson_schensted()
    27192714            [[[1, 3, 4], [2, 5], [6, 7]], [[1, 3, 5], [2, 6], [4, 7]]]
    27202715
     2716        The following example does not check their input. This is wrong. See
     2717        :trac:`13742`.
     2718
    27212719        It also works in the case of repeated letters. In this case only the
    27222720        second tableau is standard::
    27232721