# HG changeset patch
# User Valentin Feray <feray at labri.fr>
# Date 1269250157 -3600
# Node ID 3f112fa597dfeeae129e492181646d34477e58f1
# Parent d7065e38875b1d2b7cdf2ef0174829920a666c29
[mq]: trac_8420_perfect_matchings_review_review_vf.patch
diff --git a/sage/combinat/perfect_matching.py b/sage/combinat/perfect_matching.py
a
|
b
|
class PerfectMatching(ElementWrapper): |
141 | 141 | ValueError: [(1, 2, 3), (4, 5)] is not a valid perfect matching: all elements of the list must be pairs |
142 | 142 | |
143 | 143 | If you know your datas are in a good format, use directly |
144 | | `PerfectMatchings(objects)(data)`. |
| 144 | ``PerfectMatchings(objects)(data)``. |
145 | 145 | |
146 | 146 | TESTS:: |
147 | 147 | |
diff --git a/sage/combinat/permutation.py b/sage/combinat/permutation.py
a
|
b
|
class Permutation_class(CombinatorialObj |
2619 | 2619 | |
2620 | 2620 | def hyperoctahedral_double_coset_type(self): |
2621 | 2621 | r""" |
2622 | | Returns the coset type of ``self`` as a |
2623 | | :mod:`perfect matching <sage.combinat.perfect_matching>`. |
| 2622 | Returns the coset-type of ``self`` as a partition. |
2624 | 2623 | |
2625 | 2624 | ``self`` must be a permutation of even size `2n`. The coset-type |
2626 | 2625 | determines the double class of the permutation, that is its image in |
2627 | | `H_n \backslash S_2n / H_n`, where `H_n` is the hyperoctahedral group of order |
2628 | | `n` (see [Mcd]_ for more details). It is returned as an instance of |
2629 | | :class:`PerfectMatching <sage.combinat.perfect_matching.PerfectMatching>`. |
| 2626 | `H_n \backslash S_2n / H_n`, where `H_n` is the hyperoctahedral group |
| 2627 | of order `n`. |
| 2628 | |
| 2629 | The coset-type is determined as follows. Consider the perfect matching |
| 2630 | `\{\{1,2\},\{3,4\},\dots,\{2n-1,2n\}\}` and its image by ``self`` and |
| 2631 | draw them simultaneously as edges of a graph whose vertices are labeled |
| 2632 | by `1,2,\dots,2n`. The coset-type is the ordered sequence of the |
| 2633 | semi-lengths of the loops of this graph (see [Mcd]_ for more details). |
2630 | 2634 | |
2631 | 2635 | EXAMPLE:: |
2632 | 2636 | |
… |
… |
class Permutation_class(CombinatorialObj |
2638 | 2642 | True |
2639 | 2643 | sage: Permutation([]).hyperoctahedral_double_coset_type() |
2640 | 2644 | [] |
| 2645 | sage: Permutation([3,1,2]).hyperoctahedral_double_coset_type() |
| 2646 | Traceback (most recent call last): |
| 2647 | ... |
| 2648 | ValueError: [3, 1, 2] is a permutation of odd size and has no coset-type |
2641 | 2649 | |
2642 | 2650 | REFERENCES: |
2643 | 2651 | |
… |
… |
class Permutation_class(CombinatorialObj |
2648 | 2656 | from sage.combinat.perfect_matching import PerfectMatchings |
2649 | 2657 | n = len(self) |
2650 | 2658 | if n%2==1: |
2651 | | raise ValueError, "%s is a permutation of odd size and has no coset-type"%p |
| 2659 | raise ValueError, "%s is a permutation of odd size and has no coset-type"%self |
2652 | 2660 | S=PerfectMatchings(n)([(2*i+1,2*i+2) for i in range(n//2)]) |
2653 | 2661 | return S.loop_type(S.conjugate_by_permutation(self)) |
2654 | 2662 | |