Ticket #14255: trac_14255-combinatorial_maps-cs.patch

File trac_14255-combinatorial_maps-cs.patch, 2.4 KB (added by stumpc5, 9 years ago)
  • sage/combinat/combinatorial_map.py

    # HG changeset patch
    # User Christian Stump <christian.stump at gmail.com>
    # Date 1363034670 -3600
    # Node ID 4d360c5a6194e5084d9c26bd5672b27ea3cb5f4c
    # Parent  53ce861557b5ddffd612b1b909fbfb62bb83363f
    Trac 14255 Improving combinatorial maps
    
    diff --git a/sage/combinat/combinatorial_map.py b/sage/combinat/combinatorial_map.py
    a b class CombinatorialMap(object): 
    152152            sage: p.left_tableau.__repr__()
    153153            'Combinatorial map: Robinson-Schensted insertion tableau'
    154154        """
    155         name = self._name if self._name else self.__name__
    156         return "Combinatorial map: %s" % name
     155        return "Combinatorial map: %s" %self.name()
    157156
    158157    def _sage_src_lines_(self):
    159158        """
    class CombinatorialMap(object): 
    205204        else:
    206205            return self._f(*args, **kwds)
    207206
     207    def unbounded_map(self):
     208        r"""
     209        Return the unbounded version of ``self``.
     210
     211        You can use this method to return a function which takes as input
     212        an element in the domain of the combinatorial map.
     213        See the example below.
     214
     215        EXAMPLES::
     216
     217            sage: from sage.combinat.permutation import Permutation
     218            sage: pi = Permutation([1,3,2])
     219            sage: f = pi.reverse
     220            sage: F = f.unbounded_map()
     221            sage: F(pi)
     222            [2, 3, 1]
     223        """
     224        return self._f
     225
    208226    def order(self):
    209227        """
    210228        Returns the order of ``self``, or ``None`` if the order is not known.
    class CombinatorialMap(object): 
    226244
    227245    def name(self):
    228246        """
    229         If given, returns the name of a combinatorial map; ``None`` otherwise.
     247        Returns the name of a combinatorial map.
    230248        This is used for the string representation of ``self``.
    231249
    232250        EXAMPLES::
    class CombinatorialMap(object): 
    239257            ...       def to_self_2(): pass
    240258            sage: CombinatorialClass.to_self_1.name()
    241259            'map1'
    242             sage: CombinatorialClass.to_self_2.name() is None
    243             True
     260            sage: CombinatorialClass.to_self_2.name()
     261            'to_self_2'
    244262        """
    245         return self._name
     263        if self._name is not None:
     264            return self._name
     265        else:
     266            return self._f.__name__
    246267
    247268def combinatorial_maps_in_class(cls):
    248269    """