def __init__(self, base_ring=QQ['t'], prefix='S'):
        r"""
        Initialize ``self``.

        EXAMPLES::

            sage: S = ShiftingOperatorAlgebra(QQ['t'])
            sage: TestSuite(S).run()
        """
        indices = ShiftingSequenceSpace()
        cat = Algebras(base_ring).WithBasis()
        CombinatorialFreeModule.__init__(self,
                                         base_ring,
                                         indices,
                                         prefix=prefix,
                                         bracket=False,
                                         category=cat)

        # Setup default conversions
        sym = SymmetricFunctions(base_ring)
        self._sym_h = sym.h()
        self._sym_s = sym.s()
        self._sym_h.register_conversion(
            self.module_morphism(self._supp_to_h, codomain=self._sym_h))
        self._sym_s.register_conversion(
            self.module_morphism(self._supp_to_s, codomain=self._sym_s))
示例#2
0
    def __init__(self, R, k, t=None):
        """
        EXAMPLES::

            sage: kSchurFunctions(QQ, 3).base_ring()
            doctest:1: DeprecationWarning: Deprecation warning: Please use SymmetricFunctions(QQ).kschur() instead!
            See http://trac.sagemath.org/5457 for details.
            Univariate Polynomial Ring in t over Rational Field
            sage: kSchurFunctions(QQ, 3, t=1).base_ring()
            Rational Field
            sage: ks3 = kSchurFunctions(QQ, 3)
            sage: ks3 == loads(dumps(ks3))
            True
        """
        self.k = k
        self._name = "k-Schur Functions at level %s" % k
        self._prefix = "ks%s" % k
        self._element_class = kSchurFunctions_t.Element

        if t is None:
            R = R['t']
            self.t = R.gen()
        elif t not in R:
            raise ValueError, "t (=%s) must be in R (=%s)" % (t, R)
        else:
            self.t = R(t)
            if str(t) != 't':
                self._name += " with t=%s" % self.t

        self._s_to_self_cache = s_to_k_cache.get(k, {})
        self._self_to_s_cache = k_to_s_cache.get(k, {})

        # This is an abuse, since kschur functions do not form a basis of Sym
        from sage.combinat.sf.sf import SymmetricFunctions
        Sym = SymmetricFunctions(R)
        sfa.SymmetricFunctionAlgebra_generic.__init__(self, Sym)
        # so we need to take some counter measures
        self._basis_keys = sage.combinat.partition.Partitions(max_part=k)
        # The following line is just a temporary workaround to keep
        # the repr of those k-schur as they were before #13404; since
        # they are deprecated, there is no need to bother about them.
        self.rename(self._name + " over %s" % self.base_ring())

        self._s = Sym.s()
        # temporary until Hom(GradedHopfAlgebrasWithBasis work better)
        category = sage.categories.all.ModulesWithBasis(self.base_ring())
        # This really should be a conversion, not a coercion (it can fail)
        self.register_coercion(
            SetMorphism(Hom(self._s, self, category), self._s_to_self))
        self._s.register_coercion(
            SetMorphism(Hom(self, self._s, category), self._self_to_s))
示例#3
0
文件: kschur.py 项目: CETHop/sage
    def __init__(self, R, k, t=None):
        """
        EXAMPLES::

            sage: kSchurFunctions(QQ, 3).base_ring()
            doctest:1: DeprecationWarning: Deprecation warning: Please use SymmetricFunctions(QQ).kschur() instead!
            See http://trac.sagemath.org/5457 for details.
            Univariate Polynomial Ring in t over Rational Field
            sage: kSchurFunctions(QQ, 3, t=1).base_ring()
            Rational Field
            sage: ks3 = kSchurFunctions(QQ, 3)
            sage: ks3 == loads(dumps(ks3))
            True
        """
        self.k = k
        self._name = "k-Schur Functions at level %s"%k
        self._prefix = "ks%s"%k
        self._element_class = kSchurFunctions_t.Element

        if t is None:
            R = R['t']
            self.t = R.gen()
        elif t not in R:
            raise ValueError, "t (=%s) must be in R (=%s)"%(t,R)
        else:
            self.t = R(t)
            if str(t) != 't':
                self._name += " with t=%s"%self.t

        self._s_to_self_cache = s_to_k_cache.get(k, {})
        self._self_to_s_cache = k_to_s_cache.get(k, {})

        # This is an abuse, since kschur functions do not form a basis of Sym
        from sage.combinat.sf.sf import SymmetricFunctions
        Sym = SymmetricFunctions(R)
        sfa.SymmetricFunctionAlgebra_generic.__init__(self, Sym)
        # so we need to take some counter measures
        self._basis_keys = sage.combinat.partition.Partitions(max_part=k)
        # The following line is just a temporary workaround to keep
        # the repr of those k-schur as they were before #13404; since
        # they are deprecated, there is no need to bother about them.
        self.rename(self._name+" over %s"%self.base_ring())

        self._s = Sym.s()
        # temporary until Hom(GradedHopfAlgebrasWithBasis work better)
        category = sage.categories.all.ModulesWithBasis(self.base_ring())
        # This really should be a conversion, not a coercion (it can fail)
        self   .register_coercion(SetMorphism(Hom(self._s, self, category), self._s_to_self))
        self._s.register_coercion(SetMorphism(Hom(self, self._s, category), self._self_to_s))
示例#4
0
def polarizationSpace(P, generators, verbose=False, row_symmetry=None, use_commutativity=False, side="down"):
    """
    Starting from  polynomials (generators)of the polynomial ring in one 
    set of variables (possibly with additional inert variables), constructs
    the space obtained by polarization.
    
    The possible values for row_symmetry : 
        - "permutation" : the action of the symmetric group on the rows
        - "euler+intersection" or "decompose" or "multipolarization" for stategies on lie algebras
    
    INPUT:
    
        - `P` -- a diagonal polynomial ring (or assymmetric version)
        - `generators`: polynomials in one set of variables (and possibly inert variables) 
            
    OUTPUT: `F`  -- a Subspace

    EXAMPLES::
        sage: load("derivative_space.py")
        sage: P = DiagonalPolynomialRing(QQ, 3, 2, inert=1)
        sage: mu = Partition([3])
        sage: basis = DerivativeHarmonicSpace(QQ, mu.size()).basis_by_shape(Partition([2,1]))
        sage: generators = {}
        sage: for gen in basis : 
        ....:     d = P.multidegree((P(gen)))
        ....:     if d in generators.keys():
        ....:         generators[d] += [P(gen)]
        ....:     else:
        ....:         generators[d] = [P(gen)]
        sage: generators
        {(2, 0): [1/3*x00^2 - 2/3*x00*x01 + 2/3*x01*x02 - 1/3*x02^2],
         (1, 0): [-2*x00 + 2*x02]}
        sage: S = polarizationSpace(P, generators)
        sage: S.basis()
        {(0, 1): (x10 - x12,),
         (2, 0): (-1/2*x00^2 + x00*x01 - x01*x02 + 1/2*x02^2,),
         (1, 0): (x00 - x02,),
         (1, 1): (x00*x10 - x01*x10 - x00*x11 + x02*x11 + x01*x12 - x02*x12,),
         (0, 2): (1/2*x10^2 - x10*x11 + x11*x12 - 1/2*x12^2,)}
         
        sage: basis = DerivativeVandermondeSpaceWithInert(QQ, mu).basis_by_shape(Partition([1,1,1]))
        sage: generators = {P.multidegree(P(gen)): [P(gen) for gen in g] for (d,g) in basis.iteritems()}
        sage: generators
        {(3, 0): [-x00^2*x01 + x00*x01^2 + x00^2*x02 - x01^2*x02 - x00*x02^2 + x01*x02^2]}
        sage: S = polarizationSpace(P, generators)
        sage: S.basis()
        {(1, 2): (-1/2*x01*x10^2 + 1/2*x02*x10^2 - x00*x10*x11 + x01*x10*x11 + 1/2*x00*x11^2 - 1/2*x02*x11^2 + x00*x10*x12 - x02*x10*x12 - x01*x11*x12 + x02*x11*x12 - 1/2*x00*x12^2 + 1/2*x01*x12^2,),
         (3, 0): (x00^2*x01 - x00*x01^2 - x00^2*x02 + x01^2*x02 + x00*x02^2 - x01*x02^2,),
         (0, 3): (x10^2*x11 - x10*x11^2 - x10^2*x12 + x11^2*x12 + x10*x12^2 - x11*x12^2,),
         (1, 1): (-x01*x10 + x02*x10 + x00*x11 - x02*x11 - x00*x12 + x01*x12,),
         (2, 1): (-x00*x01*x10 + 1/2*x01^2*x10 + x00*x02*x10 - 1/2*x02^2*x10 - 1/2*x00^2*x11 + x00*x01*x11 - x01*x02*x11 + 1/2*x02^2*x11 + 1/2*x00^2*x12 - 1/2*x01^2*x12 - x00*x02*x12 + x01*x02*x12,)}
        
        sage: mu = Partition([2,1])
        sage: basis = DerivativeVandermondeSpaceWithInert(QQ, mu).basis_by_shape(Partition([2,1]))
        sage: generators = {P.multidegree(P(gen)): [P(gen) for gen in g] for (d,g) in basis.iteritems()}
        sage: generators
        {(0, 0): [-theta00 + theta02]}
        sage: S = polarizationSpace(P, generators)
        sage: S.basis()
        {(0, 0): (theta00 - theta02,)}

    """
    S = SymmetricFunctions(QQ)
    s = S.s()
    m = S.m()
    r = P._r
    
    if isinstance(P, DiagonalAntisymmetricPolynomialRing):
        antisymmetries = P._antisymmetries
    else:
        antisymmetries = None
        
    if row_symmetry in ("euler+intersection", "decompose", "multipolarization")  :
        # The hilbert series will be directly expressed in terms of the
        # dimensions of the highest weight spaces, thus as a symmetric
        # function in the Schur basis
        def hilbert_parent(dimensions):
            return s.sum_of_terms([Partition(d), c]
                                   for d,c in dimensions.iteritems() if c)
    elif row_symmetry == "permutation":
        def hilbert_parent(dimensions):
            return s(m.sum_of_terms([Partition(d), c]
                                     for d,c in dimensions.iteritems())
                    ).restrict_partition_lengths(r, exact=False)
    else:
        def hilbert_parent(dimensions):
            return s(S.from_polynomial(P._hilbert_parent(dimensions))
                    ).restrict_partition_lengths(r,exact=False)

    operators = polarization_operators_by_multidegree(P, side=side, row_symmetry=row_symmetry, min_degree=1 if row_symmetry and row_symmetry!="permutation" else 0)
    #ajout operateurs Steenrod
    #for i in range(1, r):
    #    for d in [2,3]:
    #        operators[P._grading_set((-d+1 if j==i else 0 for j in range(0,r)))] = [functools.partial(P.steenrod_op, i=i, k=d)]
    
    if row_symmetry == "euler+intersection":
        operators[P._grading_set.zero()] = [
            functools.partial(lambda v,i: P.polarization(P.polarization(v, i+1, i, 1, antisymmetries=antisymmetries), i, i+1, 1, antisymmetries=antisymmetries), i=i)
            for i in range(r-1)]
    elif row_symmetry == "decompose":
        def post_compose(f):
            return lambda x: [q for (q,word) in P.highest_weight_vectors_decomposition(f(x))]
        operators = {d: [post_compose(op) for op in ops]for d, ops in operators.iteritems()}
    elif row_symmetry == "multipolarization":
        F = HighestWeightSubspace(generators,
                 ambient=self,
                 add_degrees=add_degree, degree=P.multidegree,
                 hilbert_parent = hilbert_parent,
                 antisymmetries=antisymmetries,
                 verbose=verbose)
        return F
        
    operators_by_degree = {}
    for degree,ops in operators.iteritems(): 
        d = sum(degree)
        operators_by_degree.setdefault(d,[])
        operators_by_degree[d].extend(ops)

    ranks = {}
    for d, ops in operators_by_degree.iteritems():
        ranker = rank_from_list(ops)
        for op in ops:
            ranks[op] = (d, ranker(op))
    ranker = ranks.__getitem__
    def extend_word(word, op):
        new_word = word + [ranker(op)]
        if use_commutativity and sorted(new_word) != new_word:
            return None
        return new_word

    if row_symmetry == "permutation":
        add_deg = add_degree_symmetric
    else:
        add_deg = add_degree
    
    F = Subspace(generators, operators=operators,
                 add_degrees=add_deg, degree=P.multidegree,
                 hilbert_parent = hilbert_parent,
                 extend_word=extend_word, verbose=verbose) 
    F._antisymmetries = antisymmetries
    return F