# 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
|
|
3 | 3 | |
4 | 4 | .. WARNING:: |
5 | 5 | |
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). |
9 | 8 | """ |
10 | 9 | #***************************************************************************** |
11 | 10 | # Copyright (C) 2007 Mike Hansen <mhansen@gmail.com>, |
… |
… |
|
31 | 30 | def WeightedIntegerVectors(n, weight): |
32 | 31 | """ |
33 | 32 | 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`. |
35 | 35 | |
36 | 36 | EXAMPLES:: |
37 | 37 | |
… |
… |
|
163 | 163 | |
164 | 164 | perm = Word(self.weight).standard_permutation() |
165 | 165 | 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)] |
diff --git a/sage/combinat/permutation.py b/sage/combinat/permutation.py
a
|
b
|
|
12 | 12 | :trac:`13742`). This is dangerous. In particular, the |
13 | 13 | :meth:`Permutation_class._left_to_right_multiply_on_right` method (which can |
14 | 14 | 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. |
16 | 16 | |
17 | 17 | AUTHORS: |
18 | 18 | |
… |
… |
|
1002 | 1002 | #different sizes |
1003 | 1003 | new_rp = rp[:] + [i+1 for i in range(len(rp), len(self))] |
1004 | 1004 | 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 ]) |
1006 | 1006 | |
1007 | 1007 | def __call__(self, i): |
1008 | 1008 | r""" |
… |
… |
|
2708 | 2708 | Returns the pair of standard tableaux obtained by running the |
2709 | 2709 | Robinson-Schensted Algorithm on self. |
2710 | 2710 | |
2711 | | .. WARNING:: |
2712 | | |
2713 | | The following examples do not check their input. This is wrong. See |
2714 | | :trac:`13742`. |
2715 | | |
2716 | 2711 | EXAMPLES:: |
2717 | 2712 | |
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() |
2719 | 2714 | [[[1, 3, 4], [2, 5], [6, 7]], [[1, 3, 5], [2, 6], [4, 7]]] |
2720 | 2715 | |
| 2716 | The following example does not check their input. This is wrong. See |
| 2717 | :trac:`13742`. |
| 2718 | |
2721 | 2719 | It also works in the case of repeated letters. In this case only the |
2722 | 2720 | second tableau is standard:: |
2723 | 2721 | |