コード例 #1
0
            sage: Qp._s_cache(2)
            sage: l = lambda c: [ (i[0],[j for j in sorted(i[1].items())]) for i in sorted(c.items())]
            sage: l(Qp._s_to_self_cache[2])
            [([1, 1], [([1, 1], 1), ([2], -t)]), ([2], [([2], 1)])]
            sage: l(Qp._self_to_s_cache[2])
            [([1, 1], [([1, 1], 1), ([2], t)]), ([2], [([2], 1)])]
        """
        self._invert_morphism(n, ZZ['t'], self._self_to_s_cache, \
                              self._s_to_self_cache, to_other_function = self._to_s, \
                              lower_triangular=True, ones_on_diagonal=True)


#############
#   Cache   #
#############
from sage.misc.cache import Cache
cache_p = Cache(HallLittlewood_p)
cache_q = Cache(HallLittlewood_q)
cache_qp = Cache(HallLittlewood_qp)

# Unpickling backward compatibility
sage.structure.sage_object.register_unpickle_override(
    'sage.combinat.sf.hall_littlewood', 'HallLittlewoodElement_p',
    HallLittlewood_p.Element)
sage.structure.sage_object.register_unpickle_override(
    'sage.combinat.sf.hall_littlewood', 'HallLittlewoodElement_q',
    HallLittlewood_q.Element)
sage.structure.sage_object.register_unpickle_override(
    'sage.combinat.sf.hall_littlewood', 'HallLittlewoodElement_qp',
    HallLittlewood_qp.Element)
コード例 #2
0
            ((v1, e1), (v2, e2)) = list(list(to_commute)[0][1])
            assert e1 == 1
            assert e2 == 1
            assert v1 > v2
            c_coef = None
            d_poly = None
            for (c, m) in commuted:
                if list(m) == [(v2, 1), (v1, 1)]:
                    c_coef = c
                    #buggy coercion workaround
                    d_poly = commuted - self(c) * self(m)
                    break
            assert not c_coef is None, list(m)
            v2_ind = self.gens().index(v2)
            v1_ind = self.gens().index(v1)
            cmat[v2_ind, v1_ind] = c_coef
            if d_poly:
                dmat[v2_ind, v1_ind] = d_poly
        from sage.rings.polynomial.plural import g_Algebra
        return g_Algebra(base_ring,
                         cmat,
                         dmat,
                         names=names or self.variable_names(),
                         order=order,
                         check=check)


from sage.misc.cache import Cache

cache = Cache(FreeAlgebra_generic)
コード例 #3
0
ファイル: kschur.py プロジェクト: bopopescu/sage-5
            p = sage.combinat.partition.Partition([])
            self._self_to_s_cache[0] = {p: {p: R(1)}}
            return
        else:
            self._self_to_s_cache[n] = {}

        #Fill in the cache from the k-Schurs to the Schurs
        for p in sage.combinat.partition.Partitions_n(n):
            if max(p) > self.k:
                self._self_to_s_cache[n][p] = {}
                continue
            katom = p.k_atom(self.k)
            res = sum([t**tab.charge() * s(tab.shape()) for tab in katom],
                      zero)
            self._self_to_s_cache[n][p] = res.monomial_coefficients()

    class Element(kSchurFunctions_generic.Element):
        pass


#############
#   Cache   #
#############
from sage.misc.cache import Cache
cache_t = Cache(kSchurFunctions_t)

# Backward compatibility for unpickling
from sage.structure.sage_object import register_unpickle_override
register_unpickle_override('sage.combinat.sf.kschur', 'kSchurFunction_t',
                           kSchurFunctions_t.Element)
コード例 #4
0
        sage: S2 is S #indirect doctest
        True
    """
    br = self.base_ring()
    q, t = self.q, self.t
    c[c.key(br, q=q, t=t)] = self
    c[c.key(br, q, t)] = self
    c[c.key(br, q, t)] = self
    c[c.key(br, q, t=t)] = self


#############
#   Cache   #
#############
from sage.misc.cache import Cache
cache_p = Cache(MacdonaldPolynomials_p)
cache_j = Cache(MacdonaldPolynomials_j)
cache_q = Cache(MacdonaldPolynomials_q)
cache_h = Cache(MacdonaldPolynomials_h)
cache_ht = Cache(MacdonaldPolynomials_ht)
cache_s = Cache(MacdonaldPolynomials_s)

# Backward compatibility for unpickling
from sage.structure.sage_object import register_unpickle_override
register_unpickle_override('sage.combinat.sf.macdonald',
                           'MacdonaldPolynomial_h',
                           MacdonaldPolynomials_h.Element)
register_unpickle_override('sage.combinat.sf.macdonald',
                           'MacdonaldPolynomial_ht',
                           MacdonaldPolynomials_ht.Element)
register_unpickle_override('sage.combinat.sf.macdonald',
コード例 #5
0
            sage: Q([1])^2 # indirect doctest
            JackQ[1, 1] + (2/(t+1))*JackQ[2]
            sage: Q([2])^2
            JackQ[2, 2] + (2/(t+1))*JackQ[3, 1] + ((6*t+6)/(6*t^2+5*t+1))*JackQ[4]
        """
        return self(self._P(left) * self._P(right))

    class Element(JackPolynomials_generic.Element):
        pass


#############
#   Cache   #
#############
from sage.misc.cache import Cache

cache_p = Cache(JackPolynomials_p)
cache_j = Cache(JackPolynomials_j)
cache_q = Cache(JackPolynomials_q)
cache_z = Cache(ZonalPolynomials)

# Backward compatibility for unpickling
from sage.structure.sage_object import register_unpickle_override

register_unpickle_override('sage.combinat.sf.jack', 'JackPolynomial_j',
                           JackPolynomials_j.Element)
register_unpickle_override('sage.combinat.sf.jack', 'JackPolynomial_p',
                           JackPolynomials_p.Element)
register_unpickle_override('sage.combinat.sf.jack', 'JackPolynomial_q',
                           JackPolynomials_q.Element)
コード例 #6
0
ファイル: llt.py プロジェクト: thalespaiva/sagelib
        EXAMPLES::
        
            sage: from sage.combinat.sf.llt import *
            sage: HCosp3 = LLT_cospin(QQ, 3)
            sage: HCosp3._m_cache(2)
            sage: l = lambda c: [ (i[0],[j for j in sorted(i[1].items())]) for i in sorted(c.items())]
            sage: l( HCosp3._self_to_m_cache[2] )
            [([1, 1], [([1, 1], t + 1), ([2], 1)]), ([2], [([1, 1], 1), ([2], 1)])]
            sage: l( HCosp3._m_to_self_cache[2] )
            [([1, 1], [([1, 1], 1/t), ([2], -1/t)]),
             ([2], [([1, 1], -1/t), ([2], (t + 1)/t)])]
        """
        self._invert_morphism(n, self.base_ring(), self._self_to_m_cache, \
                              self._m_to_self_cache, to_other_function = self._to_m)

    class Element(LLT_generic.Element):
        pass


from sage.misc.cache import Cache
cache_llt = Cache(LLT_class)
cache_llt_cospin = Cache(LLT_cospin)
cache_llt_spin = Cache(LLT_spin)

# Backward compatibility for unpickling
from sage.structure.sage_object import register_unpickle_override
register_unpickle_override('sage.combinat.sf.llt', 'LLTElement_spin',
                           LLT_spin.Element)
register_unpickle_override('sage.combinat.sf.llt', 'LLTElement_cospin',
                           LLT_cospin.Element)