Ejemplo n.º 1
0
def from_expr(l):
    """
    Returns a 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: import sage.combinat.ribbon_tableau as ribbon_tableau
        sage: sage.combinat.ribbon_tableau.from_expr([[1,1],[[5],[3,4],[1,2]]])
        [[None, 1, 2], [None, 3, 4], [5]]
        sage: type(_)
        <class 'sage.combinat.ribbon_tableau.RibbonTableau_class'>
    """
    return RibbonTableau_class(skew_tableau.from_expr(l)._list)
Ejemplo n.º 2
0
def from_expr(l):
    """
    Returns a 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: import sage.combinat.ribbon_tableau as ribbon_tableau
        sage: sage.combinat.ribbon_tableau.from_expr([[1,1],[[5],[3,4],[1,2]]])
        [[None, 1, 2], [None, 3, 4], [5]]
        sage: type(_)
        <class 'sage.combinat.ribbon_tableau.RibbonTableau_class'>
    """
    return RibbonTableau_class(skew_tableau.from_expr(l)._list)
Ejemplo n.º 3
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.Partition(skp[1])
    partc = skp[1] + [0] * (len(skp[0]) - len(skp[1]))

    tableau = skew_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 = skew_tableau.from_expr([skp[1], tableau]).conjugate()
    tableau = tableau.to_expr()[1]

    skp = skew_partition.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 skew_tableau.SkewTableau(
        expr=[psave.conjugate(), tableau]).conjugate().to_expr()
Ejemplo n.º 4
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.Partition(skp[1])
    partc = skp[1] + [0] * (len(skp[0]) - len(skp[1]))

    tableau = skew_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 = skew_tableau.from_expr([skp[1], tableau]).conjugate()
    tableau = tableau.to_expr()[1]

    skp = skew_partition.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 skew_tableau.SkewTableau(expr=[psave.conjugate(), tableau]).conjugate().to_expr()