def __init__(self, n): r""" Initializes the class of all standard super tableaux of size ``n``. TESTS:: sage: TestSuite( StandardSuperTableaux(4) ).run() """ StandardSuperTableaux.__init__(self) from sage.combinat.partition import Partitions_n DisjointUnionEnumeratedSets.__init__(self, Family(Partitions_n(n), StandardSuperTableaux_shape), category=FiniteEnumeratedSets(), facade=True, keepkey=False) self.size = Integer(n)
def __init__(self, domain, part): """ Initialize ``self``. EXAMPLES:: sage: G = SymmetricGroup(5) sage: g = G([(1,2), (3,4,5)]) sage: C = G.conjugacy_class(Partition([3,2])) sage: type(C._part) <class 'sage.combinat.partition.Partitions_n_with_category.element_class'> """ P = Partitions_n(len(domain)) self._part = P(part) self._domain = domain self._set = None
def wsum(m): # expansion of h_m in w-basis, for m > 0 return self._from_dict({lam: 1 for lam in Partitions_n(m)})
def _precompute_cache(self, n, to_self_cache, from_self_cache, transition_matrices, inverse_transition_matrices, to_self_gen_function): """ Compute the transition matrices between ``self`` and another multiplicative homogeneous basis in the homogeneous components of degree `n`. The results are not returned, but rather stored in the caches. This assumes that the transition matrices in all degrees smaller than `n` have already been computed and cached! INPUT: - ``n`` -- nonnegative integer - ``to_self_cache`` -- a cache which stores the coordinates of the elements of the other basis with respect to the basis ``self`` - ``from_self_cache`` -- a cache which stores the coordinates of the elements of ``self`` with respect to the other basis - ``transition_matrices`` -- a cache for transition matrices which contain the coordinates of the elements of the other basis with respect to ``self`` - ``inverse_transition_matrices`` -- a cache for transition matrices which contain the coordinates of the elements of ``self`` with respect to the other basis - ``to_self_gen_function`` -- a function which takes a positive integer `n` and returns the element of the other basis corresponding to the partition `[n]` expanded with respect to the Witt basis ``self`` (as an element of ``self``, not as a dictionary) Examples for usage of this function are the ``_precompute_h``, ``_precompute_e`` and ``_precompute_p`` methods of this class. EXAMPLES:: The examples below demonstrate how the caches are built step by step using the ``_precompute_cache`` method. In order not to influence the outcome of other doctests, we make sure not to use the caches internally used by this class, but rather to create new caches:: sage: Sym = SymmetricFunctions(QQ) sage: w = Sym.w() sage: toy_to_self_cache = {} sage: toy_from_self_cache = {} sage: toy_transition_matrices = {} sage: toy_inverse_transition_matrices = {} sage: l = lambda c: [ (i[0],[j for j in sorted(i[1].items())]) for i in sorted(c.items())] sage: l(toy_to_self_cache) [] sage: def toy_gen_function(n): ....: if n > 1: ....: return w(Partition([n])) + n * w(Partition([n-1,1])) ....: return w(Partition([n])) sage: w._precompute_cache(0, toy_to_self_cache, ....: toy_from_self_cache, ....: toy_transition_matrices, ....: toy_inverse_transition_matrices, ....: toy_gen_function) sage: l(toy_to_self_cache) [([], [([], 1)])] sage: w._precompute_cache(1, toy_to_self_cache, ....: toy_from_self_cache, ....: toy_transition_matrices, ....: toy_inverse_transition_matrices, ....: toy_gen_function) sage: l(toy_to_self_cache) [([], [([], 1)]), ([1], [([1], 1)])] sage: w._precompute_cache(2, toy_to_self_cache, ....: toy_from_self_cache, ....: toy_transition_matrices, ....: toy_inverse_transition_matrices, ....: toy_gen_function) sage: l(toy_to_self_cache) [([], [([], 1)]), ([1], [([1], 1)]), ([1, 1], [([1, 1], 1)]), ([2], [([1, 1], 2), ([2], 1)])] sage: toy_transition_matrices[2] [1 2] [0 1] sage: toy_inverse_transition_matrices[2] [ 1 -2] [ 0 1] sage: toy_transition_matrices.keys() [0, 1, 2] """ # Much of this code is adapted from dual.py base_ring = self.base_ring() zero = base_ring(0) from sage.combinat.partition import Partition, Partitions_n # Handle the n == 0 case separately if n == 0: part = Partition([]) to_self_cache[ part ] = { part: base_ring(1) } from_self_cache[ part ] = { part: base_ring(1) } transition_matrices[n] = matrix(base_ring, [[1]]) inverse_transition_matrices[n] = matrix(base_ring, [[1]]) return partitions_n = Partitions_n(n).list() # The other basis will be called B from now on. # This contains the data for the transition matrix from the # basis B to the Witt basis self. transition_matrix_n = matrix(base_ring, len(partitions_n), len(partitions_n)) # This first section calculates how the basis elements of the # basis B are expressed in terms of the Witt basis ``self``. # For every partition p of size n, expand B[p] in terms of # the Witt basis self using multiplicativity and # to_self_gen_function. i = 0 for s_part in partitions_n: # s_mcs will be self(B[s_part])._monomial_coefficients s_mcs = {} # We need to compute the coordinates of B[s_part] in the Witt basis. hsp_in_w_basis = self.one() for p in s_part: hsp_in_w_basis *= to_self_gen_function(p) # Now, hsp_in_w_basis is B[s_part] expanded in the Witt # basis self (this is the same as the coercion self(B[s_part]). j = 0 for p_part in partitions_n: if p_part in hsp_in_w_basis._monomial_coefficients: sp = hsp_in_w_basis._monomial_coefficients[p_part] s_mcs[p_part] = sp transition_matrix_n[i,j] = sp j += 1 to_self_cache[ s_part ] = s_mcs i += 1 # Save the transition matrix transition_matrices[n] = transition_matrix_n # This second section calculates how the basis elements of # self expand in terms of the basis B. We do this by # computing the inverse of the matrix transition_matrix_n # obtained above. # TODO: Possibly this can be sped up by using properties # of this matrix (e. g., it being triangular in most standard cases). # Are there significantly faster ways to invert a triangular # matrix (compared to the usual matrix inversion algorithms)? inverse_transition = ~transition_matrix_n for i in range(len(partitions_n)): d_mcs = {} for j in range(len(partitions_n)): if inverse_transition[i,j] != zero: d_mcs[ partitions_n[j] ] = inverse_transition[i,j] from_self_cache[ partitions_n[i] ] = d_mcs inverse_transition_matrices[n] = inverse_transition