def character(self): r""" Return the character of this module `M` in the `C` basis OUTPUT: - a linear combination `\chi(M) = \sum c_i C_i`, where `c_i` is the character (i.e. the trace) on `M` of any idempotent `e` in the regular `J`-class indexed by `i`. EXAMPLES:: sage: M = Monoids().HTrivial().Finite().example(); M The finite H-trivial monoid of order preserving maps on {1, .., 3} sage: M.rename("M") sage: R = M.regular_representation(side = 'left') sage: R.character() 10*C[0] + 4*C[1] + C[2] sage: R.character().parent() The left-character ring of M over Rational Field in the basis of characters of left-class functions modules sage: R = M.regular_representation(side = 'right') sage: R.character() 10*C[0] + 6*C[1] + 3*C[2] sage: R.character().parent() The right-character ring of M over Rational Field in the basis of characters of right-class functions modules """ S = self.semigroup() C = S.character_ring(self.base_ring(), side=self.side()).C() base_ring = C.base_ring() e = S.j_transversal_of_idempotents() # Remark: let e and f be two idempotents, and identify # them with the corresponding linear projections # acting on ``self``. If e <=_J f, then the rank of e # is smaller than the rank of f. # # Corollary: the set of idempotents having non zero # character (the support below) is an upper ideal in J-order. # # We use this to avoid computing the character for all # regular J-classes. # # I am not yet sure that this works in non zero # characteristic, so let's be safe. assert self.base_ring().characteristic() == 0 from sage.combinat.backtrack import TransitiveIdeal P = S.j_poset_on_regular_classes() @cached_function def character(i): return self.character_of(e[i]) def children(i): return (j for j in P.lower_covers(i) if character(j)) support = TransitiveIdeal(children, [P.top()]) return C.sum_of_terms( (i, base_ring(character(i))) for i in support)
def __iter__(self, index_set=None, max_depth=float('inf')): """ Return an iterator over the elements of ``self``. INPUT: - ``index_set`` -- (Default: ``None``) The index set; if ``None`` then use the index set of the crystal - ``max_depth`` -- (Default: infinity) The maximum depth to build The iteration order is not specified except that, if ``max_depth`` is finite, then the iteration goes depth by depth. EXAMPLES:: sage: C = crystals.LSPaths(['A',2,1],[-1,0,1]) sage: C.__iter__.__module__ 'sage.categories.crystals' sage: g = C.__iter__() sage: g.next() (-Lambda[0] + Lambda[2],) sage: g.next() (Lambda[0] - Lambda[1] + delta,) sage: g.next() (Lambda[1] - Lambda[2] + delta,) sage: g.next() (-Lambda[0] + Lambda[2] + delta,) sage: g.next() (Lambda[1] - Lambda[2],) sage: sorted(C.__iter__(index_set=[1,2]), key=str) [(-Lambda[0] + Lambda[2],), (Lambda[0] - Lambda[1],), (Lambda[1] - Lambda[2],)] sage: sorted(C.__iter__(max_depth=1), key=str) [(-Lambda[0] + Lambda[2],), (Lambda[0] - Lambda[1] + delta,), (Lambda[1] - Lambda[2],)] """ if index_set is None: index_set = self.index_set() if max_depth < float('inf'): from sage.combinat.backtrack import TransitiveIdealGraded return TransitiveIdealGraded(lambda x: [x.f(i) for i in index_set] + [x.e(i) for i in index_set], self.module_generators, max_depth).__iter__() from sage.combinat.backtrack import TransitiveIdeal return TransitiveIdeal(lambda x: [x.f(i) for i in index_set] + [x.e(i) for i in index_set], self.module_generators).__iter__()
def set(self): r""" Naive algorithm to give a set with all the elements of the conjugacy class. .. TODO:: Implement a non-naive algorithm, cf. for instance G. Butler: "An Inductive Schema for Computing Conjugacy Classes in Permutation Groups", Math. of Comp. Vol. 62, No. 205 (1994) EXAMPLES: Groups of permutations:: sage: G = SymmetricGroup(3) sage: g = G((1,2)) sage: C = ConjugacyClass(G,g) sage: S = [(2,3), (1,2), (1,3)] sage: C.set() == Set(G(x) for x in S) True Groups of matrices over finite fields:: sage: F = GF(5) sage: gens = [matrix(F,2,[1,2, -1, 1]), matrix(F,2, [1,1, 0,1])] sage: H = MatrixGroup(gens) sage: h = H(matrix(F,2,[1,2, -1, 1])) sage: C = ConjugacyClass(H,h) sage: S = [[[3, 2], [2, 4]], [[0, 1], [2, 2]], [[3, 4], [1, 4]],\ [[0, 3], [4, 2]], [[1, 2], [4, 1]], [[2, 1], [2, 0]],\ [[4, 1], [4, 3]], [[4, 4], [1, 3]], [[2, 4], [3, 0]],\ [[1, 4], [2, 1]], [[3, 3], [3, 4]], [[2, 3], [4, 0]],\ [[0, 2], [1, 2]], [[1, 3], [1, 1]], [[4, 3], [3, 3]],\ [[4, 2], [2, 3]], [[0, 4], [3, 2]], [[1, 1], [3, 1]],\ [[2, 2], [1, 0]], [[3, 1], [4, 4]]] sage: C.set() == Set(H(x) for x in S) True """ from sage.sets.set import Set from sage.combinat.backtrack import TransitiveIdeal if self._parent.is_finite(): g = self._representative G = self._parent gens = G.gens() return Set(x for x in TransitiveIdeal( lambda y: [c * y * c**-1 for c in gens], [g])) else: raise NotImplementedError( "Listing the elements of conjugacy classes is not implemented for infinite groups!" )
def __iter__(self): """ Returns an iterator over the elements of ``self``. EXAMPLES:: sage: S = FiniteSemigroups().example(alphabet=('x','y')) sage: it = S.__iter__() sage: list(it) ['y', 'x', 'xy', 'yx'] """ from sage.combinat.backtrack import TransitiveIdeal return TransitiveIdeal(self.succ_generators(side = "right"), self.semigroup_generators()).__iter__()
def positive_roots(self): r""" Returns the positive roots of self. EXAMPLES:: sage: L = RootSystem(['A',3]).root_lattice() sage: sorted(L.positive_roots()) [alpha[1], alpha[1] + alpha[2], alpha[1] + alpha[2] + alpha[3], alpha[2], alpha[2] + alpha[3], alpha[3]] Algorithm: generate them from the simple roots by applying successive reflections toward the positive chamber. """ assert self.cartan_type().is_finite() return TransitiveIdeal(attrcall('pred'), self.simple_roots())
def __iter__(self): """ Returns the iterator of ``self``. EXAMPLES:: sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['A', 3, 1], [[2,1], [1,1]]) sage: g = KRT.__iter__() sage: g.next() [[2], [3]] (X) [[1]] sage: g.next() [[2], [4]] (X) [[1]] """ index_set = self._cartan_type.classical().index_set() from sage.combinat.backtrack import TransitiveIdeal return TransitiveIdeal(lambda x: [x.f(i) for i in index_set], self.module_generators).__iter__()
def __iter__(self): r""" Return an iterator over the elements of ``self``. This brute force implementation recursively multiplies together the distinguished semigroup generators. .. SEEALSO:: :meth:`semigroup_generators` EXAMPLES:: sage: S = FiniteSemigroups().example(alphabet=('x','y')) sage: it = S.__iter__() sage: list(it) ['y', 'x', 'xy', 'yx'] """ from sage.combinat.backtrack import TransitiveIdeal return TransitiveIdeal(self.succ_generators(side = "right"), self.semigroup_generators()).__iter__()
def smaller(self): r""" Returns the elements in the orbit of self which are smaller than self in the weak order. EXAMPLES:: sage: L = RootSystem(['A',3]).ambient_lattice() sage: e = L.basis() sage: e[2].smaller() [(0, 0, 1, 0), (0, 1, 0, 0), (1, 0, 0, 0)] sage: len(L.rho().smaller()) 1 sage: len((-L.rho()).smaller()) 24 sage: sorted([len(x.smaller()) for x in L.rho().orbit()]) [1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 8, 8, 8, 8, 12, 12, 12, 24] """ return [x for x in TransitiveIdeal(attrcall('pred'), [self])]
def ideal(self, gens, side="twosided"): r""" Return the ``side``-sided ideal generated by ``gens``. This brute force implementation recursively multiplies the elements of ``gens`` by the distinguished generators of this semigroup. .. SEEALSO:: :meth:`semigroup_generators` INPUT:: - ``gens``: a list (or iterable) of elements of ``self`` - ``side``: [default: "twosided"] "left", "right" or "twosided" EXAMPLES:: sage: S = FiniteSemigroups().example() sage: list(S.ideal([S('cab')], side="left")) ['cab', 'dcab', 'adcb', 'acb', 'bdca', 'bca', 'abdc', 'cadb', 'acdb', 'bacd', 'abcd', 'cbad', 'abc', 'acbd', 'dbac', 'dabc', 'cbda', 'bcad', 'cabd', 'dcba', 'bdac', 'cba', 'badc', 'bac', 'cdab', 'dacb', 'dbca', 'cdba', 'adbc', 'bcda'] sage: list(S.ideal([S('cab')], side="right")) ['cab', 'cabd'] sage: list(S.ideal([S('cab')], side="twosided")) ['cab', 'dcab', 'acb', 'adcb', 'acbd', 'bdca', 'bca', 'cabd', 'abdc', 'cadb', 'acdb', 'bacd', 'abcd', 'cbad', 'abc', 'dbac', 'dabc', 'cbda', 'bcad', 'dcba', 'bdac', 'cba', 'cdab', 'bac', 'badc', 'dacb', 'dbca', 'cdba', 'adbc', 'bcda'] sage: list(S.ideal([S('cab')])) ['cab', 'dcab', 'acb', 'adcb', 'acbd', 'bdca', 'bca', 'cabd', 'abdc', 'cadb', 'acdb', 'bacd', 'abcd', 'cbad', 'abc', 'dbac', 'dabc', 'cbda', 'bcad', 'dcba', 'bdac', 'cba', 'cdab', 'bac', 'badc', 'dacb', 'dbca', 'cdba', 'adbc', 'bcda'] """ from sage.combinat.backtrack import TransitiveIdeal return TransitiveIdeal(self.succ_generators(side = side), gens)
def elements(self): r""" Returns the elements of ``self`` Those are constructed as the elements below the maximal elements of ``self`` in Bruhat order. OUTPUT: a :class:`TransitiveIdeal` object EXAMPLES:: sage: PF = WeylGroup(['A',3]).pieri_factors() sage: [w.reduced_word() for w in PF.elements()] [[3, 2, 1], [2, 1], [1], [], [3, 1], [3], [3, 2], [2]] ..seealso:: :meth:`maximal_elements` TODO: possibly remove this method and instead have this class inherit from :class:`TransitiveIdeal`. """ return TransitiveIdeal(attrcall('bruhat_lower_covers'), self.maximal_elements())
def cluster(self, pt=None): r""" Return an iterator over the open cluster containing the point pt. INPUT: - ``pt`` - tuple, point in Z^d. If None, pt=zero is considered. EXAMPLES: sage: from slabbe import BondPercolationSample sage: S = BondPercolationSample(0.5) sage: it = S.cluster() sage: next(it) (0, 0) """ if pt is None: pt = self.zero() generators = [pt] return iter(TransitiveIdeal(self.children, generators))
def ideal(self, gens, side="twosided"): r""" Returns the ``side``-sided ideal generated by ``gens``. INPUT:: - ``gens``: a list (or iterable) of elements of ``self`` - ``side``: [default: "twosided"] "left", "right" or "twosided" EXAMPLES:: sage: S = FiniteSemigroups().example() sage: list(S.ideal([S('cab')], side="left")) ['cab', 'dcab', 'adcb', 'acb', 'bdca', 'bca', 'abdc', 'cadb', 'acdb', 'bacd', 'abcd', 'cbad', 'abc', 'acbd', 'dbac', 'dabc', 'cbda', 'bcad', 'cabd', 'dcba', 'bdac', 'cba', 'badc', 'bac', 'cdab', 'dacb', 'dbca', 'cdba', 'adbc', 'bcda'] sage: list(S.ideal([S('cab')], side="right")) ['cab', 'cabd'] sage: list(S.ideal([S('cab')], side="twosided")) ['cab', 'dcab', 'acb', 'adcb', 'acbd', 'bdca', 'bca', 'cabd', 'abdc', 'cadb', 'acdb', 'bacd', 'abcd', 'cbad', 'abc', 'dbac', 'dabc', 'cbda', 'bcad', 'dcba', 'bdac', 'cba', 'cdab', 'bac', 'badc', 'dacb', 'dbca', 'cdba', 'adbc', 'bcda'] sage: list(S.ideal([S('cab')])) ['cab', 'dcab', 'acb', 'adcb', 'acbd', 'bdca', 'bca', 'cabd', 'abdc', 'cadb', 'acdb', 'bacd', 'abcd', 'cbad', 'abc', 'dbac', 'dabc', 'cbda', 'bcad', 'dcba', 'bdac', 'cba', 'cdab', 'bac', 'badc', 'dacb', 'dbca', 'cdba', 'adbc', 'bcda'] """ from sage.combinat.backtrack import TransitiveIdeal return TransitiveIdeal(self.succ_generators(side=side), gens)
def orbit(self): r""" The orbit of self under the action of the Weyl group EXAMPLES:: `\rho` is a regular element whose orbit is in bijection with the Weyl group. In particular, it as 6 elements for the symmetric group `S_3`:: sage: L = RootSystem(["A", 2]).ambient_lattice() sage: sorted(L.rho().orbit()) # the output order is not specified [(1, 2, 0), (1, 0, 2), (2, 1, 0), (2, 0, 1), (0, 1, 2), (0, 2, 1)] sage: L = RootSystem(["A", 3]).weight_lattice() sage: len(L.rho().orbit()) 24 sage: len(L.fundamental_weights()[1].orbit()) 4 sage: len(L.fundamental_weights()[2].orbit()) 6 """ return [ x for x in TransitiveIdeal(attrcall('simple_reflections'), [self]) ]
def __iter__(self): from sage.combinat.backtrack import TransitiveIdeal return TransitiveIdeal(self.succ_generators(side="right"), [self.one()]).__iter__()
def __iter__(self, index_set=None, max_depth=float('inf')): """ Returns the iterator of ``self``. INPUT: - ``index_set`` -- (Default: ``None``) The index set; if ``None`` then use the index set of the crystal - ``max_depth`` -- (Default: infinity) The maximum depth to build EXAMPLES:: sage: C = CrystalOfLSPaths(['A',2,1],[-1,0,1]) sage: C.__iter__.__module__ 'sage.categories.crystals' sage: g = C.__iter__() sage: g.next() (-Lambda[0] + Lambda[2],) sage: g.next() (Lambda[0] - Lambda[1] + delta,) sage: g.next() (Lambda[1] - Lambda[2] + delta,) sage: g.next() (Lambda[1] - Lambda[2],) sage: g.next() (Lambda[0] - Lambda[1],) sage: h = C.__iter__(index_set=[1,2]) sage: h.next() (-Lambda[0] + Lambda[2],) sage: h.next() (Lambda[1] - Lambda[2],) sage: h.next() (Lambda[0] - Lambda[1],) sage: h.next() Traceback (most recent call last): ... StopIteration sage: g = C.__iter__(max_depth=1) sage: g.next() (-Lambda[0] + Lambda[2],) sage: g.next() (Lambda[1] - Lambda[2],) sage: g.next() (Lambda[0] - Lambda[1] + delta,) sage: h.next() Traceback (most recent call last): ... StopIteration """ if index_set is None: index_set = self.index_set() if max_depth < float('inf'): from sage.combinat.backtrack import TransitiveIdealGraded return TransitiveIdealGraded(lambda x: [x.f(i) for i in index_set] + [x.e(i) for i in index_set], self.module_generators, max_depth).__iter__() from sage.combinat.backtrack import TransitiveIdeal return TransitiveIdeal(lambda x: [x.f(i) for i in index_set] + [x.e(i) for i in index_set], self.module_generators).__iter__()