Ticket #14765: trac_14765-fix_empty_GT_toprow-ts.patch

File trac_14765-fix_empty_GT_toprow-ts.patch, 1.6 KB (added by tscrim, 8 years ago)
  • sage/combinat/gelfand_tsetlin_patterns.py

    # HG changeset patch
    # User Travis Scrimshaw <tscrim@ucdavis.edu>
    # Date 1371636365 25200
    # Node ID a7266e3c0ff1eae1cbd5a02217072ab113d3aa17
    # Parent  1f5a7e92ac2cd5c27d130835375c501fbfcd236b
    #14765: Fix empty top row for Gelfand-Tsetlin patterns
    
    diff --git a/sage/combinat/gelfand_tsetlin_patterns.py b/sage/combinat/gelfand_tsetlin_patterns.py
    a b class GelfandTsetlinPatternsTopRow(Gelfa 
    925925
    926926            sage: G = GelfandTsetlinPatterns(top_row=[4,4,3,1])
    927927            sage: TestSuite(G).run()
     928
     929        TESTS:
     930
     931        Check a border case in :trac:`14765`::
     932
     933            sage: G = GelfandTsetlinPatterns(top_row=[])
     934            sage: list(G)
     935            [[]]
    928936        """
    929937        self._row = top_row
    930938        n = len(top_row)
    931         k = top_row[0]
     939        if n == 0:
     940            k = 0
     941        else:
     942            k = top_row[0]
    932943        GelfandTsetlinPatterns.__init__(self, n, k, strict)
    933944
    934945    def _repr_(self):
    class GelfandTsetlinPatternsTopRow(Gelfa 
    9891000             [[4, 2, 1], [4, 2], [4]]]
    9901001        """
    9911002        # If we enforce strictness, check to see if a specified top row is strict
    992         if self._strict and self._row is not None and \
    993                 any(self._row[i] == self._row[i+1] for i in range(self._n-1)):
     1003        if self._strict and any(self._row[i] == self._row[i+1] for i in range(self._n-1)):
     1004            return
     1005        if self._n == 0:
     1006            yield self.element_class(self, [])
    9941007            return
    9951008        if self._n == 1:
    9961009            yield self.element_class(self, [list(self._row)])