Beispiel #1
0
def spin_polynomial_square(part, weight, length):
    """
    Returns the spin polynomial associated with part, weight, and
    length, with the substitution t -> t^2 made.
    
    EXAMPLES::
    
        sage: from sage.combinat.ribbon_tableau import spin_polynomial_square
        sage: spin_polynomial_square([6,6,6],[4,2],3)
        t^12 + t^10 + 2*t^8 + t^6 + t^4
        sage: spin_polynomial_square([6,6,6],[4,1,1],3)
        t^12 + 2*t^10 + 3*t^8 + 2*t^6 + t^4
        sage: spin_polynomial_square([3,3,3,2,1], [2,2], 3)
        t^7 + t^5
        sage: spin_polynomial_square([3,3,3,2,1], [2,1,1], 3)
        2*t^7 + 2*t^5 + t^3
        sage: spin_polynomial_square([3,3,3,2,1], [1,1,1,1], 3)
        3*t^7 + 5*t^5 + 3*t^3 + t
        sage: spin_polynomial_square([5,4,3,2,1,1,1], [2,2,1], 3)
        2*t^9 + 6*t^7 + 2*t^5
        sage: spin_polynomial_square([[6]*6, [3,3]], [4,4,2], 3)
        3*t^18 + 5*t^16 + 9*t^14 + 6*t^12 + 3*t^10
    """
    R = ZZ['t']
    t = R.gen()
        
    if part in partition.Partitions():
        part = skew_partition.SkewPartition([part,partition.Partition_class([])])
    elif part in skew_partition.SkewPartitions():
        part = skew_partition.SkewPartition(part)

    if part == [[],[]] and weight == []:
        return t.parent()(1)

    return R(graph_implementation_rec(part, weight, length, functools.partial(spin_rec,t))[0])
Beispiel #2
0
def SemistandardMultiSkewTableaux(shape, weight):
    """
    Returns the combinatorial class of semistandard multi skew
    tableaux. A multi skew tableau is a k-tuple of skew tableaux of
    givens shape with a specified total weight.
    
    EXAMPLES::
    
        sage: s = SemistandardMultiSkewTableaux([ [[2,1],[]], [[2,2],[1]] ], [2,2,2]); s
        Semistandard multi skew tableaux of shape [[[2, 1], []], [[2, 2], [1]]] and weight [2, 2, 2]
        sage: s.list()
        [[[[1, 1], [2]], [[None, 2], [3, 3]]],
         [[[1, 2], [2]], [[None, 1], [3, 3]]],
         [[[1, 3], [2]], [[None, 2], [1, 3]]],
         [[[1, 3], [2]], [[None, 1], [2, 3]]],
         [[[1, 1], [3]], [[None, 2], [2, 3]]],
         [[[1, 2], [3]], [[None, 2], [1, 3]]],
         [[[1, 2], [3]], [[None, 1], [2, 3]]],
         [[[2, 2], [3]], [[None, 1], [1, 3]]],
         [[[1, 3], [3]], [[None, 1], [2, 2]]],
         [[[2, 3], [3]], [[None, 1], [1, 2]]]]
    """
    shape = [skew_partition.SkewPartition(x) for x in shape]
    weight = partition.Partition(weight)

    if sum(weight) != sum(s.size() for s in shape):
        raise ValueError, "the sum of weight must be the sum of the sizes of shape"

    return SemistandardMultiSkewTtableaux_shapeweight(shape, weight)
Beispiel #3
0
def StandardSkewTableaux(skp=None):
    """
    Returns the combinatorial class of standard skew tableaux of shape
    skp (where skp is a skew partition).

    EXAMPLES::

        sage: StandardSkewTableaux([[3, 2, 1], [1, 1]]).list()
        [[[None, 1, 2], [None, 3], [4]],
         [[None, 1, 2], [None, 4], [3]],
         [[None, 1, 3], [None, 2], [4]],
         [[None, 1, 4], [None, 2], [3]],
         [[None, 1, 3], [None, 4], [2]],
         [[None, 1, 4], [None, 3], [2]],
         [[None, 2, 3], [None, 4], [1]],
         [[None, 2, 4], [None, 3], [1]]]
    """
    if skp is None:
        return StandardSkewTableaux_all()
    elif isinstance(skp, (int, Integer)):
        return StandardSkewTableaux_size(skp)
    elif skp in skew_partition.SkewPartitions():
        return StandardSkewTableaux_skewpartition(
            skew_partition.SkewPartition(skp))
    else:
        raise TypeError
Beispiel #4
0
    def __init__(self, p):
        """
        EXAMPLES::

            sage: s = SemistandardSkewTableaux([[2,1],[]])
            sage: s == loads(dumps(s))
            True
        """
        self.p = skew_partition.SkewPartition(p)
Beispiel #5
0
    def shape(self):
        r"""
        Returns the shape of a tableau t.

        EXAMPLES::

            sage: SkewTableau([[None,1,2],[None,3],[4]]).shape()
            [[3, 2, 1], [1, 1]]
        """

        return skew_partition.SkewPartition(
            [self.outer_shape(), self.inner_shape()])
Beispiel #6
0
def RibbonTableaux(shape, weight, length):
    """
    Returns the combinatorial class of ribbon tableaux of skew shape
    shape and weight weight tiled by ribbons of length length.
    
    EXAMPLES::
    
        sage: RibbonTableaux([[2,1],[]],[1,1,1],1)
        Ribbon tableaux of shape [[2, 1], []] and weight [1, 1, 1] with 1-ribbons
    """
    if shape in partition.Partitions():
        shape = partition.Partition(shape)
        shape = skew_partition.SkewPartition([shape, shape.core(length)])
    else:
        shape = skew_partition.SkewPartition(shape)

    if shape.size() != length * sum(weight):
        raise ValueError

    weight = [i for i in weight if i != 0]

    return RibbonTableaux_shapeweightlength(shape, weight, length)
Beispiel #7
0
def SemistandardSkewTableaux(p=None, mu=None):
    """
    Returns a combinatorial class of semistandard skew tableaux.

    EXAMPLES::

        sage: SemistandardSkewTableaux()
        Semistandard skew tableaux

    ::

        sage: SemistandardSkewTableaux(3)
        Semistandard skew tableaux of size 3

    ::

        sage: SemistandardSkewTableaux([[2,1],[]])
        Semistandard skew tableaux of shape [[2, 1], []]

    ::

        sage: SemistandardSkewTableaux([[2,1],[]],[2,1])
        Semistandard skew tableaux of shape [[2, 1], []] and weight [2, 1]

    ::

        sage: SemistandardSkewTableaux(3, [2,1])
        Semistandard skew tableaux of size 3 and weight [2, 1]
    """
    if p is None and mu is None:
        return SemistandardSkewTableaux_all()

    if p is None:
        raise ValueError, "you must specify either a size or shape"

    if isinstance(p, (int, Integer)):
        if mu is None:
            return SemistandardSkewTableaux_size(p)
        else:
            return SemistandardSkewTableaux_size_weight(p, mu)

    if p in skew_partition.SkewPartitions():
        p = skew_partition.SkewPartition(p)
        if mu is None:
            return SemistandardSkewTableaux_shape(p)
        else:
            return SemistandardSkewTableaux_shape_weight(p, mu)
Beispiel #8
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()