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()