Ticket #8420: trac_8420_features_perfect_matchings_review_review_vf.patch

File trac_8420_features_perfect_matchings_review_review_vf.patch, 3.0 KB (added by vferay, 12 years ago)
  • sage/combinat/perfect_matching.py

    # 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): 
    141141            ValueError: [(1, 2, 3), (4, 5)] is not a valid perfect matching: all elements of the list must be pairs
    142142
    143143        If you know your datas are in a good format, use directly
    144         `PerfectMatchings(objects)(data)`.
     144        ``PerfectMatchings(objects)(data)``.
    145145
    146146        TESTS::
    147147
  • sage/combinat/permutation.py

    diff --git a/sage/combinat/permutation.py b/sage/combinat/permutation.py
    a b class Permutation_class(CombinatorialObj 
    26192619
    26202620    def hyperoctahedral_double_coset_type(self):
    26212621        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.       
    26242623
    26252624        ``self`` must be a permutation of even size `2n`.  The coset-type
    26262625        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).
    26302634
    26312635        EXAMPLE::
    26322636
    class Permutation_class(CombinatorialObj 
    26382642            True
    26392643            sage: Permutation([]).hyperoctahedral_double_coset_type()
    26402644            []
     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
    26412649
    26422650        REFERENCES:
    26432651
    class Permutation_class(CombinatorialObj 
    26482656        from sage.combinat.perfect_matching import PerfectMatchings
    26492657        n = len(self)
    26502658        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
    26522660        S=PerfectMatchings(n)([(2*i+1,2*i+2) for i in range(n//2)])
    26532661        return S.loop_type(S.conjugate_by_permutation(self))
    26542662