Ticket #15029: trac_15029reviewts.patch
File trac_15029reviewts.patch, 28.2 KB (added by , 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 b This makes it possible to perform many c 18 18 as a formal variable. 19 19 20 20 In order to define similarity class types, recall that similarity classes of 21 `n\times n` matrices with entries in `\ mathbf{F}_q` correspond to functions21 `n\times n` matrices with entries in `\GF{q}` correspond to functions 22 22 23 23 .. MATH:: 24 24 25 c: \mathrm{Irr}\ mathbf{F}_q[t]\to \Lambda25 c: \mathrm{Irr}\GF{q[t]} \to \Lambda 26 26 27 27 such that 28 28 29 29 .. MATH:: 30 30 31 \sum_{f\in \mathrm{Irr}\ mathbf{F}_q[t]} c(f)\deg f = n,31 \sum_{f\in \mathrm{Irr}\GF{q[t]}} c(f)\deg f = n, 32 32 33 where we denote the set of irreducible monic polynomials in `\ mathbf{F}_q[t]`34 by `\mathrm{Irr}\ mathbf{F}_q[t]`, the set of all partitions by `\Lambda`, and33 where we denote the set of irreducible monic polynomials in `\GF{q[t]}` 34 by `\mathrm{Irr}\GF{q[t]}`, the set of all partitions by `\Lambda`, and 35 35 the size of `\lambda \in \Lambda` by `\lambda`. 36 36 37 37 Similarity classes indexed by functions `c_1` and `c_2` as above are said to be 38 38 of the same type if there exists a degreepreserving selfbijection `\sigma` of 39 `\mathrm{Irr}\ mathbf{F}_q[t]` such that `c_2 = c_1\circ \sigma`. Thus, the type39 `\mathrm{Irr}\GF{q[t]}` such that `c_2 = c_1\circ \sigma`. Thus, the type 40 40 of `c` remembers only the degrees of the polynomials (and not the polynomials 41 41 themselves) for which `c` takes a certain value `\lambda`. Replacing each 42 42 irreducible polynomial of degree `d` for which `c` takes a nontrivial value … … respectively. 61 61 For any matrix `A` in a given similarity class type, it is possible to calculate 62 62 the number elements in the similarity class of `A`, the dimension of the algebra 63 63 of matrices in `M_n(A)` that commite with `A`, and the cardinality of the 64 subgroup of `GL_n(\ mathbf{F}_q)` that commute with `A`. For each similarity64 subgroup of `GL_n(\GF{q})` that commute with `A`. For each similarity 65 65 class type, it is also possible to compute the number of classes of that type 66 66 (and hence, the total number of matrices of that type). All these calculations 67 67 treat the cardinality `q` of the finite field as a formal variable:: … … matrices with a given rational canonical 96 96 97 97 Similarity class types can also be used to calculate the number of simultaneous 98 98 similarity classes of `k`tuples of `n\times n` matrices with entries in 99 `\ mathbf{F}_q` by using Burnside's lemma::99 `\GF{q}` by using Burnside's lemma:: 100 100 101 101 sage: from sage.combinat.similarity_class_type import order_of_general_linear_group, centralizer_algebra_dim 102 102 sage: q = ZZ['q'].gen() … … Morrison [Morrison06]_). 112 112 Along with the results of [PSS13]_, similarity class types can be used to 113 113 calculate the number of similarity classes of matrices of order `n` with entries 114 114 in a principal ideal local ring of length two with residue field of cardinality 115 `q` with centralizer of any given cardinality up to `n =4`. Among these, the115 `q` with centralizer of any given cardinality up to `n = 4`. Among these, the 116 116 classes which are selftranspose can also be counted:: 117 117 118 sage: from sage.combinat.similarity_class_type import matrix_centralizer_cardinalities 2119 sage: list(matrix_centralizer_cardinalities 2(3))118 sage: from sage.combinat.similarity_class_type import matrix_centralizer_cardinalities_length_two 119 sage: list(matrix_centralizer_cardinalities_length_two(3)) 120 120 [(q^6  3*q^5 + 3*q^4  q^3, 1/6*q^6  1/2*q^5 + 1/3*q^4), 121 121 (q^6  2*q^5 + q^4, q^5  q^4), 122 122 (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 140 140 141 141 REFERENCES: 142 142 143 .. [Green55] Green, J. A. The characters of the finite general linear groups.143 .. [Green55] Green, J. A. *The characters of the finite general linear groups*. 144 144 Trans. Amer. Math. Soc. 80 (1955), 402447. 145 Available from: http://dx.doi.org/10.1090/S00029947195500728782145 :doi:`10.1090/S00029947195500728782` 146 146 147 .. [Morrison06] Morrison, Kent E. Integer sequences and matrices over finite fields. 147 .. [Morrison06] Morrison, Kent E. 148 *Integer sequences and matrices over finite fields*. 148 149 J. Integer Seq. 9 (2006), no. 2, Article 06.2.1, 28 pp. 149 Available from:https://cs.uwaterloo.ca/journals/JIS/VOL9/Morrison/morrison37.html150 https://cs.uwaterloo.ca/journals/JIS/VOL9/Morrison/morrison37.html 150 151 151 .. [PSS13] Prasad, A., Singla, P., and Spallone, S., Similarity of matrices over152 local rings of length two. arxiv.org:1212.6157152 .. [PSS13] Prasad, A., Singla, P., and Spallone, S., *Similarity of matrices 153 over local rings of length two*. :arxiv:`1212.6157` 153 154 154 155 AUTHOR: 155 156 … … def fq(n, q = None): 222 223 def primitives(n, invertible = False, q = None): 223 224 """ 224 225 Return the number of similarity classes of simple matrices 225 of order nwith entries in a finite field of order ``q``.226 of order ``n`` with entries in a finite field of order ``q``. 226 227 This is the same as the number of irreducible polynomials 227 of degree d.228 of degree `d`. 228 229 229 230 If ``invertible`` is ``True``, then only the number of 230 231 similarity classes of invertible matrices is returned. … … def primitives(n, invertible = False, q 267 268 268 269 @cached_function 269 270 def order_of_general_linear_group(n, q = None): 270 """271 r""" 271 272 Return the cardinality of the group of `n \times n` invertible matrices 272 273 with entries in a field of order ``q``. 273 274 … … def order_of_general_linear_group(n, q = 292 293 @cached_function 293 294 def centralizer_algebra_dim(la): 294 295 r""" 295 Return the dimension of the centralizer algebra in `M_n(\ mathbf{F}_q)`296 Return the dimension of the centralizer algebra in `M_n(\GF{q})` 296 297 of a nilpotent matrix whose Jordan blocks are given by ``la``. 297 298 298 299 EXAMPLES:: … … def centralizer_algebra_dim(la): 310 311 @cached_function 311 312 def centralizer_group_cardinality(la, q = None): 312 313 r""" 313 Return the cardinality of the centralizer group in `GL_n(\ mathbf{F}_q)`314 Return the cardinality of the centralizer group in `GL_n(\GF{q})` 314 315 of a nilpotent matrix whose Jordan blocks are given by ``la``. 315 316 316 317 INPUT: … … class PrimarySimilarityClassType(Element 342 343 For a partition `\lambda` and a positive integer `d`, the primary similarity 343 344 class type `(d, \lambda)` represents similarity classes of square matrices 344 345 of order `\lambda \cdot d` with entries in a finite field of order `q` 345 which correspond to the `\ mathbf{F}_q[t]`module346 which correspond to the `\GF{q[t]}`module 346 347 347 348 .. MATH :: 348 349 349 \frac{\ mathbf{F}_q[t]}{p(t)^{\lambda_1} } \oplus350 \frac{\ mathbf{F}_q[t]}{p(t)^{\lambda_2}} \oplus \dotsb350 \frac{\GF{q[t]}}{p(t)^{\lambda_1} } \oplus 351 \frac{\GF{q[t]}}{p(t)^{\lambda_2}} \oplus \dotsb 351 352 352 353 for some irreducible polynomial `p(t)` of degree `d`. 353 354 """ … … class PrimarySimilarityClassType(Element 364 365 [2, [3, 2, 1]] 365 366 366 367 The parent class is the class of primary similarity class types of order 367 `d \lambda\`::368 `d \lambda`:: 368 369 369 370 sage: PT = PrimarySimilarityClassType(2, [3, 2, 1]) 370 371 sage: PT.parent().size() … … class PrimarySimilarityClassType(Element 477 478 @cached_in_parent_method 478 479 def statistic(self, func, q = None): 479 480 r""" 480 Return `n_ \lambda(q^d)` where `n_\lambda` is the value returned by481 ``func`` upon input ` `\lambda`, if ``self`` is `(d, \lambda)`.481 Return `n_{\lambda}(q^d)` where `n_{\lambda}` is the value returned by 482 ``func`` upon input `\lambda`, if ``self`` is `(d, \lambda)`. 482 483 483 EXAMPLE ::484 EXAMPLES:: 484 485 485 486 sage: PT = PrimarySimilarityClassType(2, [3, 1]) 486 487 sage: q = ZZ['q'].gen() … … class PrimarySimilarityClassType(Element 499 500 500 501 INPUT: 501 502 502 ``q``  an integer or an indeterminate503  ``q``  an integer or an indeterminate 503 504 504 505 EXAMPLES:: 505 506 … … class PrimarySimilarityClassTypes(Parent 525 526 526 527 A primary similarity class type of size `n` is a pair `(\lambda, d)` 527 528 consisting of a partition `\lambda` and a positive integer `d` such that 528 `\lambda d = n`.529 `\lambda d = n`. 529 530 530 531 INPUT: 531 532 532 533  ``n``  a positive integer 533  ``min``  a primary matrix type of size ``n`` .534  ``min``  a primary matrix type of size ``n`` 534 535 535 536 EXAMPLES: 536 537 … … class PrimarySimilarityClassTypes(Parent 645 646 2 646 647 """ 647 648 return self._n 649 648 650 ############################################################################### 649 651 650 652 ############################################################################### 653 651 654 class SimilarityClassType(CombinatorialObject, Element): 652 655 r""" 653 656 A similarity class type. … … class SimilarityClassType(CombinatorialO 677 680 678 681 sage: tau1 = SimilarityClassType([[3, [3, 2, 1]], [2, [2, 1]]]); tau1 679 682 [[2, [2, 1]], [3, [3, 2, 1]]] 680 sage: tau2 = SimilarityClassType([PrimarySimilarityClassType(2, [2, 1]), PrimarySimilarityClassType(3, [3, 2, 1])]) 683 sage: types = [PrimarySimilarityClassType(2, [2, 1]), PrimarySimilarityClassType(3, [3, 2, 1])] 684 sage: tau2 = SimilarityClassType(types) 681 685 sage: tau1 == tau2 682 686 True 683 687 … … class SimilarityClassType(CombinatorialO 737 741 738 742 def centralizer_group_card(self, q = None): 739 743 """ 740 Return the cardinality of the group of matrices in `GL_n(\ mathbf{F}_q)`744 Return the cardinality of the group of matrices in `GL_n(\GF{q})` 741 745 which commute with a matrix of type ``self``. 742 746 743 747 INPUT: … … class SimilarityClassType(CombinatorialO 776 780 """ 777 781 Return the number of similarity classes of matrices of type ``self``. 778 782 779 I MPUT:783 INPUT: 780 784 781 785  ``invertible``  Boolean; return number of invertible classes if set 782 786 to ``True`` … … class SimilarityClassType(CombinatorialO 900 904 return self.class_card(q = q)*self.number_of_classes(invertible = invertible, q = q) 901 905 902 906 def statistic(self, func, q = None): 903 """907 r""" 904 908 Return 905 909 906 910 .. MATH:: 907 911 908 prod_{(d, \lambda)\in \tau} n_\lambda(q^d)912 \prod_{(d, \lambda)\in \tau} n_{\lambda}(q^d) 909 913 910 where `n_ \lambda(q)` is the value returned by ``func`` on the input914 where `n_{\lambda}(q)` is the value returned by ``func`` on the input 911 915 `\lambda`. 912 916 913 917 INPUT: … … class SimilarityClassTypes(Parent, Uniqu 1037 1041 8 1038 1042 1039 1043 A good test of the iterator is to see that all elements of 1040 `M_n(\ mathbf{F}_q)` or `GL_n(\mathbf{F}_q` are enumerated through1044 `M_n(\GF{q})` or `GL_n(\GF{q})` are enumerated through 1041 1045 types:: 1042 1046 1043 1047 sage: from sage.combinat.similarity_class_type import order_of_general_linear_group … … class SimilarityClassTypes(Parent, Uniqu 1066 1070 1067 1071 def size(self): 1068 1072 """ 1069 Return size of ``self`` 1073 Return size of ``self``. 1070 1074 1071 1075 EXAMPLES:: 1072 1076 … … class SimilarityClassTypes(Parent, Uniqu 1077 1081 return self._n 1078 1082 1079 1083 def sum(self, stat, sumover = "matrices", invertible = False, q = None): 1080 """1084 r""" 1081 1085 Return the sum of a local statistic over all types. 1082 1086 1083 Given a set of functions `n_ \lambda(q)` (these could be polynomials or1087 Given a set of functions `n_{\lambda}(q)` (these could be polynomials or 1084 1088 rational functions in `q`, for each similarity class type `\tau` define 1085 1089 1086 1090 .. MATH:: 1087 1091 1088 n_\tau(q) = \prod_{(d,\lambda)\in \tau} n_ \lambda(q^d).1092 n_\tau(q) = \prod_{(d,\lambda)\in \tau} n_{\lambda}(q^d). 1089 1093 1090 1094 This function returns 1091 1095 … … class SimilarityClassTypes(Parent, Uniqu 1093 1097 1094 1098 \sum n_{\tau(g)}(q) 1095 1099 1096 where ` tau(g)` denotes the type of a matrix `g`, and the sum is over1097 all `n \times n` matrices if ``sumover`` is set to "matrices", is over1098 all `n\times n` similarity classes if ``sumover`` is set to "classes",1099 and over all `n\times n` types if ``sumover`` is set to types. If1100 ``invertible`` is set to ``True``, then the sum is only over invertible1101 matrices or classes.1100 where `\tau(g)` denotes the type of a matrix `g`, and the sum is over 1101 all `n \times n` matrices if ``sumover`` is set to ``"matrices"``, is 1102 over all `n \times n` similarity classes if ``sumover`` is set to 1103 ``"classes"``, and over all `n \times n` types if ``sumover`` is set 1104 to ``"types"``. If ``invertible`` is set to ``True``, then the sum is 1105 only over invertible matrices or classes. 1102 1106 1103 1107 INPUT: 1104 1108 1105 1109  ``stat``  a function which takes partitions and returns a function 1106 1110 of ``q`` 1107  ``sumover``  a parameter, either "matrices", "classes" or "types" 1111  ``sumover``  can be one of the following: 1112 1113 * ``"matrices"`` 1114 * ``"classes"`` 1115 * ``"types"`` 1116 1108 1117  ``q``  an integer or an indeterminate 1109 1118 1110 1119 OUTPUT: … … class SimilarityClassTypes(Parent, Uniqu 1146 1155 1147 1156 def dictionary_from_generator(gen): 1148 1157 r""" 1149 Given a generator for a list of pairs `(c,f)` construct a dictionary whose1158 Given a generator for a list of pairs `(c,f)`, construct a dictionary whose 1150 1159 keys are the distinct values for `c` and whose value at `c` is the sum of 1151 1160 `f` over all pairs of the form `(c',f)` such that `c=c'`. 1152 1161 … … def matrix_similarity_classes(n, q = Non 1191 1200 return 1 1192 1201 if invertible: 1193 1202 return sum([q**max(la)*((1q**(1))**map(lambda x: x>0, la.to_exp()).count(True)) for la in Partitions(n)]) 1194 else: 1195 return sum([q**max(la) for la in Partitions(n)]) 1203 return sum([q**max(la) for la in Partitions(n)]) 1196 1204 1197 1205 def matrix_centralizer_cardinalities(n, q = None, invertible = False): 1198 1206 """ … … def matrix_centralizer_cardinalities(n, 1214 1222 (q^2  q, q  1), 1215 1223 (q^4  q^3  q^2 + q, q  1), 1216 1224 (q^2  1, 1/2*q^2  1/2*q)] 1217 1218 1225 """ 1219 1226 for tau in SimilarityClassTypes(n): 1220 1227 yield (tau.centralizer_group_card(q = q), tau.number_of_classes(invertible = invertible, q = q)) 1221 1228 1222 1229 def input_parsing(data): 1223 1230 """ 1224 Recognize and return the intended type of ``input`` 1231 Recognize and return the intended type of ``input``. 1225 1232 1226 1233 TESTS:: 1227 1234 … … def input_parsing(data): 1267 1274 raise ValueError("Expected a Partition, a SimiliarityClassType or a PrimarySimilarityClassType, got a %s"%(type(data))) 1268 1275 return case, data 1269 1276 1270 def ext_orbits(input , q = None, selftranspose = False):1277 def ext_orbits(input_data, q = None, selftranspose = False): 1271 1278 r""" 1272 1279 Return the number of orbits in `\mathrm{Ext}^1(M, M)` for the action of 1273 `\mathrm{Aut}(M, M)`, where `M` is the `\mathbf F_q[t]`module constructed 1274 from ``input``. 1280 `\mathrm{Aut}(M, M)`, where `M` is the `\GF{q[t]}`module constructed 1281 from ``input_data``. 1282 1283 INPUT: 1284 1285  ``input_data``  input for :func:`input_parsing()` 1286  ``q``  (default: `q`) an integer or an indeterminate 1287  ``selftranspose``  (default: ``False``) boolean stating if we only want 1288 selftranspose type 1275 1289 1276 1290 TESTS:: 1277 1291 … … def ext_orbits(input, q = None, selftran 1305 1319 # Prasad, Singla, and Spallone. 1306 1320 if q is None: 1307 1321 q = FractionField(QQ['q']).gen() 1308 case, data = input_parsing(input )1322 case, data = input_parsing(input_data) 1309 1323 if case == 'par': 1310 1324 la = data 1311 1325 if la.size() == 0: … … def ext_orbits(input, q = None, selftran 1327 1341 else: 1328 1342 return q**m*(q**3 + 2*q**2) 1329 1343 elif min(la) == 2 and max(la) == 2: 1330 return matrix_similarity_classes 2(len(la), q = q, selftranspose = selftranspose)1344 return matrix_similarity_classes_length_two(len(la), q = q, selftranspose = selftranspose) 1331 1345 else: 1332 1346 raise ValueError('partition %s not implemented for ExtOrbitClasses.orbits'%(la)) 1333 1347 elif case == 'pri': … … def ext_orbits(input, q = None, selftran 1337 1351 tau = data 1338 1352 return prod([ext_orbits(PT, q = q, selftranspose = selftranspose) for PT in tau]) 1339 1353 1340 def matrix_similarity_classes 2(n, q = None, selftranspose = False, invertible = False):1354 def matrix_similarity_classes_length_two(n, q = None, selftranspose = False, invertible = False): 1341 1355 """ 1342 1356 Return the number of similarity classes of matrices of order ``n`` with 1343 1357 entries in a principal ideal local ring of length two. 1344 1358 1359 INPUT: 1360 1361  ``n``  the order 1362  ``q``  (default: `q`) an integer or an indeterminate 1363  ``selftranspose``  (default: ``False``) boolean stating if we only want 1364 selftranspose type 1365  ``invertible``  (default: ``False``) boolean stating if we only want 1366 invertible type 1367 1345 1368 EXAMPLES: 1346 1369 1347 1370 We can generate Table 6 of [PSS13]_:: 1348 1371 1349 sage: from sage.combinat.similarity_class_type import matrix_similarity_classes 21350 sage: matrix_similarity_classes 2(2)1372 sage: from sage.combinat.similarity_class_type import matrix_similarity_classes_length_two 1373 sage: matrix_similarity_classes_length_two(2) 1351 1374 q^4 + q^3 + q^2 1352 sage: matrix_similarity_classes 2(2, invertible = True)1375 sage: matrix_similarity_classes_length_two(2, invertible = True) 1353 1376 q^4  q 1354 sage: matrix_similarity_classes 2(3)1377 sage: matrix_similarity_classes_length_two(3) 1355 1378 q^6 + q^5 + 2*q^4 + q^3 + 2*q^2 1356 sage: matrix_similarity_classes 2(3, invertible = true)1379 sage: matrix_similarity_classes_length_two(3, invertible = true) 1357 1380 q^6  q^3 + 2*q^2  2*q 1358 sage: matrix_similarity_classes 2(4)1381 sage: matrix_similarity_classes_length_two(4) 1359 1382 q^8 + q^7 + 3*q^6 + 3*q^5 + 5*q^4 + 3*q^3 + 3*q^2 1360 sage: matrix_similarity_classes 2(4, invertible = True)1383 sage: matrix_similarity_classes_length_two(4, invertible = True) 1361 1384 q^8 + q^6  q^5 + 2*q^4  2*q^3 + 2*q^2  3*q 1362 1385 1363 1386 And also Table 7:: 1364 1387 1365 sage: matrix_similarity_classes 2(2, selftranspose = True)1388 sage: matrix_similarity_classes_length_two(2, selftranspose = True) 1366 1389 q^4 + q^3 + q^2 1367 sage: matrix_similarity_classes 2(2, selftranspose = True, invertible = True)1390 sage: matrix_similarity_classes_length_two(2, selftranspose = True, invertible = True) 1368 1391 q^4  q 1369 sage: matrix_similarity_classes 2(3, selftranspose = True)1392 sage: matrix_similarity_classes_length_two(3, selftranspose = True) 1370 1393 q^6 + q^5 + 2*q^4 + q^3 1371 sage: matrix_similarity_classes 2(3, selftranspose = True, invertible = True)1394 sage: matrix_similarity_classes_length_two(3, selftranspose = True, invertible = True) 1372 1395 q^6  q^3 1373 sage: matrix_similarity_classes 2(4, selftranspose = True)1396 sage: matrix_similarity_classes_length_two(4, selftranspose = True) 1374 1397 q^8 + q^7 + 3*q^6 + 3*q^5 + 3*q^4 + q^3 + q^2 1375 sage: matrix_similarity_classes 2(4, selftranspose = True, invertible = True)1398 sage: matrix_similarity_classes_length_two(4, selftranspose = True, invertible = True) 1376 1399 q^8 + q^6  q^5  q 1377 1400 """ 1378 1401 if q is None: 1379 1402 q = FractionField(QQ['q']).gen() 1380 1403 return sum([tau.number_of_classes(invertible = invertible, q = q)*ext_orbits(tau, q = q, selftranspose = selftranspose) for tau in SimilarityClassTypes(n)]) 1381 1404 1382 def ext_orbit_centralizers(input , q = None, selftranspose = False):1405 def ext_orbit_centralizers(input_data, q = None, selftranspose = False): 1383 1406 r""" 1384 1407 Generate pairs consisting of centralizer cardinalities of orbits in 1385 1408 `\mathrm{Ext}^1(M, M)` for the action of `\mathrm{Aut}(M, M)`, where `M` is 1386 the `\mathbf F_q[t]`module constructed from ``input`` and their frequencies. 1409 the `\GF{q[t]}`module constructed from ``input`` and their frequencies. 1410 1411 INPUT: 1412 1413  ``input_data``  input for :func:`input_parsing()` 1414  ``q``  (default: `q`) an integer or an indeterminate 1415  ``selftranspose``  (default: ``False``) boolean stating if we only want 1416 selftranspose type 1387 1417 1388 1418 TESTS:: 1389 1419 1390 1420 sage: from sage.combinat.similarity_class_type import ext_orbit_centralizers 1391 1421 sage: list(ext_orbit_centralizers([6, 1])) 1392 1422 [(q^9  2*q^8 + q^7, q^6), 1393 (q^7  2*q^6 + q^5, q^7  q^6),1394 (q^7  q^6, q^6 + q^5)]1423 (q^7  2*q^6 + q^5, q^7  q^6), 1424 (q^7  q^6, q^6 + q^5)] 1395 1425 sage: list(ext_orbit_centralizers([6, 1], selftranspose = True)) 1396 1426 [(q^9  2*q^8 + q^7, q^6), 1397 (q^7  2*q^6 + q^5, q^7  q^6),1398 (q^7  q^6, q^6  q^5)]1427 (q^7  2*q^6 + q^5, q^7  q^6), 1428 (q^7  q^6, q^6  q^5)] 1399 1429 sage: list(ext_orbit_centralizers([6, 1, 1])) 1400 1430 [(q^12  3*q^11 + 3*q^10  q^9, 1/2*q^7  1/2*q^6), 1401 (q^8  3*q^7 + 3*q^6  q^5, 1/2*q^8  q^7 + 1/2*q^6),1402 (q^12  2*q^11 + q^10, q^6),1403 (q^8  2*q^7 + q^6, q^7  q^6),1404 (q^14  2*q^13 + 2*q^11  q^10, q^6),1405 (q^10  2*q^9 + 2*q^7  q^6, q^7  q^6),1406 (q^12  q^11  q^10 + q^9, 1/2*q^7  1/2*q^6),1407 (q^8  q^7  q^6 + q^5, 1/2*q^8  q^7 + 1/2*q^6),1408 (q^8  2*q^7 + q^6, q^7  q^6),1409 (q^8  q^7, q^6 + 2*q^5),1410 (q^10  2*q^9 + q^8, 2*q^6)]1431 (q^8  3*q^7 + 3*q^6  q^5, 1/2*q^8  q^7 + 1/2*q^6), 1432 (q^12  2*q^11 + q^10, q^6), 1433 (q^8  2*q^7 + q^6, q^7  q^6), 1434 (q^14  2*q^13 + 2*q^11  q^10, q^6), 1435 (q^10  2*q^9 + 2*q^7  q^6, q^7  q^6), 1436 (q^12  q^11  q^10 + q^9, 1/2*q^7  1/2*q^6), 1437 (q^8  q^7  q^6 + q^5, 1/2*q^8  q^7 + 1/2*q^6), 1438 (q^8  2*q^7 + q^6, q^7  q^6), 1439 (q^8  q^7, q^6 + 2*q^5), 1440 (q^10  2*q^9 + q^8, 2*q^6)] 1411 1441 sage: list(ext_orbit_centralizers([6, 1, 1], selftranspose = True)) 1412 1442 [(q^12  3*q^11 + 3*q^10  q^9, 1/2*q^7  1/2*q^6), 1413 (q^8  3*q^7 + 3*q^6  q^5, 1/2*q^8  q^7 + 1/2*q^6),1414 (q^12  2*q^11 + q^10, q^6),1415 (q^8  2*q^7 + q^6, q^7  q^6),1416 (q^14  2*q^13 + 2*q^11  q^10, q^6),1417 (q^10  2*q^9 + 2*q^7  q^6, q^7  q^6),1418 (q^12  q^11  q^10 + q^9, 1/2*q^7  1/2*q^6),1419 (q^8  q^7  q^6 + q^5, 1/2*q^8  q^7 + 1/2*q^6),1420 (q^8  2*q^7 + q^6, q^7  q^6),1421 (q^8  q^7, q^6)]1443 (q^8  3*q^7 + 3*q^6  q^5, 1/2*q^8  q^7 + 1/2*q^6), 1444 (q^12  2*q^11 + q^10, q^6), 1445 (q^8  2*q^7 + q^6, q^7  q^6), 1446 (q^14  2*q^13 + 2*q^11  q^10, q^6), 1447 (q^10  2*q^9 + 2*q^7  q^6, q^7  q^6), 1448 (q^12  q^11  q^10 + q^9, 1/2*q^7  1/2*q^6), 1449 (q^8  q^7  q^6 + q^5, 1/2*q^8  q^7 + 1/2*q^6), 1450 (q^8  2*q^7 + q^6, q^7  q^6), 1451 (q^8  q^7, q^6)] 1422 1452 sage: list(ext_orbit_centralizers([2, [6, 1, 1]], selftranspose = True)) 1423 1453 [(q^24  3*q^22 + 3*q^20  q^18, 1/2*q^14  1/2*q^12), 1424 (q^16  3*q^14 + 3*q^12  q^10, 1/2*q^16  q^14 + 1/2*q^12),1425 (q^24  2*q^22 + q^20, q^12),1426 (q^16  2*q^14 + q^12, q^14  q^12),1427 (q^28  2*q^26 + 2*q^22  q^20, q^12),1428 (q^20  2*q^18 + 2*q^14  q^12, q^14  q^12),1429 (q^24  q^22  q^20 + q^18, 1/2*q^14  1/2*q^12),1430 (q^16  q^14  q^12 + q^10, 1/2*q^16  q^14 + 1/2*q^12),1431 (q^16  2*q^14 + q^12, q^14  q^12),1432 (q^16  q^14, q^12)]1454 (q^16  3*q^14 + 3*q^12  q^10, 1/2*q^16  q^14 + 1/2*q^12), 1455 (q^24  2*q^22 + q^20, q^12), 1456 (q^16  2*q^14 + q^12, q^14  q^12), 1457 (q^28  2*q^26 + 2*q^22  q^20, q^12), 1458 (q^20  2*q^18 + 2*q^14  q^12, q^14  q^12), 1459 (q^24  q^22  q^20 + q^18, 1/2*q^14  1/2*q^12), 1460 (q^16  q^14  q^12 + q^10, 1/2*q^16  q^14 + 1/2*q^12), 1461 (q^16  2*q^14 + q^12, q^14  q^12), 1462 (q^16  q^14, q^12)] 1433 1463 sage: list(ext_orbit_centralizers([[2, [6, 1, 1]]], selftranspose = True)) 1434 1464 [(q^24  3*q^22 + 3*q^20  q^18, 1/2*q^14  1/2*q^12), 1435 (q^16  3*q^14 + 3*q^12  q^10, 1/2*q^16  q^14 + 1/2*q^12), 1436 (q^24  2*q^22 + q^20, q^12), 1437 (q^16  2*q^14 + q^12, q^14  q^12), 1438 (q^28  2*q^26 + 2*q^22  q^20, q^12), 1439 (q^20  2*q^18 + 2*q^14  q^12, q^14  q^12), 1440 (q^24  q^22  q^20 + q^18, 1/2*q^14  1/2*q^12), 1441 (q^16  q^14  q^12 + q^10, 1/2*q^16  q^14 + 1/2*q^12), 1442 (q^16  2*q^14 + q^12, q^14  q^12), 1443 (q^16  q^14, q^12)] 1444 1465 (q^16  3*q^14 + 3*q^12  q^10, 1/2*q^16  q^14 + 1/2*q^12), 1466 (q^24  2*q^22 + q^20, q^12), 1467 (q^16  2*q^14 + q^12, q^14  q^12), 1468 (q^28  2*q^26 + 2*q^22  q^20, q^12), 1469 (q^20  2*q^18 + 2*q^14  q^12, q^14  q^12), 1470 (q^24  q^22  q^20 + q^18, 1/2*q^14  1/2*q^12), 1471 (q^16  q^14  q^12 + q^10, 1/2*q^16  q^14 + 1/2*q^12), 1472 (q^16  2*q^14 + q^12, q^14  q^12), 1473 (q^16  q^14, q^12)] 1445 1474 """ 1446 1475 # Comments cite items in the paper "Similarity over rings of length two" by 1447 1476 # Prasad, Singla, and Spallone. 1448 1477 if q is None: 1449 1478 q = FractionField(QQ['q']).gen() 1450 case, data = input_parsing(input )1479 case, data = input_parsing(input_data) 1451 1480 if case == 'par': 1452 1481 la = data 1453 1482 if len(la) == 0: … … def ext_orbit_centralizers(input, q = No 1482 1511 yield (q**(m + 5)  2*q**(m + 4) + q**(m + 3), 2*q**(m + 1)) # (8.6.6) and (8.6.8) 1483 1512 return 1484 1513 elif max(la) == 2 and min(la) == 2: 1485 for item in matrix_centralizer_cardinalities 2(len(la), q = q, selftranspose = selftranspose):1514 for item in matrix_centralizer_cardinalities_length_two(len(la), q = q, selftranspose = selftranspose): 1486 1515 yield item 1487 1516 else: 1488 1517 raise ValueError('partition %s not implemented for ExtOrbitClasses.orbit_centralizers'%(la)) … … def ext_orbit_centralizers(input, q = No 1498 1527 yield(size, freq) 1499 1528 1500 1529 1501 def matrix_centralizer_cardinalities 2(n, q = None, selftranspose = False, invertible = False):1530 def matrix_centralizer_cardinalities_length_two(n, q = None, selftranspose = False, invertible = False): 1502 1531 r""" 1503 Generate 1532 Generate pairs consisting of centralizer cardinalities of matrices over a 1504 1533 principal ideal local ring of length two with residue field of order ``q`` 1505 1534 and their frequencies. 1506 1535 1536 INPUT: 1537 1538  ``n``  the order 1539  ``q``  (default: `q`) an integer or an indeterminate 1540  ``selftranspose``  (default: ``False``) boolean stating if we only want 1541 selftranspose type 1542  ``invertible``  (default: ``False``) boolean stating if we only want 1543 invertible type 1544 1507 1545 TESTS:: 1508 1546 1509 sage: from sage.combinat.similarity_class_type import matrix_centralizer_cardinalities 21510 sage: list(matrix_centralizer_cardinalities 2(1))1547 sage: from sage.combinat.similarity_class_type import matrix_centralizer_cardinalities_length_two 1548 sage: list(matrix_centralizer_cardinalities_length_two(1)) 1511 1549 [(q^2  q, q^2)] 1512 sage: list(matrix_centralizer_cardinalities 2(2))1550 sage: list(matrix_centralizer_cardinalities_length_two(2)) 1513 1551 [(q^4  2*q^3 + q^2, 1/2*q^4  1/2*q^3), 1514 1552 (q^4  q^3, q^3), 1515 1553 (q^6  2*q^5 + q^4, 1/2*q^3  1/2*q^2), … … def matrix_centralizer_cardinalities2(n, 1518 1556 (q^6  q^4, 1/2*q^3  1/2*q^2), 1519 1557 (q^4  q^2, 1/2*q^4  1/2*q^3)] 1520 1558 sage: from sage.combinat.similarity_class_type import dictionary_from_generator 1521 sage: dictionary_from_generator(matrix_centralizer_cardinalities 2(2, q = 2))1559 sage: dictionary_from_generator(matrix_centralizer_cardinalities_length_two(2, q = 2)) 1522 1560 {96: 4, 32: 4, 4: 4, 16: 2, 8: 8, 12: 4, 48: 2} 1523 1561 """ 1524 1562 if q is None: … … def matrix_centralizer_cardinalities2(n, 1526 1564 for tau in SimilarityClassTypes(n): 1527 1565 for pair in ext_orbit_centralizers(tau, q = q, selftranspose = selftranspose): 1528 1566 yield (q**tau.centralizer_algebra_dim()*pair[0], tau.number_of_classes(invertible = invertible, q = q)*pair[1]) 1567