Ticket #5600: trac_5600-reviewer.patch

File trac_5600-reviewer.patch, 6.8 KB (added by mvngu, 13 years ago)

reviewer patch

  • sage/combinat/composition.py

    # HG changeset patch
    # User Minh Van Nguyen <nguyenminh2@gmail.com>
    # Date 1250981838 25200
    # Node ID 3c8236e742c7503633d8be5ac9e2531c9de045dc
    # Parent  61acc2052f70ee513591204f183055c08e8394a0
    trac 5600: fix typos and some minor cosmetic adjustments
    
    diff -r 61acc2052f70 -r 3c8236e742c7 sage/combinat/composition.py
    a b  
    44A composition `c` of a nonnegative integer `n` is a list of positive integers
    55(the *parts* of the compositions) with total sum `n`.
    66
    7 This module provide tools for manipulating compositions and enumerated
     7This module provides tools for manipulating compositions and enumerated
    88sets of compositions.
    99
    1010EXAMPLES::
     
    1717
    1818AUTHORS:
    1919
    20  - Mike Hansen, Nicolas M. Thiery
    21  - MuPAD-Combinat developers (algorithms and design inspiration)
    22 
     20- Mike Hansen, Nicolas M. Thiery
     21- MuPAD-Combinat developers (algorithms and design inspiration)
    2322"""
    2423#*****************************************************************************
    2524#       Copyright (C) 2007 Mike Hansen       <mhansen@gmail.com>
     
    168167    @staticmethod
    169168    def sum(compositions):
    170169        """
     170        Returns the concatenation of the given compositions.
     171
    171172        INPUT:
    172173
    173          - ``compositions``: a list (or iterable) of compositions
    174 
    175         Returns the concatenation of the given compositions
     174        - ``compositions`` -- a list (or iterable) of compositions
    176175
    177176        EXAMPLES::
    178177
     
    184183            sage: sage.combinat.composition.Composition_class.sum([Composition([i,i]) for i in [4,1,3]])
    185184            [4, 4, 1, 1, 3, 3]
    186185
    187         Empty inputs are handled gracefuly::
     186        Empty inputs are handled gracefully::
    188187       
    189188            sage: sage.combinat.composition.Composition_class.sum([]) == Composition([])
    190189            True
     
    193192
    194193    def finer(self):
    195194        """
    196         Returns the set of compositions which are finer than self
     195        Returns the set of compositions which are finer than self.
    197196
    198197        EXAMPLES::
    199198       
     
    242241
    243242    def fatten(self, grouping):
    244243        """
     244        Returns the composition fatter than self, obtained by grouping
     245        together consecutive parts according to grouping.
     246
    245247        INPUT:
    246248       
    247          - ``grouping`` - a composition whose sum is the length of self
    248        
    249         Returns the composition fatter than self, obtained by grouping
    250         together consecutive parts according to grouping.
     249        - ``grouping`` -- a composition whose sum is the length of self
    251250
    252251        EXAMPLES:
    253252       
     
    265264            sage: c.fatten(Composition([5]))
    266265            [19]
    267266
    268         Other values for `grouping` yield (all the) other compositions coarser
    269         to `c`::
     267        Other values for ``grouping`` yield (all the) other compositions
     268        coarser to `c`::
    270269       
    271270            sage: c.fatten(Composition([2,1,2]))
    272271            [9, 2, 8]
     
    289288
    290289    def fatter(self):
    291290        """
    292         Returns the set of compositions which are fatter than self
     291        Returns the set of compositions which are fatter than self.
    293292
    294293        Complexity for generation: O(size(c)) memory, O(size(result)) time
    295294
     
    310309            sage: list(Composition([1,1,1,1]).fatter()) == list(Compositions(4))
    311310            True
    312311        """
    313        
    314312        return Compositions(len(self)).map(self.fatten)
    315313
    316314    def refinement(self, co2):
     
    457455
    458456def Compositions(n=None, **kwargs):
    459457    r"""
    460     Sets of integer Compositions
     458    Sets of integer Compositions.
    461459
    462460    A composition `c` of a nonnegative integer `n` is a list of
    463461    positive integers with total sum `n`.
    464462
    465     See also: `Composition`, `Partitions`, `IntegerVectors`
     463    See also: ``Composition``, ``Partitions``, ``IntegerVectors``
    466464
    467465    EXAMPLES:
    468466
     
    476474        sage: list(Compositions(4))
    477475        [[1, 1, 1, 1], [1, 1, 2], [1, 2, 1], [1, 3], [2, 1, 1], [2, 2], [3, 1], [4]]
    478476
    479     You can use the .first() method to get the 'first' composition of
     477    You can use the ``.first()`` method to get the 'first' composition of
    480478    a number::
    481479
    482480        sage: Compositions(4).first()
     
    511509        sage: Compositions(3).cardinality()
    512510        4
    513511
    514     The following examples shows how to test whether or not an object
     512    The following examples show how to test whether or not an object
    515513    is a composition::
    516514
    517515        sage: [3,4] in Compositions()
     
    614612    Note that if you specify min_part=0, then the objects produced may
    615613    have parts equal to zero. This violates the internal assumptions
    616614    that the Composition class makes. Use at your own risk, or
    617     preferably consider using `IntegerVectors` instead::
     615    preferably consider using ``IntegerVectors`` instead::
    618616
    619617        sage: list(Compositions(2, length=3, min_part=0))
    620618        doctest:... RuntimeWarning: Currently, setting min_part=0 produces Composition objects which violate internal assumptions.  Calling methods on these objects may produce errors or WRONG results!
     
    624622        [[2, 0, 0], [1, 1, 0], [1, 0, 1], [0, 2, 0], [0, 1, 1], [0, 0, 2]]
    625623
    626624    The generation algorithm is constant amortized time, and handled
    627     by the generic tool `IntegerListsLex`.
     625    by the generic tool ``IntegerListsLex``.
    628626
    629627    TESTS::
    630628   
     
    877875
    878876
    879877
    880 # Those belong to the Compositino class
     878# Those belong to the Composition class
    881879
    882880def from_descents(descents, nps=None):
    883881    """
  • sage/combinat/skew_partition.py

    diff -r 61acc2052f70 -r 3c8236e742c7 sage/combinat/skew_partition.py
    a b  
    743743    def __init__(self, n, overlap=0):
    744744        """
    745745        INPUT:
    746          - n: an non negative integer
    747          - overlap: an integer
     746
     747         - ``n`` -- a non-negative integer
     748         - ``overlap`` -- an integer
    748749       
    749750        Returns the set of the skew partitions of ``n`` with overlap
    750751        at least ``overlap``, and no empty row.
     
    754755        Caveat: this set is stable under conjugation only for overlap=
    755756        0 or 1. What exactly happens for negative overlaps is not yet
    756757        well specified, and subject to change (we may want to
    757         introduce vertical overlap constraints as well). overlap would
    758         also better be named min_overlap.
     758        introduce vertical overlap constraints as well). ``overlap`` would
     759        also better be named ``min_overlap``.
    759760
    760761        Todo: as is, this set is essentially the composition of
    761         Compositions(n) (which give the row lengths) and
    762         SkewPartition(n, row_lengths=...), and one would want to
     762        ``Compositions(n)`` (which give the row lengths) and
     763        ``SkewPartition(n, row_lengths=...)``, and one would want to
    763764        "inherit" list and cardinality from this composition.
    764765
    765766        TESTS::