Beispiel #1
0
    def __iter__(self):
        """
        EXAMPLES::

            sage: sp = SkewPartitions(3).list()
            sage: SemistandardMultiSkewTableaux([SkewPartition([[1, 1, 1], []]), SkewPartition([[3], []])],[2,2,2]).list()
            [[[[1], [2], [3]], [[1, 2, 3]]]]

        ::

            sage: a = SkewPartition([[8,7,6,5,1,1],[2,1,1]])
            sage: weight = [3,3,2]
            sage: k = 3
            sage: s = SemistandardMultiSkewTableaux(a.quotient(k),weight)
            sage: len(s.list())
            34
            sage: RibbonTableaux(a,weight,k).cardinality()
            34
        """
        parts = self._shape
        mu = self._weight

        #Splitting the partition
        s = [p.size() for p in parts]
        parts = [p.to_list() for p in parts]

        #Gluing the partitions
        parttmp = parts[0]
        i = 1
        for i in range(1, len(parts)):
            trans = parttmp[0][0]
            current_part = parts[i]
            current_part[1] += [0] * (len(current_part[0]) -
                                      len(current_part[1]))
            inner_current = [trans + j for j in current_part[1]]
            outer_current = [trans + j for j in current_part[0]]
            parttmp = [outer_current + parttmp[0], inner_current + parttmp[1]]

        #List the corresponding skew tableaux
        l = [st.to_word() for st in SemistandardSkewTableaux(parttmp, mu)]

        S = SkewTableaux()
        for k in range(len(l)):
            pos = 0  #Double check this
            restmp = [
                S.from_shape_and_word(parts[0], [l[k][j] for j in range(s[0])])
            ]
            for i in range(1, len(parts)):
                w = [
                    l[k][j]
                    for j in range(pos + s[i - 1], pos + s[i - 1] + s[i])
                ]
                restmp.append(S.from_shape_and_word(parts[i], w))
            yield self.element_class(self, restmp)
Beispiel #2
0
    def __init__(self, category=None):
        """
        Initialize ``self``.

        EXAMPLES::

            sage: S = RibbonShapedTableaux()
            sage: TestSuite(S).run()
        """
        if category is None:
            category = Sets()

        SkewTableaux.__init__(self, category=category)
Beispiel #3
0
    def __init__(self, category=None):
        """
        Initialize ``self``.

        EXAMPLES::

            sage: S = RibbonShapedTableaux()
            sage: TestSuite(S).run()
        """
        if category is None:
            category = Sets()

        SkewTableaux.__init__(self, category=category)
Beispiel #4
0
    def __iter__(self):
        """
        EXAMPLES::

            sage: sp = SkewPartitions(3).list()
            sage: SemistandardMultiSkewTableaux([SkewPartition([[1, 1, 1], []]), SkewPartition([[3], []])],[2,2,2]).list()
            [[[[1], [2], [3]], [[1, 2, 3]]]]

        ::

            sage: a = SkewPartition([[8,7,6,5,1,1],[2,1,1]])
            sage: weight = [3,3,2]
            sage: k = 3
            sage: s = SemistandardMultiSkewTableaux(a.quotient(k),weight)
            sage: len(s.list())
            34
            sage: RibbonTableaux(a,weight,k).cardinality()
            34
        """
        parts = self._shape
        mu = self._weight

        #Splitting the partition
        s = [ p.size() for p in parts ]
        parts = [p.to_list() for p in parts]

        #Gluing the partitions
        parttmp = parts[0]
        i = 1
        for i in range(1,len(parts)):
            trans = parttmp[0][0]
            current_part = parts[i]
            current_part[1] += [0]*(len(current_part[0])-len(current_part[1]))
            inner_current = [ trans + j for j in current_part[1] ]
            outer_current = [ trans + j for j in current_part[0] ]
            parttmp = [ outer_current + parttmp[0], inner_current + parttmp[1] ]

        #List the corresponding skew tableaux
        l = [ st.to_word() for st in SemistandardSkewTableaux(parttmp, mu) ]

        S = SkewTableaux()
        for k in range(len(l)):
            pos = 0  #Double check this
            restmp = [ S.from_shape_and_word(parts[0], [l[k][j] for j in range(s[0])]) ]
            for i in range(1, len(parts)):
                w = [l[k][j] for j in range(pos+s[i-1], pos+s[i-1]+s[i])]
                restmp.append( S.from_shape_and_word(parts[i], w) )
            yield self.element_class(self, restmp)
Beispiel #5
0
    def to_tableau(self):
        r"""
        Convert ``self`` to a :class:`SemistandardTableau`.

        The :class:`SemistandardSkewTableau` is not implemented so this returns a :class:`SkewTableau`

        EXAMPLES::

            sage: pt = path_tableaux.SemistandardPathTableau([[],[3],[3,2],[3,3,1],[3,3,2,1],[4,3,3,1,0]])
            sage: pt.to_tableau()
            [[1, 1, 1, 5], [2, 2, 3], [3, 4, 5], [4]]

        TESTS::

            sage: SST = SemistandardTableaux(shape=[5,5,3],eval=[2,2,3,4,2])
            sage: all(st == path_tableaux.SemistandardPathTableau(st).to_tableau() for st in SST)
            True
        """
        from sage.combinat.tableau import from_chain

        if not self.is_integral():
            raise ValueError(
                f"{self} must have all entries nonnegative integers")

        lt = [[i for i in a if i > 0] for a in self]
        if self.is_skew():
            return SkewTableaux().from_chain(lt)
        else:
            return from_chain(lt)
Beispiel #6
0
    def from_expr(self, l):
        """
        Return a :class:`RibbonTableau` from a MuPAD-Combinat expr for a skew
        tableau. The first list in ``expr`` is the inner shape of the skew
        tableau. The second list are the entries in the rows of the skew
        tableau from bottom to top.

        Provided primarily for compatibility with MuPAD-Combinat.

        EXAMPLES::

            sage: RibbonTableaux().from_expr([[1,1],[[5],[3,4],[1,2]]])
            [[None, 1, 2], [None, 3, 4], [5]]
        """
        return self.element_class(self, SkewTableaux().from_expr(l))
Beispiel #7
0
def insertion_tableau(skp, perm, evaluation, tableau, length):
    """
    INPUT:

    -  ``skp`` -- skew partitions

    -  ``perm, evaluation`` -- non-negative integers

    -  ``tableau`` -- skew tableau

    -  ``length`` -- integer

    TESTS::

        sage: from sage.combinat.ribbon_tableau import insertion_tableau
        sage: insertion_tableau([[1], []], [1], 1, [[], []], 1)
        [[], [[1]]]
        sage: insertion_tableau([[2, 1], []], [1, 1], 2, [[], [[1]]], 1)
        [[], [[2], [1, 2]]]
        sage: insertion_tableau([[2, 1], []], [0, 0], 3, [[], [[2], [1, 2]]], 1)
        [[], [[2], [1, 2]]]
        sage: insertion_tableau([[1, 1], []], [1], 2, [[], [[1]]], 1)
        [[], [[2], [1]]]
        sage: insertion_tableau([[2], []], [0, 1], 2, [[], [[1]]], 1)
        [[], [[1, 2]]]
        sage: insertion_tableau([[2, 1], []], [0, 1], 3, [[], [[2], [1]]], 1)
        [[], [[2], [1, 3]]]
        sage: insertion_tableau([[1, 1], []], [2], 1, [[], []], 2)
        [[], [[1], [0]]]
        sage: insertion_tableau([[2], []], [2, 0], 1, [[], []], 2)
        [[], [[1, 0]]]
        sage: insertion_tableau([[2, 2], []], [0, 2], 2, [[], [[1], [0]]], 2)
        [[], [[1, 2], [0, 0]]]
        sage: insertion_tableau([[2, 2], []], [2, 0], 2, [[], [[1, 0]]], 2)
        [[], [[2, 0], [1, 0]]]
        sage: insertion_tableau([[2, 2], [1]], [3, 0], 1, [[], []], 3)
        [[1], [[1, 0], [0]]]
    """
    psave = Partition(skp[1])
    partc = skp[1] + [0] * (len(skp[0]) - len(skp[1]))

    tableau = SkewTableau(expr=tableau).to_expr()[1]

    for k in range(len(tableau)):
        tableau[-(k + 1)] += [0] * (skp[0][k] - partc[k] -
                                    len(tableau[-(k + 1)]))

    ## We construct a tableau from the southwest corner to the northeast one
    tableau = [[0] * (skp[0][k] - partc[k])
               for k in reversed(range(len(tableau), len(skp[0])))] + tableau

    tableau = SkewTableaux().from_expr([skp[1], tableau]).conjugate()
    tableau = tableau.to_expr()[1]

    skp = SkewPartition(skp).conjugate().to_list()
    skp[1].extend([0] * (len(skp[0]) - len(skp[1])))

    if len(perm) > len(skp[0]):
        return None

    for k in range(len(perm)):
        if perm[-(k + 1)] != 0:
            tableau[len(tableau) - len(perm) +
                    k][skp[0][len(perm) - (k + 1)] -
                       skp[1][len(perm) - (k + 1)] - 1] = evaluation

    return SkewTableau(expr=[psave.conjugate(), tableau]).conjugate().to_expr()
Beispiel #8
0
    def __init__(self, st):
        r"""
        sage: from sage.combinat.skew_tableau import SkewTableau
        sage: from jeudetaquin import JeuDeTaquin
        sage: jdt = JeuDeTaquin([[None,2,3],[None,4],[5]]) ; jdt
          5
          .  4
          .  2  3
        sage: jdt.done(), jdt.has_hole()
        (False, False)

        sage: jdt.create_hole((0,0))
        Traceback (most recent call last):
        ...
        ValueError: corner must be an inner corner

        sage: jdt.create_hole((1,0))
        sage: jdt
          5
          *  4
          .  2  3
        sage: jdt.done(), jdt.has_hole()
        (False, True)
        sage: jdt.slide(); jdt
          5
          4
          .  2  3
        sage: jdt.done(), jdt.has_hole()
        (False, False)

        sage: jdt.slide()
        Traceback (most recent call last):
        ...
        ValueError: There is no hole

        sage: jdt.create_hole((0,0)); jdt
          5
          4
          *  2  3
        sage: jdt.done(), jdt.has_hole()
        (False, True)
        sage: jdt.slide(); jdt
          5
          4
          2  *  3
        sage: jdt.done(), jdt.has_hole()
        (False, True)

        sage: jdt.create_hole((0,1))
        Traceback (most recent call last):
        ...
        ValueError: There is already a hole at (0, 1)

        sage: jdt.slide(); jdt
          5
          4
          2  3
        sage: jdt.done(), jdt.has_hole()
        (True, False)

        sage: t = SkewTableau([[None,None,None,None,2,3,7,8],[None,None,4,9],[None,5,6],[10]])
        sage: jdt = JeuDeTaquin(t); jdt
         10
          .  5  6
          .  .  4  9
          .  .  .  .  2  3  7  8
        sage: jdt.create_hole((0, 3)); jdt
         10
          .  5  6
          .  .  4  9
          .  .  .  *  2  3  7  8
        sage: jdt.slide(); jdt
         10
          .  5  6
          .  .  4  9
          .  .  .  2  *  3  7  8
        sage: jdt.slide(); jdt
         10
          .  5  6
          .  .  4  9
          .  .  .  2  3  *  7  8
        sage: jdt.slide(); jdt
         10
          .  5  6
          .  .  4  9
          .  .  .  2  3  7  *  8
        sage: jdt.slide(); jdt
         10
          .  5  6
          .  .  4  9
          .  .  .  2  3  7  8
        sage: jdt.create_hole((1, 1)); jdt
         10
          .  5  6
          .  *  4  9
          .  .  .  2  3  7  8
        sage: jdt.slide(); jdt
         10
          .  5  6
          .  4  *  9
          .  .  .  2  3  7  8
        sage: jdt.slide(); jdt
         10
          .  5
          .  4  6  9
          .  .  .  2  3  7  8

        sage: jdt.create_hole((2, 0)); jdt
         10
          *  5
          .  4  6  9
          .  .  .  2  3  7  8
        sage: jdt.slide(); jdt
         10
          5
          .  4  6  9
          .  .  .  2  3  7  8

        sage: jdt.create_hole((0, 2)); jdt
         10
          5
          .  4  6  9
          .  .  *  2  3  7  8
        sage: jdt.slide(); jdt
         10
          5
          .  4  6  9
          .  .  2  *  3  7  8
        sage: jdt.slide(); jdt
         10
          5
          .  4  6  9
          .  .  2  3  *  7  8
        sage: jdt.slide(); jdt
         10
          5
          .  4  6  9
          .  .  2  3  7  *  8
        sage: jdt.slide(); jdt
         10
          5
          .  4  6  9
          .  .  2  3  7  8

        sage: jdt.create_hole((0, 1)); jdt
         10
          5
          .  4  6  9
          .  *  2  3  7  8
        sage: jdt.slide(); jdt
         10
          5
          .  4  6  9
          .  2  *  3  7  8
        sage: jdt.slide(); jdt
         10
          5
          .  4  6  9
          .  2  3  *  7  8
        sage: jdt.slide(); jdt
         10
          5
          .  4  6  9
          .  2  3  7  *  8
        sage: jdt.slide(); jdt
         10
          5
          .  4  6  9
          .  2  3  7  8

        sage: jdt.create_hole((1, 0)); jdt
         10
          5
          *  4  6  9
          .  2  3  7  8
        sage: jdt.slide(); jdt
         10
          5
          4  *  6  9
          .  2  3  7  8
        sage: jdt.slide(); jdt
         10
          5
          4  6  *  9
          .  2  3  7  8
        sage: jdt.slide(); jdt
         10
          5
          4  6  9
          .  2  3  7  8

        sage: jdt.create_hole((0, 0)); jdt
         10
          5
          4  6  9
          *  2  3  7  8
        sage: jdt.slide(); jdt
         10
          5
          4  6  9
          2  *  3  7  8
        sage: jdt.slide(); jdt
         10
          5
          4  6  9
          2  3  *  7  8
        sage: jdt.slide(); jdt
         10
          5
          4  6  9
          2  3  7  *  8
        sage: jdt.slide(); jdt
         10
          5
          4  6  9
          2  3  7  8
        """
        super(JeuDeTaquin, self).__init__(SkewTableaux(), st)
        self._hole = None
        self._new_st = None