# Ticket #15029: trac_15029-review-ts.patch

File trac_15029-review-ts.patch, 28.2 KB (added by tscrim, 6 years ago)
• ## sage/combinat/similarity_class_type.py

# HG changeset patch
# User Travis Scrimshaw <tscrim@ucdavis.edur>
# Date 1378742119 25200
# Node ID 6cb97e9372a9951892ecf0a066c4cc2c12ce8935
# Parent 0d3b6cc0a691326fa2166704f891e6268fe4ac1e
#15029: review patch.

diff --git a/sage/combinat/similarity_class_type.py b/sage/combinat/similarity_class_type.py
 a This makes it possible to perform many c as a formal variable. In order to define similarity class types, recall that similarity classes of n\times n matrices with entries in \mathbf{F}_q correspond to functions n\times n matrices with entries in \GF{q} correspond to functions .. MATH:: c: \mathrm{Irr}\mathbf{F}_q[t] \to \Lambda c: \mathrm{Irr}\GF{q[t]} \to \Lambda such that .. MATH:: \sum_{f\in \mathrm{Irr}\mathbf{F}_q[t]} |c(f)|\deg f = n, \sum_{f\in \mathrm{Irr}\GF{q[t]}} |c(f)|\deg f = n, where we denote the set of irreducible monic polynomials in \mathbf{F}_q[t] by \mathrm{Irr}\mathbf{F}_q[t], the set of all partitions by \Lambda, and where we denote the set of irreducible monic polynomials in \GF{q[t]} by \mathrm{Irr}\GF{q[t]}, the set of all partitions by \Lambda, and the size of \lambda \in \Lambda by |\lambda|. Similarity classes indexed by functions c_1 and c_2 as above are said to be of the same type if there exists a degree-preserving self-bijection \sigma of \mathrm{Irr}\mathbf{F}_q[t] such that c_2 = c_1\circ \sigma. Thus, the type \mathrm{Irr}\GF{q[t]} such that c_2 = c_1\circ \sigma. Thus, the type of c remembers only the degrees of the polynomials (and not the polynomials themselves) for which c takes a certain value \lambda. Replacing each irreducible polynomial of degree d for which c takes a non-trivial value respectively. For any matrix A in a given similarity class type, it is possible to calculate the number elements in the similarity class of A, the dimension of the algebra of matrices in M_n(A) that commite  with A, and the cardinality of the subgroup of GL_n(\mathbf{F}_q) that commute with A. For each similarity subgroup of GL_n(\GF{q}) that commute with A. For each similarity class type, it is also possible to compute the number of classes of that type (and hence, the total number of matrices of that type). All these calculations treat the cardinality q of the finite field as a formal variable:: matrices with a given rational canonical Similarity class types can also be used to calculate the number of simultaneous similarity classes of k-tuples of n\times n matrices with entries in \mathbf{F}_q by using Burnside's lemma:: \GF{q} by using Burnside's lemma:: sage: from sage.combinat.similarity_class_type import order_of_general_linear_group, centralizer_algebra_dim sage: q = ZZ['q'].gen() Morrison [Morrison06]_). Along with the results of [PSS13]_, similarity class types can be used to calculate the number of similarity classes of matrices of order n with entries in a principal ideal local ring of length two with residue field of cardinality q with centralizer of any given cardinality up to n=4. Among these, the q with centralizer of any given cardinality up to n = 4. Among these, the classes which are selftranspose can also be counted:: sage: from sage.combinat.similarity_class_type import matrix_centralizer_cardinalities2 sage: list(matrix_centralizer_cardinalities2(3)) sage: from sage.combinat.similarity_class_type import matrix_centralizer_cardinalities_length_two sage: list(matrix_centralizer_cardinalities_length_two(3)) [(q^6 - 3*q^5 + 3*q^4 - q^3, 1/6*q^6 - 1/2*q^5 + 1/3*q^4), (q^6 - 2*q^5 + q^4, q^5 - q^4), (q^8 - 3*q^7 + 3*q^6 - q^5, 1/2*q^5 - q^4 + 1/2*q^3), classes which are selftranspose can also REFERENCES: .. [Green55] Green, J. A.  The characters of the finite general linear groups. .. [Green55] Green, J. A.  *The characters of the finite general linear groups*. Trans. Amer. Math. Soc.  80  (1955), 402--447. Available from: http://dx.doi.org/10.1090/S0002-9947-1955-0072878-2 :doi:10.1090/S0002-9947-1955-0072878-2 .. [Morrison06] Morrison, Kent E. Integer sequences and matrices over finite fields. .. [Morrison06] Morrison, Kent E. *Integer sequences and matrices over finite fields*. J. Integer Seq. 9 (2006), no. 2, Article 06.2.1, 28 pp. Available from: https://cs.uwaterloo.ca/journals/JIS/VOL9/Morrison/morrison37.html https://cs.uwaterloo.ca/journals/JIS/VOL9/Morrison/morrison37.html .. [PSS13] Prasad, A., Singla, P., and Spallone, S., Similarity of matrices over local rings of length two. arxiv.org:1212.6157 .. [PSS13] Prasad, A., Singla, P., and Spallone, S., *Similarity of matrices over local rings of length two*. :arxiv:1212.6157 AUTHOR: def fq(n, q = None): def primitives(n, invertible = False, q = None): """ Return the number of similarity classes of simple matrices of order n with entries in a finite field of order q. of order n with entries in a finite field of order q. This is the same as the number of irreducible polynomials of degree d. of degree d. If invertible is True, then only the number of similarity classes of invertible matrices is returned. def primitives(n, invertible = False, q @cached_function def order_of_general_linear_group(n, q = None): """ r""" Return the cardinality of the group of n \times n invertible matrices with entries in a field of order q. def order_of_general_linear_group(n, q = @cached_function def centralizer_algebra_dim(la): r""" Return the dimension of the centralizer algebra in M_n(\mathbf{F}_q) Return the dimension of the centralizer algebra in M_n(\GF{q}) of a nilpotent matrix whose Jordan blocks are given by la. EXAMPLES:: def centralizer_algebra_dim(la): @cached_function def centralizer_group_cardinality(la, q = None): r""" Return the cardinality of the centralizer group in GL_n(\mathbf{F}_q) Return the cardinality of the centralizer group in GL_n(\GF{q}) of a nilpotent matrix whose Jordan blocks are given by la. INPUT: class PrimarySimilarityClassType(Element For a partition \lambda and a positive integer d, the primary similarity class type (d, \lambda) represents similarity classes of square matrices of order |\lambda| \cdot d with entries in a finite field of order q which correspond to the \mathbf{F}_q[t]-module which correspond to the \GF{q[t]}-module .. MATH :: \frac{\mathbf{F}_q[t]}{p(t)^{\lambda_1} } \oplus \frac{\mathbf{F}_q[t]}{p(t)^{\lambda_2}} \oplus \dotsb \frac{\GF{q[t]}}{p(t)^{\lambda_1} } \oplus \frac{\GF{q[t]}}{p(t)^{\lambda_2}} \oplus \dotsb for some irreducible polynomial p(t) of degree d. """ class PrimarySimilarityClassType(Element [2, [3, 2, 1]] The parent class is the class of primary similarity class types of order d|\lambda\:: d |\lambda|:: sage: PT = PrimarySimilarityClassType(2, [3, 2, 1]) sage: PT.parent().size() class PrimarySimilarityClassType(Element @cached_in_parent_method def statistic(self, func, q = None): r""" Return n_\lambda(q^d) where n_\lambda is the value returned by func upon input \lambda, if self is (d, \lambda). Return n_{\lambda}(q^d) where n_{\lambda} is the value returned by func upon input \lambda, if self is (d, \lambda). EXAMPLE:: EXAMPLES:: sage: PT = PrimarySimilarityClassType(2, [3, 1]) sage: q = ZZ['q'].gen() class PrimarySimilarityClassType(Element INPUT: q -- an integer or an indeterminate - q -- an integer or an indeterminate EXAMPLES:: class PrimarySimilarityClassTypes(Parent A primary similarity class type of size n is a pair (\lambda, d) consisting of a partition \lambda and a positive integer d such that |\lambda|d = n. |\lambda| d = n. INPUT: - n -- a positive integer - min -- a primary matrix type of size n. - min -- a primary matrix type of size n EXAMPLES: class PrimarySimilarityClassTypes(Parent 2 """ return self._n ############################################################################### ############################################################################### class SimilarityClassType(CombinatorialObject, Element): r""" A similarity class type. class SimilarityClassType(CombinatorialO sage: tau1 = SimilarityClassType([[3, [3, 2, 1]], [2, [2, 1]]]); tau1 [[2, [2, 1]], [3, [3, 2, 1]]] sage: tau2 = SimilarityClassType([PrimarySimilarityClassType(2, [2, 1]), PrimarySimilarityClassType(3, [3, 2, 1])]) sage: types = [PrimarySimilarityClassType(2, [2, 1]), PrimarySimilarityClassType(3, [3, 2, 1])] sage: tau2 = SimilarityClassType(types) sage: tau1 == tau2 True class SimilarityClassType(CombinatorialO def centralizer_group_card(self, q = None): """ Return the cardinality of the group of matrices in GL_n(\mathbf{F}_q) Return the cardinality of the group of matrices in GL_n(\GF{q}) which commute with a matrix of type self. INPUT: class SimilarityClassType(CombinatorialO """ Return the number of similarity classes of matrices of type self. IMPUT: INPUT: - invertible -- Boolean; return number of invertible classes if set to True class SimilarityClassType(CombinatorialO return self.class_card(q = q)*self.number_of_classes(invertible = invertible, q = q) def statistic(self, func, q = None): """ r""" Return .. MATH:: prod_{(d, \lambda)\in \tau} n_\lambda(q^d) \prod_{(d, \lambda)\in \tau} n_{\lambda}(q^d) where n_\lambda(q) is the value returned by func on the input where n_{\lambda}(q) is the value returned by func on the input \lambda. INPUT: class SimilarityClassTypes(Parent, Uniqu 8 A good test of the iterator is to see that all elements of M_n(\mathbf{F}_q) or GL_n(\mathbf{F}_q are enumerated through M_n(\GF{q}) or GL_n(\GF{q}) are enumerated through types:: sage: from sage.combinat.similarity_class_type import order_of_general_linear_group class SimilarityClassTypes(Parent, Uniqu def size(self): """ Return size of self Return size of self. EXAMPLES:: class SimilarityClassTypes(Parent, Uniqu return self._n def sum(self, stat, sumover = "matrices", invertible = False, q = None): """ r""" Return the sum of a local statistic over all types. Given a set of functions n_\lambda(q) (these could be polynomials or Given a set of functions n_{\lambda}(q) (these could be polynomials or rational functions in q, for each similarity class type \tau define .. MATH:: n_\tau(q) = \prod_{(d,\lambda)\in \tau} n_\lambda(q^d). n_\tau(q) = \prod_{(d,\lambda)\in \tau} n_{\lambda}(q^d). This function returns class SimilarityClassTypes(Parent, Uniqu \sum n_{\tau(g)}(q) where tau(g) denotes the type of a matrix g, and the sum is over all n\times n matrices if sumover is set to "matrices", is over all n\times n similarity classes if sumover is set to "classes", and over all n\times n types if sumover is set to types. If invertible is set to True, then the sum is only over invertible matrices or classes. where \tau(g) denotes the type of a matrix g, and the sum is over all n \times n matrices if sumover is set to "matrices", is over all n \times n similarity classes if sumover is set to "classes", and over all n \times n types if sumover is set to "types". If invertible is set to True, then the sum is only over invertible matrices or classes. INPUT: - stat -- a function which takes partitions and returns a function of q - sumover -- a parameter, either "matrices", "classes" or "types" - sumover -- can be one of the following: * "matrices" * "classes" * "types" - q -- an integer or an indeterminate OUTPUT: class SimilarityClassTypes(Parent, Uniqu def dictionary_from_generator(gen): r""" Given a generator for a list of pairs (c,f) construct a dictionary whose Given a generator for a list of pairs (c,f), construct a dictionary whose keys are the distinct values for c and whose value at c is the sum of f over all pairs of the form (c',f) such that c=c'. def matrix_similarity_classes(n, q = Non return 1 if invertible: return sum([q**max(la)*((1-q**(-1))**map(lambda x: x>0, la.to_exp()).count(True)) for la in Partitions(n)]) else: return sum([q**max(la) for la in Partitions(n)]) return sum([q**max(la) for la in Partitions(n)]) def matrix_centralizer_cardinalities(n, q = None, invertible = False): """ def matrix_centralizer_cardinalities(n, (q^2 - q, q - 1), (q^4 - q^3 - q^2 + q, q - 1), (q^2 - 1, 1/2*q^2 - 1/2*q)] """ for tau in SimilarityClassTypes(n): yield (tau.centralizer_group_card(q = q), tau.number_of_classes(invertible = invertible, q = q)) def input_parsing(data): """ Recognize and return the intended type of input Recognize and return the intended type of input. TESTS:: def input_parsing(data): raise ValueError("Expected a Partition, a SimiliarityClassType or a PrimarySimilarityClassType, got a %s"%(type(data))) return case, data def ext_orbits(input, q = None, selftranspose = False): def ext_orbits(input_data, q = None, selftranspose = False): r""" Return the number of orbits in \mathrm{Ext}^1(M, M) for the action of \mathrm{Aut}(M, M), where M is the \mathbf F_q[t]-module constructed from input. \mathrm{Aut}(M, M), where M is the \GF{q[t]}-module constructed from input_data. INPUT: - input_data -- input for :func:input_parsing() - q -- (default: q) an integer or an indeterminate - selftranspose -- (default: False) boolean stating if we only want selftranspose type TESTS:: def ext_orbits(input, q = None, selftran # Prasad, Singla, and Spallone. if q is None: q = FractionField(QQ['q']).gen() case, data = input_parsing(input) case, data = input_parsing(input_data) if case == 'par': la = data if la.size() == 0: def ext_orbits(input, q = None, selftran else: return q**m*(q**3 + 2*q**2) elif min(la) == 2 and max(la) == 2: return matrix_similarity_classes2(len(la), q = q, selftranspose = selftranspose) return matrix_similarity_classes_length_two(len(la), q = q, selftranspose = selftranspose) else: raise ValueError('partition %s not implemented for ExtOrbitClasses.orbits'%(la)) elif case == 'pri': def ext_orbits(input, q = None, selftran tau = data return prod([ext_orbits(PT, q = q, selftranspose = selftranspose) for PT in tau]) def matrix_similarity_classes2(n, q = None, selftranspose = False, invertible = False): def matrix_similarity_classes_length_two(n, q = None, selftranspose = False, invertible = False): """ Return the number of similarity classes of matrices of order n with entries in a principal ideal local ring of length two. INPUT: - n -- the order - q -- (default: q) an integer or an indeterminate - selftranspose -- (default: False) boolean stating if we only want selftranspose type - invertible -- (default: False) boolean stating if we only want invertible type EXAMPLES: We can generate Table 6 of [PSS13]_:: sage: from sage.combinat.similarity_class_type import matrix_similarity_classes2 sage: matrix_similarity_classes2(2) sage: from sage.combinat.similarity_class_type import matrix_similarity_classes_length_two sage: matrix_similarity_classes_length_two(2) q^4 + q^3 + q^2 sage: matrix_similarity_classes2(2, invertible = True) sage: matrix_similarity_classes_length_two(2, invertible = True) q^4 - q sage: matrix_similarity_classes2(3) sage: matrix_similarity_classes_length_two(3) q^6 + q^5 + 2*q^4 + q^3 + 2*q^2 sage: matrix_similarity_classes2(3, invertible = true) sage: matrix_similarity_classes_length_two(3, invertible = true) q^6 - q^3 + 2*q^2 - 2*q sage: matrix_similarity_classes2(4) sage: matrix_similarity_classes_length_two(4) q^8 + q^7 + 3*q^6 + 3*q^5 + 5*q^4 + 3*q^3 + 3*q^2 sage: matrix_similarity_classes2(4, invertible = True) sage: matrix_similarity_classes_length_two(4, invertible = True) q^8 + q^6 - q^5 + 2*q^4 - 2*q^3 + 2*q^2 - 3*q And also Table 7:: sage: matrix_similarity_classes2(2, selftranspose = True) sage: matrix_similarity_classes_length_two(2, selftranspose = True) q^4 + q^3 + q^2 sage: matrix_similarity_classes2(2, selftranspose = True, invertible = True) sage: matrix_similarity_classes_length_two(2, selftranspose = True, invertible = True) q^4 - q sage: matrix_similarity_classes2(3, selftranspose = True) sage: matrix_similarity_classes_length_two(3, selftranspose = True) q^6 + q^5 + 2*q^4 + q^3 sage: matrix_similarity_classes2(3, selftranspose = True, invertible = True) sage: matrix_similarity_classes_length_two(3, selftranspose = True, invertible = True) q^6 - q^3 sage: matrix_similarity_classes2(4, selftranspose = True) sage: matrix_similarity_classes_length_two(4, selftranspose = True) q^8 + q^7 + 3*q^6 + 3*q^5 + 3*q^4 + q^3 + q^2 sage: matrix_similarity_classes2(4, selftranspose = True, invertible = True) sage: matrix_similarity_classes_length_two(4, selftranspose = True, invertible = True) q^8 + q^6 - q^5 - q """ if q is None: q = FractionField(QQ['q']).gen() return sum([tau.number_of_classes(invertible = invertible, q = q)*ext_orbits(tau, q = q, selftranspose = selftranspose) for tau in SimilarityClassTypes(n)]) def ext_orbit_centralizers(input, q = None, selftranspose = False): def ext_orbit_centralizers(input_data, q = None, selftranspose = False): r""" Generate pairs consisting of centralizer cardinalities of orbits in \mathrm{Ext}^1(M, M) for the action of \mathrm{Aut}(M, M), where M is the \mathbf F_q[t]-module constructed from input and their frequencies. the \GF{q[t]}-module constructed from input and their frequencies. INPUT: - input_data -- input for :func:input_parsing() - q -- (default: q) an integer or an indeterminate - selftranspose -- (default: False) boolean stating if we only want selftranspose type TESTS:: sage: from sage.combinat.similarity_class_type import ext_orbit_centralizers sage: list(ext_orbit_centralizers([6, 1])) [(q^9 - 2*q^8 + q^7, q^6), (q^7 - 2*q^6 + q^5, q^7 - q^6), (q^7 - q^6, q^6 + q^5)] (q^7 - 2*q^6 + q^5, q^7 - q^6), (q^7 - q^6, q^6 + q^5)] sage: list(ext_orbit_centralizers([6, 1], selftranspose = True)) [(q^9 - 2*q^8 + q^7, q^6), (q^7 - 2*q^6 + q^5, q^7 - q^6), (q^7 - q^6, q^6 - q^5)] (q^7 - 2*q^6 + q^5, q^7 - q^6), (q^7 - q^6, q^6 - q^5)] sage: list(ext_orbit_centralizers([6, 1, 1])) [(q^12 - 3*q^11 + 3*q^10 - q^9, 1/2*q^7 - 1/2*q^6), (q^8 - 3*q^7 + 3*q^6 - q^5, 1/2*q^8 - q^7 + 1/2*q^6), (q^12 - 2*q^11 + q^10, q^6), (q^8 - 2*q^7 + q^6, q^7 - q^6), (q^14 - 2*q^13 + 2*q^11 - q^10, q^6), (q^10 - 2*q^9 + 2*q^7 - q^6, q^7 - q^6), (q^12 - q^11 - q^10 + q^9, 1/2*q^7 - 1/2*q^6), (q^8 - q^7 - q^6 + q^5, 1/2*q^8 - q^7 + 1/2*q^6), (q^8 - 2*q^7 + q^6, q^7 - q^6), (q^8 - q^7, q^6 + 2*q^5), (q^10 - 2*q^9 + q^8, 2*q^6)] (q^8 - 3*q^7 + 3*q^6 - q^5, 1/2*q^8 - q^7 + 1/2*q^6), (q^12 - 2*q^11 + q^10, q^6), (q^8 - 2*q^7 + q^6, q^7 - q^6), (q^14 - 2*q^13 + 2*q^11 - q^10, q^6), (q^10 - 2*q^9 + 2*q^7 - q^6, q^7 - q^6), (q^12 - q^11 - q^10 + q^9, 1/2*q^7 - 1/2*q^6), (q^8 - q^7 - q^6 + q^5, 1/2*q^8 - q^7 + 1/2*q^6), (q^8 - 2*q^7 + q^6, q^7 - q^6), (q^8 - q^7, q^6 + 2*q^5), (q^10 - 2*q^9 + q^8, 2*q^6)] sage: list(ext_orbit_centralizers([6, 1, 1], selftranspose = True)) [(q^12 - 3*q^11 + 3*q^10 - q^9, 1/2*q^7 - 1/2*q^6), (q^8 - 3*q^7 + 3*q^6 - q^5, 1/2*q^8 - q^7 + 1/2*q^6), (q^12 - 2*q^11 + q^10, q^6), (q^8 - 2*q^7 + q^6, q^7 - q^6), (q^14 - 2*q^13 + 2*q^11 - q^10, q^6), (q^10 - 2*q^9 + 2*q^7 - q^6, q^7 - q^6), (q^12 - q^11 - q^10 + q^9, 1/2*q^7 - 1/2*q^6), (q^8 - q^7 - q^6 + q^5, 1/2*q^8 - q^7 + 1/2*q^6), (q^8 - 2*q^7 + q^6, q^7 - q^6), (q^8 - q^7, q^6)] (q^8 - 3*q^7 + 3*q^6 - q^5, 1/2*q^8 - q^7 + 1/2*q^6), (q^12 - 2*q^11 + q^10, q^6), (q^8 - 2*q^7 + q^6, q^7 - q^6), (q^14 - 2*q^13 + 2*q^11 - q^10, q^6), (q^10 - 2*q^9 + 2*q^7 - q^6, q^7 - q^6), (q^12 - q^11 - q^10 + q^9, 1/2*q^7 - 1/2*q^6), (q^8 - q^7 - q^6 + q^5, 1/2*q^8 - q^7 + 1/2*q^6), (q^8 - 2*q^7 + q^6, q^7 - q^6), (q^8 - q^7, q^6)] sage: list(ext_orbit_centralizers([2, [6, 1, 1]], selftranspose = True)) [(q^24 - 3*q^22 + 3*q^20 - q^18, 1/2*q^14 - 1/2*q^12), (q^16 - 3*q^14 + 3*q^12 - q^10, 1/2*q^16 - q^14 + 1/2*q^12), (q^24 - 2*q^22 + q^20, q^12), (q^16 - 2*q^14 + q^12, q^14 - q^12), (q^28 - 2*q^26 + 2*q^22 - q^20, q^12), (q^20 - 2*q^18 + 2*q^14 - q^12, q^14 - q^12), (q^24 - q^22 - q^20 + q^18, 1/2*q^14 - 1/2*q^12), (q^16 - q^14 - q^12 + q^10, 1/2*q^16 - q^14 + 1/2*q^12), (q^16 - 2*q^14 + q^12, q^14 - q^12), (q^16 - q^14, q^12)] (q^16 - 3*q^14 + 3*q^12 - q^10, 1/2*q^16 - q^14 + 1/2*q^12), (q^24 - 2*q^22 + q^20, q^12), (q^16 - 2*q^14 + q^12, q^14 - q^12), (q^28 - 2*q^26 + 2*q^22 - q^20, q^12), (q^20 - 2*q^18 + 2*q^14 - q^12, q^14 - q^12), (q^24 - q^22 - q^20 + q^18, 1/2*q^14 - 1/2*q^12), (q^16 - q^14 - q^12 + q^10, 1/2*q^16 - q^14 + 1/2*q^12), (q^16 - 2*q^14 + q^12, q^14 - q^12), (q^16 - q^14, q^12)] sage: list(ext_orbit_centralizers([[2, [6, 1, 1]]], selftranspose = True)) [(q^24 - 3*q^22 + 3*q^20 - q^18, 1/2*q^14 - 1/2*q^12), (q^16 - 3*q^14 + 3*q^12 - q^10, 1/2*q^16 - q^14 + 1/2*q^12), (q^24 - 2*q^22 + q^20, q^12), (q^16 - 2*q^14 + q^12, q^14 - q^12), (q^28 - 2*q^26 + 2*q^22 - q^20, q^12), (q^20 - 2*q^18 + 2*q^14 - q^12, q^14 - q^12), (q^24 - q^22 - q^20 + q^18, 1/2*q^14 - 1/2*q^12), (q^16 - q^14 - q^12 + q^10, 1/2*q^16 - q^14 + 1/2*q^12), (q^16 - 2*q^14 + q^12, q^14 - q^12), (q^16 - q^14, q^12)] (q^16 - 3*q^14 + 3*q^12 - q^10, 1/2*q^16 - q^14 + 1/2*q^12), (q^24 - 2*q^22 + q^20, q^12), (q^16 - 2*q^14 + q^12, q^14 - q^12), (q^28 - 2*q^26 + 2*q^22 - q^20, q^12), (q^20 - 2*q^18 + 2*q^14 - q^12, q^14 - q^12), (q^24 - q^22 - q^20 + q^18, 1/2*q^14 - 1/2*q^12), (q^16 - q^14 - q^12 + q^10, 1/2*q^16 - q^14 + 1/2*q^12), (q^16 - 2*q^14 + q^12, q^14 - q^12), (q^16 - q^14, q^12)] """ # Comments cite items in the paper "Similarity over rings of length two" by # Prasad, Singla, and Spallone. if q is None: q = FractionField(QQ['q']).gen() case, data = input_parsing(input) case, data = input_parsing(input_data) if case == 'par': la = data if len(la) == 0: def ext_orbit_centralizers(input, q = No yield (q**(m + 5) - 2*q**(m + 4) + q**(m + 3), 2*q**(m + 1)) # (8.6.6) and (8.6.8) return elif max(la) == 2 and min(la) == 2: for item in matrix_centralizer_cardinalities2(len(la), q = q, selftranspose = selftranspose): for item in matrix_centralizer_cardinalities_length_two(len(la), q = q, selftranspose = selftranspose): yield item else: raise ValueError('partition %s not implemented for ExtOrbitClasses.orbit_centralizers'%(la)) def ext_orbit_centralizers(input, q = No yield(size, freq) def matrix_centralizer_cardinalities2(n, q = None, selftranspose = False, invertible = False): def matrix_centralizer_cardinalities_length_two(n, q = None, selftranspose = False, invertible = False): r""" Generate  pairs consisting of centralizer cardinalities of matrices over a Generate pairs consisting of centralizer cardinalities of matrices over a principal ideal local ring of length two with residue field of order q and their frequencies. INPUT: - n -- the order - q -- (default: q) an integer or an indeterminate - selftranspose -- (default: False) boolean stating if we only want selftranspose type - invertible -- (default: False`) boolean stating if we only want invertible type TESTS:: sage: from sage.combinat.similarity_class_type import matrix_centralizer_cardinalities2 sage: list(matrix_centralizer_cardinalities2(1)) sage: from sage.combinat.similarity_class_type import matrix_centralizer_cardinalities_length_two sage: list(matrix_centralizer_cardinalities_length_two(1)) [(q^2 - q, q^2)] sage: list(matrix_centralizer_cardinalities2(2)) sage: list(matrix_centralizer_cardinalities_length_two(2)) [(q^4 - 2*q^3 + q^2, 1/2*q^4 - 1/2*q^3), (q^4 - q^3, q^3), (q^6 - 2*q^5 + q^4, 1/2*q^3 - 1/2*q^2), def matrix_centralizer_cardinalities2(n, (q^6 - q^4, 1/2*q^3 - 1/2*q^2), (q^4 - q^2, 1/2*q^4 - 1/2*q^3)] sage: from sage.combinat.similarity_class_type import dictionary_from_generator sage: dictionary_from_generator(matrix_centralizer_cardinalities2(2, q = 2)) sage: dictionary_from_generator(matrix_centralizer_cardinalities_length_two(2, q = 2)) {96: 4, 32: 4, 4: 4, 16: 2, 8: 8, 12: 4, 48: 2} """ if q is None: def matrix_centralizer_cardinalities2(n, for tau in SimilarityClassTypes(n): for pair in ext_orbit_centralizers(tau, q = q, selftranspose = selftranspose): yield (q**tau.centralizer_algebra_dim()*pair[0], tau.number_of_classes(invertible = invertible, q = q)*pair[1])