def __classcall_private__(cls, x): """ Construct a multi skew tableau. EXAMPLES:: sage: s = MultiSkewTableau([ [[None,1],[2,3]], [[1,2],[2]] ]) """ if isinstance(x, MultiSkewTableau): return x return MultiSkewTableaux()([SkewTableau(i) for i in x])
def __init__(self, parent, t): """ Initialize ``self``. EXAMPLES:: sage: R = RibbonShapedTableau([[2,3],[1,4,5]]) sage: TestSuite(R).run() """ if not isinstance(t, SkewTableau): #scrubing None t = [ [i for i in row if i is not None] for row in t] st = [] space_count = 0 for row in reversed(t): st.append( [None]*space_count + row ) space_count += len(row) - 1 st.reverse() t = st else: t = list(t) SkewTableau.__init__(self, parent, t)
def to_tableau(self): r""" Return the skew tableau associated to ``self``. EXAMPLES:: sage: T = path_tableaux.DyckPath([0,1,2,3,2,3]) sage: T.to_tableau() [[1, 2, 3, 5], [4]] sage: U = path_tableaux.DyckPath([2,3,2,3]) sage: U.to_tableau() [[None, None, 1, 3], [2]] """ w = self.to_word() top = [i + 1 for i, a in enumerate(w) if a == 1] bot = [i + 1 for i, a in enumerate(w) if a == 0] if self.is_skew(): return SkewTableau([[None] * self[0] + top, bot]) else: return StandardTableau([top, bot])
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()
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()