def Podium(data): r""" If ``data`` is an integer than the standard podium with ``data`` steps is returned. Otherwise, ``data`` should be a weakly decreasing list of integers (i.e. a integer partition). EXAMPLES:: sage: from surface_dynamics import * sage: o = origamis.Podium([3,3,2,1]) sage: o Podium origami with partition [3, 3, 2, 1] sage: print(o) (1,2,3)(4,5,6)(7,8)(9) (1,4,7,9)(2,5,8)(3,6) """ from sage.combinat.partition import Partition if isinstance(data, (int, Integer)): p = Partition([i for i in range(data, 0, -1)]) else: p = Partition(data) p = Partition(data) q = p.conjugate() r = [] positions = [] i = 0 for j,jj in enumerate(p): r.extend(range(i+1,i+jj)) r.append(i) i += jj positions.extend((k,j) for k in range(jj)) u = [None]*sum(p) for j in range(len(q)): k = j for jj in range(q[j]-1): u[k] = k+p[jj] k += p[jj] u[k] = j return Origami(r, u, positions=positions, name="Podium origami with partition %s" % str(p), as_tuple=True)
def Podium(data): r""" If ``data`` is an integer than the standard podium with ``data`` steps is returned. Otherwise, ``data`` should be a weakly decreasing list of integers (i.e. a integer partition). EXAMPLES:: sage: from surface_dynamics.all import * sage: o = origamis.Podium([3,3,2,1]) sage: o Podium origami with partition [3, 3, 2, 1] sage: print o (1,2,3)(4,5,6)(7,8)(9) (1,4,7,9)(2,5,8)(3,6) """ from sage.combinat.partition import Partition if isinstance(data, (int,Integer)): p = Partition([i for i in xrange(data,0,-1)]) else: p = Partition(data) p = Partition(data) q = p.conjugate() r=[] positions = [] i = 0 for j,jj in enumerate(p): r.extend(xrange(i+1,i+jj)) r.append(i) i += jj positions.extend((k,j) for k in xrange(jj)) u = [None]*sum(p) for j in xrange(len(q)): k = j for jj in xrange(q[j]-1): u[k] = k+p[jj] k += p[jj] u[k] = j return Origami(r,u,positions=positions,name="Podium origami with partition %s" %str(p),as_tuple=True)
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(skp[1]) partc = skp[1] + [0] * (len(skp[0]) - len(skp[1])) 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 = SkewTableaux().from_expr([skp[1], tableau]).conjugate() tableau = tableau.to_expr()[1] skp = 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 SkewTableau(expr=[psave.conjugate(), tableau]).conjugate().to_expr()
def HighestWeightCrystal(dominant_weight, model=None): r""" Return the highest weight crystal of highest weight ``dominant_weight`` of the given ``model``. INPUT: - ``dominant_weight`` -- a dominant weight - ``model`` -- (optional) if not specified, then we have the following default models: * types `A_n, B_n, C_n, D_n, G_2` - :class:`tableaux <sage.combinat.crystals.tensor_product.CrystalOfTableaux>` * types `E_{6,7}` - :class:`type E finite dimensional crystal <FiniteDimensionalHighestWeightCrystal_TypeE>` * all other types - :class:`LS paths <sage.combinat.crystals.littelmann_path.CrystalOfLSPaths>` otherwise can be one of the following: * ``'Tableaux'`` - :class:`KN tableaux <sage.combinat.crystals.tensor_product.CrystalOfTableaux>` * ``'TypeE'`` - :class:`type E finite dimensional crystal <FiniteDimensionalHighestWeightCrystal_TypeE>` * ``'NakajimaMonomials'`` - :class:`Nakajima monomials <sage.combinat.crystals.monomial_crystals.CrystalOfNakajimaMonomials>` * ``'LSPaths'`` - :class:`LS paths <sage.combinat.crystals.littelmann_path.CrystalOfLSPaths>` * ``'AlcovePaths'`` - :class:`alcove paths <sage.combinat.crystals.alcove_path.CrystalOfAlcovePaths>` * ``'GeneralizedYoungWalls'`` - :class:`generalized Young walls <sage.combinat.crystals.generalized_young_walls.CrystalOfGeneralizedYoungWalls>` * ``'RiggedConfigurations'`` - :class:`rigged configurations <sage.combinat.rigged_configurations.rc_crystal.CrystalOfRiggedConfigurations>` EXAMPLES:: sage: La = RootSystem(['A',2]).weight_lattice().fundamental_weights() sage: wt = La[1] + La[2] sage: crystals.HighestWeight(wt) The crystal of tableaux of type ['A', 2] and shape(s) [[2, 1]] sage: La = RootSystem(['C',2]).weight_lattice().fundamental_weights() sage: wt = 5*La[1] + La[2] sage: crystals.HighestWeight(wt) The crystal of tableaux of type ['C', 2] and shape(s) [[6, 1]] Some type `E` examples:: sage: C = CartanType(['E',6]) sage: La = C.root_system().weight_lattice().fundamental_weights() sage: T = crystals.HighestWeight(La[1]) sage: T.cardinality() 27 sage: T = crystals.HighestWeight(La[6]) sage: T.cardinality() 27 sage: T = crystals.HighestWeight(La[2]) sage: T.cardinality() 78 sage: T = crystals.HighestWeight(La[4]) sage: T.cardinality() 2925 sage: T = crystals.HighestWeight(La[3]) sage: T.cardinality() 351 sage: T = crystals.HighestWeight(La[5]) sage: T.cardinality() 351 sage: C = CartanType(['E',7]) sage: La = C.root_system().weight_lattice().fundamental_weights() sage: T = crystals.HighestWeight(La[1]) sage: T.cardinality() 133 sage: T = crystals.HighestWeight(La[2]) sage: T.cardinality() 912 sage: T = crystals.HighestWeight(La[3]) sage: T.cardinality() 8645 sage: T = crystals.HighestWeight(La[4]) sage: T.cardinality() 365750 sage: T = crystals.HighestWeight(La[5]) sage: T.cardinality() 27664 sage: T = crystals.HighestWeight(La[6]) sage: T.cardinality() 1539 sage: T = crystals.HighestWeight(La[7]) sage: T.cardinality() 56 An example with an affine type:: sage: C = CartanType(['C',2,1]) sage: La = C.root_system().weight_lattice().fundamental_weights() sage: T = crystals.HighestWeight(La[1]) sage: sorted(T.subcrystal(max_depth=3), key=str) [(-Lambda[0] + 3*Lambda[1] - Lambda[2] - delta,), (-Lambda[0] + Lambda[1] + Lambda[2] - delta,), (-Lambda[1] + 2*Lambda[2] - delta,), (2*Lambda[0] - Lambda[1],), (Lambda[0] + Lambda[1] - Lambda[2],), (Lambda[0] - Lambda[1] + Lambda[2],), (Lambda[1],)] Using the various models:: sage: La = RootSystem(['F',4]).weight_lattice().fundamental_weights() sage: wt = La[1] + La[4] sage: crystals.HighestWeight(wt) The crystal of LS paths of type ['F', 4] and weight Lambda[1] + Lambda[4] sage: crystals.HighestWeight(wt, model='NakajimaMonomials') Highest weight crystal of modified Nakajima monomials of Cartan type ['F', 4] and highest weight Lambda[1] + Lambda[4] sage: crystals.HighestWeight(wt, model='AlcovePaths') Highest weight crystal of alcove paths of type ['F', 4] and weight Lambda[1] + Lambda[4] sage: crystals.HighestWeight(wt, model='RiggedConfigurations') Crystal of rigged configurations of type ['F', 4] and weight Lambda[1] + Lambda[4] sage: La = RootSystem(['A',3,1]).weight_lattice().fundamental_weights() sage: wt = La[0] + La[2] sage: crystals.HighestWeight(wt, model='GeneralizedYoungWalls') Highest weight crystal of generalized Young walls of Cartan type ['A', 3, 1] and highest weight Lambda[0] + Lambda[2] """ cartan_type = dominant_weight.parent().cartan_type() if model is None: if cartan_type.is_finite(): if cartan_type.type() == 'E': model = 'TypeE' elif cartan_type.type() in ['A','B','C','D','G']: model = 'Tableaux' else: model = 'LSPaths' else: model = 'LSPaths' if model == 'Tableaux': sh = sum([[i]*c for i,c in dominant_weight], []) sh = Partition(reversed(sh)) return CrystalOfTableaux(cartan_type, shape=sh.conjugate()) if model == 'TypeE': if not cartan_type.is_finite() or cartan_type.type() != 'E': raise ValueError("only for finite type E") if cartan_type.rank() == 6: return FiniteDimensionalHighestWeightCrystal_TypeE6(dominant_weight) elif cartan_type.rank() == 7: return FiniteDimensionalHighestWeightCrystal_TypeE7(dominant_weight) raise NotImplementedError if model == 'NakajimaMonomials': # Make sure it's in the weight lattice P = dominant_weight.parent().root_system.weight_lattice() wt = P.sum_of_terms((i, c) for i,c in dominant_weight) return CrystalOfNakajimaMonomials(cartan_type, wt) if model == 'LSPaths': # Make sure it's in the (extended) weight space if cartan_type.is_affine(): P = dominant_weight.parent().root_system.weight_space(extended=True) else: P = dominant_weight.parent().root_system.weight_space() wt = P.sum_of_terms((i, c) for i,c in dominant_weight) return CrystalOfLSPaths(wt) if model == 'AlcovePaths': # Make sure it's in the weight space P = dominant_weight.parent().root_system.weight_space() wt = P.sum_of_terms((i, c) for i,c in dominant_weight) return CrystalOfAlcovePaths(wt, highest_weight_crystal=True) if model == 'GeneralizedYoungWalls': if not cartan_type.is_affine(): raise ValueError("only for affine types") if cartan_type.type() != 'A': raise NotImplementedError("only for affine type A") # Make sure it's in the weight lattice P = dominant_weight.parent().root_system.weight_lattice(extended=True) wt = P.sum_of_terms((i, c) for i,c in dominant_weight) return CrystalOfGeneralizedYoungWalls(cartan_type.rank()-1, wt) if model == 'RiggedConfigurations': # Make sure it's in the weight lattice P = dominant_weight.parent().root_system.weight_lattice() wt = P.sum_of_terms((i, c) for i,c in dominant_weight) return CrystalOfRiggedConfigurations(cartan_type, wt) raise ValueError("invalid model")
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(skp[1]) partc = skp[1] + [0]*(len(skp[0])-len(skp[1])) 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 = SkewTableaux().from_expr([skp[1], tableau]).conjugate() tableau = tableau.to_expr()[1] skp = 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 SkewTableau(expr=[psave.conjugate(),tableau]).conjugate().to_expr()
def HighestWeightCrystal(dominant_weight, model=None): r""" Return the highest weight crystal of highest weight ``dominant_weight`` of the given ``model``. INPUT: - ``dominant_weight`` -- a dominant weight - ``model`` -- (optional) if not specified, then we have the following default models: * types `A_n, B_n, C_n, D_n, G_2` - :class:`tableaux <sage.combinat.crystals.tensor_product.CrystalOfTableaux>` * types `E_{6,7}` - :class:`type E finite dimensional crystal <FiniteDimensionalHighestWeightCrystal_TypeE>` * all other types - :class:`LS paths <sage.combinat.crystals.littelmann_path.CrystalOfLSPaths>` otherwise can be one of the following: * ``'Tableaux'`` - :class:`KN tableaux <sage.combinat.crystals.tensor_product.CrystalOfTableaux>` * ``'TypeE'`` - :class:`type E finite dimensional crystal <FiniteDimensionalHighestWeightCrystal_TypeE>` * ``'NakajimaMonomials'`` - :class:`Nakajima monomials <sage.combinat.crystals.monomial_crystals.CrystalOfNakajimaMonomials>` * ``'LSPaths'`` - :class:`LS paths <sage.combinat.crystals.littelmann_path.CrystalOfLSPaths>` * ``'AlcovePaths'`` - :class:`alcove paths <sage.combinat.crystals.alcove_path.CrystalOfAlcovePaths>` * ``'GeneralizedYoungWalls'`` - :class:`generalized Young walls <sage.combinat.crystals.generalized_young_walls.CrystalOfGeneralizedYoungWalls>` * ``'RiggedConfigurations'`` - :class:`rigged configurations <sage.combinat.rigged_configurations.rc_crystal.CrystalOfRiggedConfigurations>` EXAMPLES:: sage: La = RootSystem(['A',2]).weight_lattice().fundamental_weights() sage: wt = La[1] + La[2] sage: crystals.HighestWeight(wt) The crystal of tableaux of type ['A', 2] and shape(s) [[2, 1]] sage: La = RootSystem(['C',2]).weight_lattice().fundamental_weights() sage: wt = 5*La[1] + La[2] sage: crystals.HighestWeight(wt) The crystal of tableaux of type ['C', 2] and shape(s) [[6, 1]] Some type `E` examples:: sage: C = CartanType(['E',6]) sage: La = C.root_system().weight_lattice().fundamental_weights() sage: T = crystals.HighestWeight(La[1]) sage: T.cardinality() 27 sage: T = crystals.HighestWeight(La[6]) sage: T.cardinality() 27 sage: T = crystals.HighestWeight(La[2]) sage: T.cardinality() 78 sage: T = crystals.HighestWeight(La[4]) sage: T.cardinality() 2925 sage: T = crystals.HighestWeight(La[3]) sage: T.cardinality() 351 sage: T = crystals.HighestWeight(La[5]) sage: T.cardinality() 351 sage: C = CartanType(['E',7]) sage: La = C.root_system().weight_lattice().fundamental_weights() sage: T = crystals.HighestWeight(La[1]) sage: T.cardinality() 133 sage: T = crystals.HighestWeight(La[2]) sage: T.cardinality() 912 sage: T = crystals.HighestWeight(La[3]) sage: T.cardinality() 8645 sage: T = crystals.HighestWeight(La[4]) sage: T.cardinality() 365750 sage: T = crystals.HighestWeight(La[5]) sage: T.cardinality() 27664 sage: T = crystals.HighestWeight(La[6]) sage: T.cardinality() 1539 sage: T = crystals.HighestWeight(La[7]) sage: T.cardinality() 56 An example with an affine type:: sage: C = CartanType(['C',2,1]) sage: La = C.root_system().weight_lattice().fundamental_weights() sage: T = crystals.HighestWeight(La[1]) sage: sorted(T.subcrystal(max_depth=3), key=str) [(-Lambda[0] + 3*Lambda[1] - Lambda[2] - delta,), (-Lambda[0] + Lambda[1] + Lambda[2] - delta,), (-Lambda[1] + 2*Lambda[2] - delta,), (2*Lambda[0] - Lambda[1],), (Lambda[0] + Lambda[1] - Lambda[2],), (Lambda[0] - Lambda[1] + Lambda[2],), (Lambda[1],)] Using the various models:: sage: La = RootSystem(['F',4]).weight_lattice().fundamental_weights() sage: wt = La[1] + La[4] sage: crystals.HighestWeight(wt) The crystal of LS paths of type ['F', 4] and weight Lambda[1] + Lambda[4] sage: crystals.HighestWeight(wt, model='NakajimaMonomials') Highest weight crystal of modified Nakajima monomials of Cartan type ['F', 4] and highest weight Lambda[1] + Lambda[4] sage: crystals.HighestWeight(wt, model='AlcovePaths') Highest weight crystal of alcove paths of type ['F', 4] and weight Lambda[1] + Lambda[4] sage: crystals.HighestWeight(wt, model='RiggedConfigurations') Crystal of rigged configurations of type ['F', 4] and weight Lambda[1] + Lambda[4] """ cartan_type = dominant_weight.parent().cartan_type() if model is None: if cartan_type.is_finite(): if cartan_type.type() == 'E': model = 'TypeE' elif cartan_type.type() in ['A','B','C','D','G']: model = 'Tableaux' else: model = 'LSPaths' else: model = 'LSPaths' if model == 'Tableaux': sh = sum([[i]*c for i,c in dominant_weight], []) sh = Partition(reversed(sh)) return CrystalOfTableaux(cartan_type, shape=sh.conjugate()) if model == 'TypeE': if not cartan_type.is_finite() or cartan_type.type() != 'E': raise ValueError("only for finite type E") if cartan_type.rank() == 6: return FiniteDimensionalHighestWeightCrystal_TypeE6(dominant_weight) elif cartan_type.rank() == 7: return FiniteDimensionalHighestWeightCrystal_TypeE7(dominant_weight) raise NotImplementedError if model == 'NakajimaMonomials': # Make sure it's in the weight lattice P = dominant_weight.parent().root_system.weight_lattice() wt = P.sum_of_terms((i, c) for i,c in dominant_weight) return CrystalOfNakajimaMonomials(cartan_type, wt) if model == 'LSPaths': # Make sure it's in the (extended) weight space if cartan_type.is_affine(): P = dominant_weight.parent().root_system.weight_space(extended=True) else: P = dominant_weight.parent().root_system.weight_space() wt = P.sum_of_terms((i, c) for i,c in dominant_weight) return CrystalOfLSPaths(wt) if model == 'AlcovePaths': # Make sure it's in the weight space P = dominant_weight.parent().root_system.weight_space() wt = P.sum_of_terms((i, c) for i,c in dominant_weight) return CrystalOfAlcovePaths(wt, highest_weight_crystal=True) if model == 'GeneralizedYoungWalls': if not cartan_type.is_affine(): raise ValueError("only for affine types") if cartan_type.type() != 'A': raise NotImplementedError("only for affine type A") # Make sure it's in the weight lattice P = dominant_weight.parent().root_system.weight_space() wt = P.sum_of_terms((i, c) for i,c in dominant_weight) return CrystalOfGeneralizedYoungWalls(cartan_type.rank(), wt) if model == 'RiggedConfigurations': # Make sure it's in the weight lattice P = dominant_weight.parent().root_system.weight_lattice() wt = P.sum_of_terms((i, c) for i,c in dominant_weight) return CrystalOfRiggedConfigurations(cartan_type, wt) raise ValueError("invalid model")