Ticket #13750: trac_13750.patch

File trac_13750.patch, 15.3 KB (added by ncohen, 8 years ago)
  • sage/combinat/permutation.py

    # HG changeset patch
    # User Nathann Cohen <nathann.cohen@gmail.com>
    # Date 1353794456 -3600
    # Node ID 0348e8ffb3b57b3b56b6273b49cbbfd293dffac8
    # Parent  2687be1a040089cf46ec3290d801c879497c0aac
    List of functions in the Permutations file
    
    diff --git a/sage/combinat/permutation.py b/sage/combinat/permutation.py
    a b  
    1414   be called trough multiplication) disables the input checks (see
    1515   :meth:`Permutation`). This should not happen. Do not trust the results.
    1616
     17What does this file defines ?
     18^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     19
     20The main part of this file consists in te definition of permutation objects,
     21i.e. the :meth:`Permutation` method and the
     22:class:`~sage.combinat.permutation.Permutation_class` class. Global options for
     23elements of the permutation class can be set through the
     24:meth:`PermutationOptions` method.
     25
     26Below are listed all methods and classes defined in this file.
     27
     28**Methods of Permutations objects**
     29
     30.. csv-table::
     31    :class: contentstable
     32    :widths: 30, 70
     33    :delim: |
     34
     35    :meth:`~sage.combinat.permutation.Permutation_class.size` | Returns the size of the permutation 'self'.
     36    :meth:`~sage.combinat.permutation.Permutation_class.cycle_string` | Returns a string of the permutation in cycle notation.
     37    :meth:`~sage.combinat.permutation.Permutation_class.next` | Returns the permutation that follows p in lexicographic order.
     38    :meth:`~sage.combinat.permutation.Permutation_class.prev` | Returns the permutation that comes directly before p in lexicographic order.
     39    :meth:`~sage.combinat.permutation.Permutation_class.to_tableau_by_shape` | Returns a tableau of shape shape with the entries in self.
     40    :meth:`~sage.combinat.permutation.Permutation_class.to_cycles` | Returns the permutation p as a list of disjoint cycles.
     41    :meth:`~sage.combinat.permutation.Permutation_class.to_permutation_group_element` | Returns a PermutationGroupElement equal to self.
     42    :meth:`~sage.combinat.permutation.Permutation_class.signature` | Returns the signature of a permutation.
     43    :meth:`~sage.combinat.permutation.Permutation_class.is_even` | Returns True if the permutation p is even and false otherwise.
     44    :meth:`~sage.combinat.permutation.Permutation_class.to_matrix` | Returns a matrix representing the permutation.
     45    :meth:`~sage.combinat.permutation.Permutation_class.rank` | Returns the rank of a permutation in lexicographic ordering.
     46    :meth:`~sage.combinat.permutation.Permutation_class.to_inversion_vector` | Returns the inversion vector of a permutation p.
     47    :meth:`~sage.combinat.permutation.Permutation_class.inversions` | Returns a list of the inversions of permutation p.
     48    :meth:`~sage.combinat.permutation.Permutation_class.show` | Displays the permutation as a drawing.
     49    :meth:`~sage.combinat.permutation.Permutation_class.number_of_inversions` | Returns the number of inversions in the permutation p.
     50    :meth:`~sage.combinat.permutation.Permutation_class.length` | Returns the Coxeter length of a permutation p.
     51    :meth:`~sage.combinat.permutation.Permutation_class.inverse` | Returns the inverse of a permutation
     52    :meth:`~sage.combinat.permutation.Permutation_class.ishift` | Returns an the i-shift of self.
     53    :meth:`~sage.combinat.permutation.Permutation_class.iswitch` | Returns an the i-switch of self.
     54    :meth:`~sage.combinat.permutation.Permutation_class.runs` | Returns a list of the runs in the permutation p.
     55    :meth:`~sage.combinat.permutation.Permutation_class.longest_increasing_subsequence_length` | Returns the length of the longest increasing subsequences
     56    :meth:`~sage.combinat.permutation.Permutation_class.longest_increasing_subsequences` | Returns the list of the longest increasing subsequences
     57    :meth:`~sage.combinat.permutation.Permutation_class.cycle_type` | Returns a partition of len(p) corresponding to the cycle type of p.
     58    :meth:`~sage.combinat.permutation.Permutation_class.to_lehmer_code` | Returns the Lehmer code of the permutation p.
     59    :meth:`~sage.combinat.permutation.Permutation_class.to_lehmer_cocode` | Returns the Lehmer cocode of p.
     60    :meth:`~sage.combinat.permutation.Permutation_class.reduced_word` | Returns the reduced word of a permutation.
     61    :meth:`~sage.combinat.permutation.Permutation_class.reduced_words` | Returns a list of the reduced words of the permutation p.
     62    :meth:`~sage.combinat.permutation.Permutation_class.reduced_word_lexmin` | Returns a lexicographically minimal reduced word of a permutation.
     63    :meth:`~sage.combinat.permutation.Permutation_class.fixed_points` | Returns a list of the fixed points of the permutation p.
     64    :meth:`~sage.combinat.permutation.Permutation_class.number_of_fixed_points` | Returns the number of fixed points of the permutation p.
     65    :meth:`~sage.combinat.permutation.Permutation_class.recoils` | Returns the list of the positions of the recoils of the permutation
     66    :meth:`~sage.combinat.permutation.Permutation_class.number_of_recoils` | Returns the number of recoils of the permutation p.
     67    :meth:`~sage.combinat.permutation.Permutation_class.recoils_composition` | Returns the composition corresponding to recoils
     68    :meth:`~sage.combinat.permutation.Permutation_class.descents` | Returns the list of the descents of the permutation p.
     69    :meth:`~sage.combinat.permutation.Permutation_class.idescents` | Returns a list of the idescents of self
     70    :meth:`~sage.combinat.permutation.Permutation_class.idescents_signature` | Each position in self is mapped to -1 if it is an idescent and 1 if it is not an idescent.
     71    :meth:`~sage.combinat.permutation.Permutation_class.number_of_descents` | Returns the number of descents of the permutation p.
     72    :meth:`~sage.combinat.permutation.Permutation_class.number_of_idescents` | Returns the number of descents of the permutation p.
     73    :meth:`~sage.combinat.permutation.Permutation_class.descents_composition` | Returns the composition corresponding to the descents.
     74    :meth:`~sage.combinat.permutation.Permutation_class.descent_polynomial` | Returns the descent polynomial of the permutation p.
     75    :meth:`~sage.combinat.permutation.Permutation_class.major_index` | Returns the major index of the permutation p.
     76    :meth:`~sage.combinat.permutation.Permutation_class.imajor_index` | Returns the inverse major index of the permutation self.
     77    :meth:`~sage.combinat.permutation.Permutation_class.to_major_code` | Returns the major code of the permutation p.
     78    :meth:`~sage.combinat.permutation.Permutation_class.peaks` | Returns a list of the peaks of the permutation p.
     79    :meth:`~sage.combinat.permutation.Permutation_class.number_of_peaks` | Returns the number of peaks of the permutation p.
     80    :meth:`~sage.combinat.permutation.Permutation_class.saliances` | Returns a list of the saliances of the permutation p.
     81    :meth:`~sage.combinat.permutation.Permutation_class.number_of_saliances` | Returns the number of saliances of the permutation p.
     82    :meth:`~sage.combinat.permutation.Permutation_class.bruhat_lequal` | Returns True if self is less than p2 in the Bruhat order.
     83    :meth:`~sage.combinat.permutation.Permutation_class.weak_excedences` | Returns all the numbers self[i] such that self[i] >= i+1.
     84    :meth:`~sage.combinat.permutation.Permutation_class.bruhat_inversions` | Returns the list of inversions of p such that the application of this inversion to p decrements its number of inversions.
     85    :meth:`~sage.combinat.permutation.Permutation_class.bruhat_inversions_iterator` | Returns an iterator over Bruhat inversions
     86    :meth:`~sage.combinat.permutation.Permutation_class.bruhat_succ` | Returns a list of the permutations strictly greater than p in the Bruhat order such that there is no permutation between one of those and p.
     87    :meth:`~sage.combinat.permutation.Permutation_class.bruhat_succ_iterator` | An iterator for the permutations that are strictly greater than p in the Bruhat order such that there is no permutation between one of those and p.
     88    :meth:`~sage.combinat.permutation.Permutation_class.bruhat_pred` | Returns a list of the permutations strictly smaller than p in the Bruhat order such that there is no permutation between one of those and p.
     89    :meth:`~sage.combinat.permutation.Permutation_class.bruhat_pred_iterator` | An iterator for the permutations strictly smaller than p in the Bruhat order such that there is no permutation between one of those and p.
     90    :meth:`~sage.combinat.permutation.Permutation_class.bruhat_smaller` | Returns a the combinatorial class of permutations smaller than or equal to p in the Bruhat order.
     91    :meth:`~sage.combinat.permutation.Permutation_class.bruhat_greater` | Returns the combinatorial class of permutations greater than or equal to p in the Bruhat order.
     92    :meth:`~sage.combinat.permutation.Permutation_class.permutohedron_lequal` | Returns True if self is less than p2 in the permutohedron order.
     93    :meth:`~sage.combinat.permutation.Permutation_class.permutohedron_succ` | Returns a list of the permutations strictly greater than p in the permutohedron order such that there is no permutation between one of those and p.
     94    :meth:`~sage.combinat.permutation.Permutation_class.permutohedron_pred` | Returns a list of the permutations strictly smaller than p in the permutohedron order such that there is no permutation between one of those and p.
     95    :meth:`~sage.combinat.permutation.Permutation_class.permutohedron_smaller` | Returns a list of permutations smaller than or equal to p in the permutohedron order.
     96    :meth:`~sage.combinat.permutation.Permutation_class.permutohedron_greater` | Returns a list of permutations greater than or equal to p in the permutohedron order.
     97    :meth:`~sage.combinat.permutation.Permutation_class.has_pattern` | Tests whether the permutation matches the pattern.
     98    :meth:`~sage.combinat.permutation.Permutation_class.avoids` | Tests whether the permutation avoids the pattern.
     99    :meth:`~sage.combinat.permutation.Permutation_class.pattern_positions` | Returns the list of positions where the pattern patt appears in p.
     100    :meth:`~sage.combinat.permutation.Permutation_class.reverse` | Returns the permutation obtained by reversing the list.
     101    :meth:`~sage.combinat.permutation.Permutation_class.complement` | Returns the complement of the permutation which is obtained by replacing each value `x` in the list with `n - x + 1`
     102    :meth:`~sage.combinat.permutation.Permutation_class.dict` | Returns a dictionary corresponding to the permutation.
     103    :meth:`~sage.combinat.permutation.Permutation_class.action` | Returns the action of the permutation on a list.
     104    :meth:`~sage.combinat.permutation.Permutation_class.robinson_schensted` | Returns the pair of standard tableaux obtained by running the Robinson-Schensted Algorithm on self.
     105    :meth:`~sage.combinat.permutation.Permutation_class.left_tableau` | Returns the right standard tableau after performing the RSK
     106    :meth:`~sage.combinat.permutation.Permutation_class.right_tableau` | Returns the right standard tableau after performing the RSK
     107    :meth:`~sage.combinat.permutation.Permutation_class.remove_extra_fixed_points` | Returns the permutation obtained by removing any fixed points at the end of self.
     108    :meth:`~sage.combinat.permutation.Permutation_class.hyperoctahedral_double_coset_type` | Returns the coset-type of ``self`` as a partition.
     109
     110**Other classes defined in this file**
     111
     112.. csv-table::
     113    :class: contentstable
     114    :widths: 30, 70
     115    :delim: |
     116
     117    :class:`Permutations_nk` |
     118    :class:`Permutations_mset` |
     119    :class:`Permutations_set` |
     120    :class:`Permutations_msetk` |
     121    :class:`Permutations_setk` |
     122    :meth:`Arrangements` |
     123    :class:`Arrangements_msetk` |
     124    :class:`Arrangements_setk` |
     125    :class:`StandardPermutations_all` |
     126    :class:`StandardPermutations_n` |
     127    :class:`StandardPermutations_descents` |
     128    :class:`StandardPermutations_recoilsfiner` |
     129    :class:`StandardPermutations_recoilsfatter` |
     130    :class:`StandardPermutations_recoils` |
     131    :class:`StandardPermutations_bruhat_smaller` |
     132    :class:`StandardPermutations_bruhat_greater` |
     133    :class:`CyclicPermutations_mset` |
     134    :meth:`CyclicPermutations` |
     135    :meth:`CyclicPermutationsOfPartition` |
     136    :class:`CyclicPermutationsOfPartition_partition` |
     137    :class:`StandardPermutations_avoiding_12` |
     138    :class:`StandardPermutations_avoiding_21` |
     139    :class:`StandardPermutations_avoiding_132` |
     140    :class:`StandardPermutations_avoiding_123` |
     141    :class:`StandardPermutations_avoiding_321` |
     142    :class:`StandardPermutations_avoiding_231` |
     143    :class:`StandardPermutations_avoiding_312` |
     144    :class:`StandardPermutations_avoiding_213` |
     145    :class:`StandardPermutations_avoiding_generic` |
     146    :class:`PatternAvoider` |
     147    :meth:`Permutations` |
     148
     149**Functions defined in this file**
     150
     151.. csv-table::
     152    :class: contentstable
     153    :widths: 30, 70
     154    :delim: |
     155
     156    :meth:`from_major_code` | Returns the permutation corresponding to major code mc.
     157    :meth:`from_permutation_group_element` | Returns a Permutation give a PermutationGroupElement pge.
     158    :meth:`from_rank` | Returns the permutation with the specified lexicographic rank. The
     159    :meth:`from_inversion_vector` | Returns the permutation corresponding to inversion vector iv.
     160    :meth:`from_cycles` | Returns the permutation corresponding to cycles.
     161    :meth:`from_lehmer_code` | Returns the permutation with Lehmer code lehmer.
     162    :meth:`from_reduced_word` | Returns the permutation corresponding to the reduced word rw.
     163    :meth:`robinson_schensted_inverse` | Returns the permutation corresponding to the pair of tableaux `(p,q)`
     164    :meth:`bistochastic_as_sum_of_permutations` | Returns the matrix as a linear combination of permutations.
     165    :meth:`descents_composition_list` | Returns a list of all the permutations that have a descent
     166    :meth:`descents_composition_first` | Computes the smallest element of a descent class having a descent
     167    :meth:`descents_composition_last` | Returns the largest element of a descent class having a descent
     168    :meth:`bruhat_lequal` | Returns True if p1 is less than p2 in the Bruhat order.
     169    :meth:`permutohedron_lequal` | Returns True if p1 is less than p2 in the permutohedron order.
     170    :meth:`to_standard` | Returns a standard permutation corresponding to the permutation p.
     171
    17172AUTHORS:
    18173
    19174- Mike Hansen
     
    23178- Sebastien Labbe (2009-03-17): added robinson_schensted_inverse
    24179
    25180- Travis Scrimshaw (2012-08-16): to_standard() no longer modifies input
     181
     182Classes and methods
     183===================
    26184"""
    27185#*****************************************************************************
    28 #       Copyright (C) 2007 Mike Hansen <mhansen@gmail.com>, 
     186#       Copyright (C) 2007 Mike Hansen <mhansen@gmail.com>,
    29187#
    30188#  Distributed under the terms of the GNU General Public License (GPL)
    31189#
     
    25822740
    25832741    def has_pattern(self, patt):
    25842742        r"""
    2585         Returns the boolean answering the question 'Is patt a pattern
    2586         appearing in permutation p?'
     2743        Tests whether the permutation matches the pattern.
    25872744       
    25882745        EXAMPLES::
    25892746       
     
    26022759
    26032760    def avoids(self, patt):
    26042761        """
    2605         Returns True if the permutation avoid the pattern patt and False
    2606         otherwise.
    2607        
     2762        Tests whether the permutation avoids the pattern.
     2763
    26082764        EXAMPLES::
    26092765       
    26102766            sage: Permutation([6,2,5,4,3,1]).avoids([4,2,3,1])