def __init__(self, starting_weight): """ EXAMPLES:: sage: C = crystals.LSPaths(['A',2,1],[-1,0,1]); C The crystal of LS paths of type ['A', 2, 1] and weight -Lambda[0] + Lambda[2] sage: C.R Root system of type ['A', 2, 1] sage: C.weight -Lambda[0] + Lambda[2] sage: C.weight.parent() Extended weight space over the Rational Field of the Root system of type ['A', 2, 1] sage: C.module_generators [(-Lambda[0] + Lambda[2],)] TESTS:: sage: C = crystals.LSPaths(['A',2,1], [-1,0,1]) sage: TestSuite(C).run() # long time sage: C = crystals.LSPaths(['E',6], [1,0,0,0,0,0]) sage: TestSuite(C).run() """ cartan_type = starting_weight.parent().cartan_type() self.R = RootSystem(cartan_type) self.weight = starting_weight if not self.weight.parent().base_ring().has_coerce_map_from(QQ): raise ValueError( "Please use the weight space, rather than weight lattice for your weights" ) self._cartan_type = cartan_type self._name = "The crystal of LS paths of type %s and weight %s" % ( cartan_type, starting_weight) if cartan_type.is_affine(): if all(i >= 0 for i in starting_weight.coefficients()): Parent.__init__(self, category=(RegularCrystals(), HighestWeightCrystals(), InfiniteEnumeratedSets())) elif starting_weight.parent().is_extended(): Parent.__init__(self, category=(RegularCrystals(), InfiniteEnumeratedSets())) else: Parent.__init__(self, category=(RegularCrystals(), FiniteCrystals())) else: Parent.__init__(self, category=ClassicalCrystals()) if starting_weight == starting_weight.parent().zero(): initial_element = self(tuple([])) else: initial_element = self(tuple([starting_weight])) self.module_generators = [initial_element]
def __init__(self, wt, WLR): r""" Initialize ``self``. EXAMPLES:: sage: La = RootSystem(['A', 2]).weight_lattice().fundamental_weights() sage: RC = crystals.RiggedConfigurations(La[1] + La[2]) sage: TestSuite(RC).run() sage: La = RootSystem(['A', 2, 1]).weight_lattice().fundamental_weights() sage: RC = crystals.RiggedConfigurations(La[0]) sage: TestSuite(RC).run() # long time """ self._cartan_type = WLR.cartan_type() self._wt = wt self._rc_index = self._cartan_type.index_set() self._rc_index_inverse = {i: ii for ii, i in enumerate(self._rc_index)} # We store the Cartan matrix for the vacancy number calculations for speed self._cartan_matrix = self._cartan_type.cartan_matrix() if self._cartan_type.is_finite(): category = ClassicalCrystals() else: category = (RegularCrystals(), HighestWeightCrystals(), InfiniteEnumeratedSets()) Parent.__init__(self, category=category) n = self._cartan_type.rank() #== len(self._cartan_type.index_set()) self.module_generators = (self.element_class( self, partition_list=[[] for i in range(n)]), )
def __init__(self, cartan_type, classical_crystal, category=None): """ Input is an affine Cartan type 'cartan_type', a classical crystal 'classical_crystal', and automorphism and its inverse 'automorphism' and 'inverse_automorphism', and the Dynkin node 'dynkin_node' EXAMPLES:: sage: n = 1 sage: C = CrystalOfTableaux(['A',n],shape=[1]) sage: pr = attrcall("promotion") sage: pr_inverse = attrcall("promotion_inverse") sage: A = AffineCrystalFromClassicalAndPromotion(['A',n,1],C,pr,pr_inverse,1) # indirect doctest sage: A.list() [[[1]], [[2]]] sage: A.cartan_type() ['A', 1, 1] sage: A.index_set() (0, 1) Note: AffineCrystalFromClassical is an abstract class, so we can't test it directly. TESTS:: sage: TestSuite(A).run() """ if category is None: category = (RegularCrystals(), FiniteCrystals()) self._cartan_type = cartan_type Parent.__init__(self, category=category) self.classical_crystal = classical_crystal self.module_generators = map(self.retract, self.classical_crystal.module_generators) self.element_class._latex_ = lambda x: x.lift()._latex_()
def __init__(self, cartan_type, B, biject_class): r""" Initialize all common elements for rigged configurations. INPUT: - ``cartan_type`` -- The Cartan type - ``B`` -- A list of dimensions `[r,s]` for rectangles of height `r` and width `s` - ``biject_class`` -- The class the bijection creates TESTS:: sage: RC = HighestWeightRiggedConfigurations(['A', 3, 1], [[3, 2], [1, 2], [1, 1]]) # indirect doctest sage: RC Highest weight rigged configurations of type ['A', 3, 1] and factors ((3, 2), (1, 2), (1, 1)) sage: RC = RiggedConfigurations(['A', 3, 1], [[3, 2], [1, 2], [1, 1]]) # indirect doctest sage: RC Rigged configurations of type ['A', 3, 1] and factors ((3, 2), (1, 2), (1, 1)) """ assert cartan_type.is_affine() self._affine_ct = cartan_type # Force to classical since we do not have e_0 and f_0 yet self._cartan_type = cartan_type.classical() self.dims = B self._bijection_class = biject_class self.rename("Rigged configurations of type %s and factors %s" % (cartan_type, B)) Parent.__init__(self, category=(RegularCrystals(), FiniteCrystals()))
def __init__(self, ct, La): r""" EXAMPLES:: sage: La = RootSystem(['A',2]).weight_lattice().fundamental_weights() sage: M = crystals.NakajimaMonomials(['A',2], La[1]+La[2]) sage: TestSuite(M).run() sage: La = RootSystem(['C',2,1]).weight_lattice(extended=True).fundamental_weights() sage: M = crystals.NakajimaMonomials(['C',2,1], La[0]) sage: TestSuite(M).run(max_runs=100) """ if ct.is_finite(): cat = ClassicalCrystals() else: cat = (RegularCrystals(), HighestWeightCrystals(), InfiniteEnumeratedSets()) InfinityCrystalOfNakajimaMonomials.__init__( self, ct, cat, CrystalOfNakajimaMonomialsElement) self._cartan_type = ct self.hw = La gen = {} for j in range(len(La.support())): gen[(La.support()[j], 0)] = La.coefficients()[j] self.module_generators = (self.element_class(self, gen), )
def __init__(self, cartan_type, r, s): r""" Initialize the KirillovReshetikhinTableaux class. INPUT: - ``cartan_type`` -- The Cartan type - ``r`` -- The number of rows - ``s`` -- The number of columns EXAMPLES:: sage: KRT = KirillovReshetikhinTableaux(['A', 4, 1], 2, 3); KRT Kirillov-Reshetikhin tableaux of type ['A', 4, 1] and shape (2, 3) sage: TestSuite(KRT).run() # long time (4s on sage.math, 2013) sage: KRT = KirillovReshetikhinTableaux(['D', 4, 1], 2, 3); KRT Kirillov-Reshetikhin tableaux of type ['D', 4, 1] and shape (2, 3) sage: TestSuite(KRT).run() # long time (53s on sage.math, 2013) sage: KRT = KirillovReshetikhinTableaux(['D', 4, 1], 4, 1); KRT Kirillov-Reshetikhin tableaux of type ['D', 4, 1] and shape (4, 1) sage: TestSuite(KRT).run() """ self._r = r self._s = s Parent.__init__(self, category=(RegularCrystals(), FiniteCrystals())) self.rename( "Kirillov-Reshetikhin tableaux of type %s and shape (%d, %d)" % (cartan_type, r, s)) self._cartan_type = cartan_type.classical() self.letters = CrystalOfLetters(self._cartan_type) self.module_generators = self._build_module_generators()
def super_categories(self): """ EXAMPLES:: sage: from sage.categories.loop_crystals import RegularLoopCrystals sage: RegularLoopCrystals().super_categories() [Category of regular crystals, Category of loop crystals] """ return [RegularCrystals(), LoopCrystals()]
def super_categories(self): r""" EXAMPLES:: sage: ClassicalCrystals().super_categories() [Category of regular crystals, Category of finite crystals, Category of highest weight crystals] """ return [RegularCrystals(), FiniteCrystals(), HighestWeightCrystals()]
def __init__(self, n, La): r""" EXAMPLES:: sage: La = RootSystem(['A',2,1]).weight_lattice().fundamental_weights()[1] sage: YLa = crystals.GeneralizedYoungWalls(2,La) We skip the two tests because they take a very long time:: sage: TestSuite(YLa).run(skip=["_test_enumerated_set_contains","_test_stembridge_local_axioms"]) # long time """ InfinityCrystalOfGeneralizedYoungWalls.__init__( self, n, category=(RegularCrystals(), HighestWeightCrystals(), InfiniteEnumeratedSets()) ) self.hw = La
def __init__(self, ct, La): r""" EXAMPLES:: sage: La = RootSystem(['A',2]).weight_lattice().fundamental_weights() sage: M = crystals.NakajimaMonomials(['A',2],La[1]+La[2]) sage: TestSuite(M).run() """ InfinityCrystalOfNakajimaMonomials.__init__( self, ct, (RegularCrystals(), HighestWeightCrystals()), CrystalOfNakajimaMonomialsElement ) self._cartan_type = ct self.hw = La gen = {} for j in range(len(La.support())): gen[(La.support()[j],0)] = La.coefficients()[j] self.module_generators = (self.element_class(self,gen),)
def __init__(self, cartan_type, P): r""" Initialize ``self``. EXAMPLES:: sage: B = crystals.elementary.Component("D4") sage: TestSuite(B).run() """ self._weight_lattice_realization = P self._cartan_type = cartan_type if self._cartan_type.type() == 'Q': category = RegularSuperCrystals() else: category = (RegularCrystals().Finite(), HighestWeightCrystals()) Parent.__init__(self, category=category) self.module_generators = (self.element_class(self), )
def __init__(self, B): """ Initialize ``self``. EXAMPLES: We skip the Stembridge axioms test since this is an abstract crystal:: sage: A = crystals.KirillovReshetikhin(['A',2,1], 2, 2).affinization() sage: TestSuite(A).run(skip="_test_stembridge_local_axioms") # long time """ if not B.cartan_type().is_affine(): raise ValueError("must be an affine crystal") if B.cardinality() == Infinity: raise ValueError("must be finite crystal") self._B = B self._cartan_type = B.cartan_type() Parent.__init__(self, category=(RegularCrystals(), InfiniteEnumeratedSets())) self.module_generators = tuple([self.element_class(self, b, 0) for b in B.module_generators])
def __init__(self, ct, La, c): r""" EXAMPLES:: sage: La = RootSystem(['A',2]).weight_lattice().fundamental_weights() sage: M = crystals.NakajimaMonomials(['A',2], La[1]+La[2]) sage: TestSuite(M).run() sage: La = RootSystem(['C',2,1]).weight_lattice(extended=True).fundamental_weights() sage: M = crystals.NakajimaMonomials(['C',2,1], La[0]) sage: TestSuite(M).run(max_runs=100) """ if ct.is_finite(): cat = ClassicalCrystals() else: cat = (RegularCrystals(), HighestWeightCrystals(), InfiniteEnumeratedSets()) InfinityCrystalOfNakajimaMonomials.__init__(self, ct, c, cat) self._cartan_type = ct self.hw = La gen = {(i,0): c for i,c in La} self.module_generators = (self.element_class(self, gen, {}),)
def __init__(self, cartan_type, classical_crystal, category=None): """ Input is an affine Cartan type ``cartan_type``, a classical crystal ``classical_crystal``, and automorphism and its inverse ``automorphism`` and ``inverse_automorphism``, and the Dynkin node ``dynkin_node``. EXAMPLES:: sage: n = 1 sage: C = crystals.Tableaux(['A',n],shape=[1]) sage: pr = attrcall("promotion") sage: pr_inverse = attrcall("promotion_inverse") sage: A = crystals.AffineFromClassicalAndPromotion(['A',n,1],C,pr,pr_inverse,1) # indirect doctest sage: A.list() [[[1]], [[2]]] sage: A.cartan_type() ['A', 1, 1] sage: A.index_set() (0, 1) .. NOTE:: :class:`~sage.combinat.crystals.affine.AffineCrystalFromClassical` is an abstract class, so we can't test it directly. TESTS:: sage: TestSuite(A).run() """ if category is None: category = (RegularCrystals(), FiniteCrystals()) self._cartan_type = cartan_type Parent.__init__(self, category=category) self.classical_crystal = classical_crystal self.module_generators = [ self.retract(_) for _ in self.classical_crystal.module_generators ] self.element_class._latex_ = lambda x: x.lift()._latex_()
def __classcall_private__(cls, *crystals, **options): """ Create the correct parent object. EXAMPLES:: sage: C = crystals.Letters(['A',2]) sage: T = crystals.TensorProduct(C, C) sage: T2 = crystals.TensorProduct(C, C, cartan_type=['A',2]) sage: T is T2 True sage: T.category() Category of tensor products of classical crystals sage: T3 = crystals.TensorProduct(C, C, C) sage: T3p = crystals.TensorProduct(T, C) sage: T3 is T3p True sage: B1 = crystals.TensorProduct(T, C) sage: B2 = crystals.TensorProduct(C, T) sage: B3 = crystals.TensorProduct(C, C, C) sage: B1 is B2 and B2 is B3 True sage: B = crystals.infinity.Tableaux(['A',2]) sage: T = crystals.TensorProduct(B, B) sage: T.category() Category of infinite tensor products of highest weight crystals TESTS: Check that mismatched Cartan types raise an error:: sage: A2 = crystals.Letters(['A', 2]) sage: A3 = crystals.Letters(['A', 3]) sage: crystals.TensorProduct(A2, A3) Traceback (most recent call last): ... ValueError: all crystals must be of the same Cartan type """ crystals = tuple(crystals) if "cartan_type" in options: cartan_type = CartanType(options.pop("cartan_type")) else: if not crystals: raise ValueError( "you need to specify the Cartan type if the tensor product list is empty" ) else: cartan_type = crystals[0].cartan_type() if any(c.cartan_type() != cartan_type for c in crystals): raise ValueError("all crystals must be of the same Cartan type") if "generators" in options: generators = tuple( tuple(x) if isinstance(x, list) else x for x in options["generators"]) if all(c in RegularCrystals() for c in crystals): return TensorProductOfRegularCrystalsWithGenerators( crystals, generators, cartan_type) return TensorProductOfCrystalsWithGenerators( crystals, generators, cartan_type) # Flatten out tensor products tp = sum([ B.crystals if isinstance(B, FullTensorProductOfCrystals) else (B, ) for B in crystals ], ()) if all(c in RegularCrystals() for c in crystals): return FullTensorProductOfRegularCrystals(tp, cartan_type=cartan_type) return FullTensorProductOfCrystals(tp, cartan_type=cartan_type)