Ticket #14121: fixing_shuffle_product_cb.patch

File fixing_shuffle_product_cb.patch, 1.1 KB (added by chrisjamesberg, 8 years ago)
  • sage/combinat/words/shuffle_product.py

    # HG changeset patch
    # User Chris Berg <cberg at lacim.ca>
    # Date 1360860421 18000
    # Node ID 8696305556df8de38c70bd97e6114738a2d1f506
    # Parent  ca877a1fdc06f49f74e422f648ed5c05fea1a570
    #14121: Fixing shuffle product
    
    diff --git a/sage/combinat/words/shuffle_product.py b/sage/combinat/words/shuffle_product.py
    a b class ShuffleProduct_w1w2(CombinatorialC 
    6363            sage: w in S
    6464            False
    6565        """
     66        from sage.combinat.words.word import Word
    6667        if not isinstance(x, Word_class):
    6768            return False
    6869        if x.length() !=self._w1.length() + self._w2.length():
    class ShuffleProduct_w1w2(CombinatorialC 
    7576                letter = wx.pop(0)
    7677            except IndexError:
    7778                return False
     79            if len(w1) > 0 and len(w2) > 0 and letter == w1[0] == w2[0]:
     80                return Word(wx) in self._w1[1:].shuffle(self._w2) or Word(wx) in self._w1.shuffle(self._w2[1:])
    7881            if len(w1) > 0 and letter == w1[0]:
    7982                w1.pop(0)
    8083            elif len(w2) > 0 and letter == w2[0]: