def __init__(self, n=None): r""" EXAMPLES:: sage: from sage.combinat.baxter_permutations import BaxterPermutations_all sage: BaxterPermutations_all() Baxter permutations """ self.element_class = Permutations().element_class from sage.categories.examples.infinite_enumerated_sets import NonNegativeIntegers from sage.sets.family import Family DisjointUnionEnumeratedSets.__init__(self, Family(NonNegativeIntegers(), BaxterPermutations_size), facade=False, keepkey=False)
def __init__(self, enumset): """ EXAMPLES:: sage: from sage.sets.family import EnumeratedFamily sage: f = EnumeratedFamily(Permutations(3)) sage: TestSuite(f).run() sage: from sage.categories.examples.infinite_enumerated_sets import NonNegativeIntegers sage: f = Family(NonNegativeIntegers()) sage: TestSuite(f).run() """ if enumset.cardinality() == Infinity: baseset = NonNegativeIntegers() else: baseset = xrange(enumset.cardinality()) LazyFamily.__init__(self, baseset, enumset.unrank) self.enumset = enumset
def __init__(self, R, k, t=None): """ EXAMPLES:: sage: kSchurFunctions(QQ, 3).base_ring() 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 sfa.SymmetricFunctionAlgebra_generic.__init__(self, R) # so we need to take some counter measures self._basis_keys = sage.combinat.partition.Partitions(NonNegativeIntegers(), max_part=k) self._s = sfa.SFASchur(self.base_ring()) # 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))