passagemath-modules 10.6.31rc3__cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of passagemath-modules might be problematic. Click here for more details.

Files changed (807) hide show
  1. passagemath_modules-10.6.31rc3.dist-info/METADATA +281 -0
  2. passagemath_modules-10.6.31rc3.dist-info/RECORD +807 -0
  3. passagemath_modules-10.6.31rc3.dist-info/WHEEL +6 -0
  4. passagemath_modules-10.6.31rc3.dist-info/top_level.txt +2 -0
  5. passagemath_modules.libs/libgfortran-83c28eba.so.5.0.0 +0 -0
  6. passagemath_modules.libs/libgmp-6e109695.so.10.5.0 +0 -0
  7. passagemath_modules.libs/libgsl-cda90e79.so.28.0.0 +0 -0
  8. passagemath_modules.libs/libmpc-7f678fcf.so.3.3.1 +0 -0
  9. passagemath_modules.libs/libmpfr-82690d50.so.6.2.1 +0 -0
  10. passagemath_modules.libs/libopenblasp-r0-6dcb67f9.3.29.so +0 -0
  11. passagemath_modules.libs/libquadmath-2284e583.so.0.0.0 +0 -0
  12. sage/algebras/all__sagemath_modules.py +20 -0
  13. sage/algebras/catalog.py +148 -0
  14. sage/algebras/clifford_algebra.py +3107 -0
  15. sage/algebras/clifford_algebra_element.cpython-314-x86_64-linux-gnu.so +0 -0
  16. sage/algebras/clifford_algebra_element.pxd +16 -0
  17. sage/algebras/clifford_algebra_element.pyx +997 -0
  18. sage/algebras/commutative_dga.py +4252 -0
  19. sage/algebras/exterior_algebra_groebner.cpython-314-x86_64-linux-gnu.so +0 -0
  20. sage/algebras/exterior_algebra_groebner.pxd +55 -0
  21. sage/algebras/exterior_algebra_groebner.pyx +727 -0
  22. sage/algebras/finite_dimensional_algebras/all.py +2 -0
  23. sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py +1029 -0
  24. sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.cpython-314-x86_64-linux-gnu.so +0 -0
  25. sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pxd +12 -0
  26. sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx +706 -0
  27. sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_ideal.py +196 -0
  28. sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_morphism.py +255 -0
  29. sage/algebras/finite_gca.py +528 -0
  30. sage/algebras/group_algebra.py +232 -0
  31. sage/algebras/lie_algebras/abelian.py +197 -0
  32. sage/algebras/lie_algebras/affine_lie_algebra.py +1213 -0
  33. sage/algebras/lie_algebras/all.py +25 -0
  34. sage/algebras/lie_algebras/all__sagemath_modules.py +1 -0
  35. sage/algebras/lie_algebras/bch.py +177 -0
  36. sage/algebras/lie_algebras/bgg_dual_module.py +1184 -0
  37. sage/algebras/lie_algebras/bgg_resolution.py +232 -0
  38. sage/algebras/lie_algebras/center_uea.py +767 -0
  39. sage/algebras/lie_algebras/classical_lie_algebra.py +2516 -0
  40. sage/algebras/lie_algebras/examples.py +683 -0
  41. sage/algebras/lie_algebras/free_lie_algebra.py +973 -0
  42. sage/algebras/lie_algebras/heisenberg.py +820 -0
  43. sage/algebras/lie_algebras/lie_algebra.py +1562 -0
  44. sage/algebras/lie_algebras/lie_algebra_element.cpython-314-x86_64-linux-gnu.so +0 -0
  45. sage/algebras/lie_algebras/lie_algebra_element.pxd +68 -0
  46. sage/algebras/lie_algebras/lie_algebra_element.pyx +2122 -0
  47. sage/algebras/lie_algebras/morphism.py +661 -0
  48. sage/algebras/lie_algebras/nilpotent_lie_algebra.py +457 -0
  49. sage/algebras/lie_algebras/onsager.py +1324 -0
  50. sage/algebras/lie_algebras/poincare_birkhoff_witt.py +816 -0
  51. sage/algebras/lie_algebras/quotient.py +462 -0
  52. sage/algebras/lie_algebras/rank_two_heisenberg_virasoro.py +355 -0
  53. sage/algebras/lie_algebras/representation.py +1040 -0
  54. sage/algebras/lie_algebras/structure_coefficients.py +459 -0
  55. sage/algebras/lie_algebras/subalgebra.py +967 -0
  56. sage/algebras/lie_algebras/symplectic_derivation.py +289 -0
  57. sage/algebras/lie_algebras/verma_module.py +1630 -0
  58. sage/algebras/lie_algebras/virasoro.py +1186 -0
  59. sage/algebras/octonion_algebra.cpython-314-x86_64-linux-gnu.so +0 -0
  60. sage/algebras/octonion_algebra.pxd +20 -0
  61. sage/algebras/octonion_algebra.pyx +987 -0
  62. sage/algebras/orlik_solomon.py +907 -0
  63. sage/algebras/orlik_terao.py +779 -0
  64. sage/algebras/steenrod/all.py +7 -0
  65. sage/algebras/steenrod/steenrod_algebra.py +4258 -0
  66. sage/algebras/steenrod/steenrod_algebra_bases.py +1179 -0
  67. sage/algebras/steenrod/steenrod_algebra_misc.py +1167 -0
  68. sage/algebras/steenrod/steenrod_algebra_mult.py +954 -0
  69. sage/algebras/weyl_algebra.py +1126 -0
  70. sage/all__sagemath_modules.py +62 -0
  71. sage/calculus/all__sagemath_modules.py +19 -0
  72. sage/calculus/expr.py +205 -0
  73. sage/calculus/integration.cpython-314-x86_64-linux-gnu.so +0 -0
  74. sage/calculus/integration.pyx +698 -0
  75. sage/calculus/interpolation.cpython-314-x86_64-linux-gnu.so +0 -0
  76. sage/calculus/interpolation.pxd +13 -0
  77. sage/calculus/interpolation.pyx +387 -0
  78. sage/calculus/interpolators.cpython-314-x86_64-linux-gnu.so +0 -0
  79. sage/calculus/interpolators.pyx +326 -0
  80. sage/calculus/ode.cpython-314-x86_64-linux-gnu.so +0 -0
  81. sage/calculus/ode.pxd +5 -0
  82. sage/calculus/ode.pyx +610 -0
  83. sage/calculus/riemann.cpython-314-x86_64-linux-gnu.so +0 -0
  84. sage/calculus/riemann.pyx +1521 -0
  85. sage/calculus/test_sympy.py +201 -0
  86. sage/calculus/transforms/all.py +7 -0
  87. sage/calculus/transforms/dft.py +844 -0
  88. sage/calculus/transforms/dwt.cpython-314-x86_64-linux-gnu.so +0 -0
  89. sage/calculus/transforms/dwt.pxd +7 -0
  90. sage/calculus/transforms/dwt.pyx +160 -0
  91. sage/calculus/transforms/fft.cpython-314-x86_64-linux-gnu.so +0 -0
  92. sage/calculus/transforms/fft.pxd +12 -0
  93. sage/calculus/transforms/fft.pyx +487 -0
  94. sage/calculus/wester.py +662 -0
  95. sage/coding/abstract_code.py +1108 -0
  96. sage/coding/ag_code.py +868 -0
  97. sage/coding/ag_code_decoders.cpython-314-x86_64-linux-gnu.so +0 -0
  98. sage/coding/ag_code_decoders.pyx +2639 -0
  99. sage/coding/all.py +15 -0
  100. sage/coding/bch_code.py +494 -0
  101. sage/coding/binary_code.cpython-314-x86_64-linux-gnu.so +0 -0
  102. sage/coding/binary_code.pxd +124 -0
  103. sage/coding/binary_code.pyx +4139 -0
  104. sage/coding/bounds_catalog.py +43 -0
  105. sage/coding/channel.py +819 -0
  106. sage/coding/channels_catalog.py +29 -0
  107. sage/coding/code_bounds.py +755 -0
  108. sage/coding/code_constructions.py +804 -0
  109. sage/coding/codes_catalog.py +111 -0
  110. sage/coding/cyclic_code.py +1329 -0
  111. sage/coding/databases.py +316 -0
  112. sage/coding/decoder.py +373 -0
  113. sage/coding/decoders_catalog.py +88 -0
  114. sage/coding/delsarte_bounds.py +709 -0
  115. sage/coding/encoder.py +390 -0
  116. sage/coding/encoders_catalog.py +64 -0
  117. sage/coding/extended_code.py +468 -0
  118. sage/coding/gabidulin_code.py +1058 -0
  119. sage/coding/golay_code.py +404 -0
  120. sage/coding/goppa_code.py +441 -0
  121. sage/coding/grs_code.py +2371 -0
  122. sage/coding/guava.py +107 -0
  123. sage/coding/guruswami_sudan/all.py +1 -0
  124. sage/coding/guruswami_sudan/gs_decoder.py +897 -0
  125. sage/coding/guruswami_sudan/interpolation.py +409 -0
  126. sage/coding/guruswami_sudan/utils.py +176 -0
  127. sage/coding/hamming_code.py +176 -0
  128. sage/coding/information_set_decoder.py +1032 -0
  129. sage/coding/kasami_codes.cpython-314-x86_64-linux-gnu.so +0 -0
  130. sage/coding/kasami_codes.pyx +351 -0
  131. sage/coding/linear_code.py +3067 -0
  132. sage/coding/linear_code_no_metric.py +1354 -0
  133. sage/coding/linear_rank_metric.py +961 -0
  134. sage/coding/parity_check_code.py +353 -0
  135. sage/coding/punctured_code.py +719 -0
  136. sage/coding/reed_muller_code.py +999 -0
  137. sage/coding/self_dual_codes.py +942 -0
  138. sage/coding/source_coding/all.py +2 -0
  139. sage/coding/source_coding/huffman.py +553 -0
  140. sage/coding/subfield_subcode.py +423 -0
  141. sage/coding/two_weight_db.py +399 -0
  142. sage/combinat/all__sagemath_modules.py +7 -0
  143. sage/combinat/cartesian_product.py +347 -0
  144. sage/combinat/family.py +11 -0
  145. sage/combinat/free_module.py +1977 -0
  146. sage/combinat/root_system/all.py +147 -0
  147. sage/combinat/root_system/ambient_space.py +527 -0
  148. sage/combinat/root_system/associahedron.py +471 -0
  149. sage/combinat/root_system/braid_move_calculator.py +143 -0
  150. sage/combinat/root_system/braid_orbit.cpython-314-x86_64-linux-gnu.so +0 -0
  151. sage/combinat/root_system/braid_orbit.pyx +144 -0
  152. sage/combinat/root_system/branching_rules.py +2301 -0
  153. sage/combinat/root_system/cartan_matrix.py +1245 -0
  154. sage/combinat/root_system/cartan_type.py +3069 -0
  155. sage/combinat/root_system/coxeter_group.py +162 -0
  156. sage/combinat/root_system/coxeter_matrix.py +1261 -0
  157. sage/combinat/root_system/coxeter_type.py +681 -0
  158. sage/combinat/root_system/dynkin_diagram.py +900 -0
  159. sage/combinat/root_system/extended_affine_weyl_group.py +2993 -0
  160. sage/combinat/root_system/fundamental_group.py +795 -0
  161. sage/combinat/root_system/hecke_algebra_representation.py +1203 -0
  162. sage/combinat/root_system/integrable_representations.py +1227 -0
  163. sage/combinat/root_system/non_symmetric_macdonald_polynomials.py +1965 -0
  164. sage/combinat/root_system/pieri_factors.py +1147 -0
  165. sage/combinat/root_system/plot.py +1615 -0
  166. sage/combinat/root_system/root_lattice_realization_algebras.py +1214 -0
  167. sage/combinat/root_system/root_lattice_realizations.py +4628 -0
  168. sage/combinat/root_system/root_space.py +487 -0
  169. sage/combinat/root_system/root_system.py +882 -0
  170. sage/combinat/root_system/type_A.py +348 -0
  171. sage/combinat/root_system/type_A_affine.py +227 -0
  172. sage/combinat/root_system/type_A_infinity.py +241 -0
  173. sage/combinat/root_system/type_B.py +347 -0
  174. sage/combinat/root_system/type_BC_affine.py +287 -0
  175. sage/combinat/root_system/type_B_affine.py +216 -0
  176. sage/combinat/root_system/type_C.py +317 -0
  177. sage/combinat/root_system/type_C_affine.py +188 -0
  178. sage/combinat/root_system/type_D.py +357 -0
  179. sage/combinat/root_system/type_D_affine.py +208 -0
  180. sage/combinat/root_system/type_E.py +641 -0
  181. sage/combinat/root_system/type_E_affine.py +231 -0
  182. sage/combinat/root_system/type_F.py +387 -0
  183. sage/combinat/root_system/type_F_affine.py +137 -0
  184. sage/combinat/root_system/type_G.py +293 -0
  185. sage/combinat/root_system/type_G_affine.py +132 -0
  186. sage/combinat/root_system/type_H.py +105 -0
  187. sage/combinat/root_system/type_I.py +110 -0
  188. sage/combinat/root_system/type_Q.py +150 -0
  189. sage/combinat/root_system/type_affine.py +509 -0
  190. sage/combinat/root_system/type_dual.py +704 -0
  191. sage/combinat/root_system/type_folded.py +301 -0
  192. sage/combinat/root_system/type_marked.py +748 -0
  193. sage/combinat/root_system/type_reducible.py +601 -0
  194. sage/combinat/root_system/type_relabel.py +730 -0
  195. sage/combinat/root_system/type_super_A.py +837 -0
  196. sage/combinat/root_system/weight_lattice_realizations.py +1188 -0
  197. sage/combinat/root_system/weight_space.py +639 -0
  198. sage/combinat/root_system/weyl_characters.py +2238 -0
  199. sage/crypto/__init__.py +4 -0
  200. sage/crypto/all.py +28 -0
  201. sage/crypto/block_cipher/all.py +7 -0
  202. sage/crypto/block_cipher/des.py +1065 -0
  203. sage/crypto/block_cipher/miniaes.py +2171 -0
  204. sage/crypto/block_cipher/present.py +909 -0
  205. sage/crypto/block_cipher/sdes.py +1527 -0
  206. sage/crypto/boolean_function.cpython-314-x86_64-linux-gnu.so +0 -0
  207. sage/crypto/boolean_function.pxd +10 -0
  208. sage/crypto/boolean_function.pyx +1487 -0
  209. sage/crypto/cipher.py +78 -0
  210. sage/crypto/classical.py +3668 -0
  211. sage/crypto/classical_cipher.py +569 -0
  212. sage/crypto/cryptosystem.py +387 -0
  213. sage/crypto/key_exchange/all.py +7 -0
  214. sage/crypto/key_exchange/catalog.py +24 -0
  215. sage/crypto/key_exchange/diffie_hellman.py +323 -0
  216. sage/crypto/key_exchange/key_exchange_scheme.py +107 -0
  217. sage/crypto/lattice.py +312 -0
  218. sage/crypto/lfsr.py +295 -0
  219. sage/crypto/lwe.py +840 -0
  220. sage/crypto/mq/__init__.py +4 -0
  221. sage/crypto/mq/mpolynomialsystemgenerator.py +204 -0
  222. sage/crypto/mq/rijndael_gf.py +2345 -0
  223. sage/crypto/mq/sbox.py +7 -0
  224. sage/crypto/mq/sr.py +3344 -0
  225. sage/crypto/public_key/all.py +5 -0
  226. sage/crypto/public_key/blum_goldwasser.py +776 -0
  227. sage/crypto/sbox.cpython-314-x86_64-linux-gnu.so +0 -0
  228. sage/crypto/sbox.pyx +2090 -0
  229. sage/crypto/sboxes.py +2090 -0
  230. sage/crypto/stream.py +390 -0
  231. sage/crypto/stream_cipher.py +297 -0
  232. sage/crypto/util.py +519 -0
  233. sage/ext/all__sagemath_modules.py +1 -0
  234. sage/ext/interpreters/__init__.py +1 -0
  235. sage/ext/interpreters/all__sagemath_modules.py +2 -0
  236. sage/ext/interpreters/wrapper_cc.cpython-314-x86_64-linux-gnu.so +0 -0
  237. sage/ext/interpreters/wrapper_cc.pxd +30 -0
  238. sage/ext/interpreters/wrapper_cc.pyx +252 -0
  239. sage/ext/interpreters/wrapper_cdf.cpython-314-x86_64-linux-gnu.so +0 -0
  240. sage/ext/interpreters/wrapper_cdf.pxd +26 -0
  241. sage/ext/interpreters/wrapper_cdf.pyx +245 -0
  242. sage/ext/interpreters/wrapper_rdf.cpython-314-x86_64-linux-gnu.so +0 -0
  243. sage/ext/interpreters/wrapper_rdf.pxd +23 -0
  244. sage/ext/interpreters/wrapper_rdf.pyx +221 -0
  245. sage/ext/interpreters/wrapper_rr.cpython-314-x86_64-linux-gnu.so +0 -0
  246. sage/ext/interpreters/wrapper_rr.pxd +28 -0
  247. sage/ext/interpreters/wrapper_rr.pyx +335 -0
  248. sage/geometry/all__sagemath_modules.py +5 -0
  249. sage/geometry/toric_lattice.py +1745 -0
  250. sage/geometry/toric_lattice_element.cpython-314-x86_64-linux-gnu.so +0 -0
  251. sage/geometry/toric_lattice_element.pyx +432 -0
  252. sage/groups/abelian_gps/abelian_group.py +1925 -0
  253. sage/groups/abelian_gps/abelian_group_element.py +164 -0
  254. sage/groups/abelian_gps/all__sagemath_modules.py +5 -0
  255. sage/groups/abelian_gps/dual_abelian_group.py +421 -0
  256. sage/groups/abelian_gps/dual_abelian_group_element.py +179 -0
  257. sage/groups/abelian_gps/element_base.py +341 -0
  258. sage/groups/abelian_gps/values.py +488 -0
  259. sage/groups/additive_abelian/additive_abelian_group.py +476 -0
  260. sage/groups/additive_abelian/additive_abelian_wrapper.py +857 -0
  261. sage/groups/additive_abelian/all.py +4 -0
  262. sage/groups/additive_abelian/qmodnz.py +231 -0
  263. sage/groups/additive_abelian/qmodnz_element.py +349 -0
  264. sage/groups/affine_gps/affine_group.py +535 -0
  265. sage/groups/affine_gps/all.py +1 -0
  266. sage/groups/affine_gps/catalog.py +17 -0
  267. sage/groups/affine_gps/euclidean_group.py +246 -0
  268. sage/groups/affine_gps/group_element.py +562 -0
  269. sage/groups/all__sagemath_modules.py +12 -0
  270. sage/groups/galois_group.py +479 -0
  271. sage/groups/matrix_gps/all.py +4 -0
  272. sage/groups/matrix_gps/all__sagemath_modules.py +13 -0
  273. sage/groups/matrix_gps/catalog.py +26 -0
  274. sage/groups/matrix_gps/coxeter_group.py +927 -0
  275. sage/groups/matrix_gps/finitely_generated.py +487 -0
  276. sage/groups/matrix_gps/group_element.cpython-314-x86_64-linux-gnu.so +0 -0
  277. sage/groups/matrix_gps/group_element.pxd +11 -0
  278. sage/groups/matrix_gps/group_element.pyx +431 -0
  279. sage/groups/matrix_gps/linear.py +440 -0
  280. sage/groups/matrix_gps/matrix_group.py +617 -0
  281. sage/groups/matrix_gps/named_group.py +296 -0
  282. sage/groups/matrix_gps/orthogonal.py +544 -0
  283. sage/groups/matrix_gps/symplectic.py +251 -0
  284. sage/groups/matrix_gps/unitary.py +436 -0
  285. sage/groups/misc_gps/all__sagemath_modules.py +1 -0
  286. sage/groups/misc_gps/argument_groups.py +1905 -0
  287. sage/groups/misc_gps/imaginary_groups.py +479 -0
  288. sage/groups/perm_gps/all__sagemath_modules.py +1 -0
  289. sage/groups/perm_gps/partn_ref/all__sagemath_modules.py +1 -0
  290. sage/groups/perm_gps/partn_ref/refinement_binary.cpython-314-x86_64-linux-gnu.so +0 -0
  291. sage/groups/perm_gps/partn_ref/refinement_binary.pxd +41 -0
  292. sage/groups/perm_gps/partn_ref/refinement_binary.pyx +1167 -0
  293. sage/groups/perm_gps/partn_ref/refinement_matrices.cpython-314-x86_64-linux-gnu.so +0 -0
  294. sage/groups/perm_gps/partn_ref/refinement_matrices.pxd +31 -0
  295. sage/groups/perm_gps/partn_ref/refinement_matrices.pyx +385 -0
  296. sage/homology/algebraic_topological_model.py +595 -0
  297. sage/homology/all.py +2 -0
  298. sage/homology/all__sagemath_modules.py +8 -0
  299. sage/homology/chain_complex.py +2148 -0
  300. sage/homology/chain_complex_homspace.py +165 -0
  301. sage/homology/chain_complex_morphism.py +629 -0
  302. sage/homology/chain_homotopy.py +604 -0
  303. sage/homology/chains.py +653 -0
  304. sage/homology/free_resolution.py +923 -0
  305. sage/homology/graded_resolution.py +567 -0
  306. sage/homology/hochschild_complex.py +756 -0
  307. sage/homology/homology_group.py +188 -0
  308. sage/homology/homology_morphism.py +422 -0
  309. sage/homology/homology_vector_space_with_basis.py +1454 -0
  310. sage/homology/koszul_complex.py +169 -0
  311. sage/homology/matrix_utils.py +205 -0
  312. sage/libs/all__sagemath_modules.py +1 -0
  313. sage/libs/gsl/__init__.py +1 -0
  314. sage/libs/gsl/airy.pxd +56 -0
  315. sage/libs/gsl/all.pxd +66 -0
  316. sage/libs/gsl/array.cpython-314-x86_64-linux-gnu.so +0 -0
  317. sage/libs/gsl/array.pxd +5 -0
  318. sage/libs/gsl/array.pyx +102 -0
  319. sage/libs/gsl/bessel.pxd +208 -0
  320. sage/libs/gsl/blas.pxd +116 -0
  321. sage/libs/gsl/blas_types.pxd +34 -0
  322. sage/libs/gsl/block.pxd +52 -0
  323. sage/libs/gsl/chebyshev.pxd +37 -0
  324. sage/libs/gsl/clausen.pxd +12 -0
  325. sage/libs/gsl/combination.pxd +47 -0
  326. sage/libs/gsl/complex.pxd +151 -0
  327. sage/libs/gsl/coulomb.pxd +30 -0
  328. sage/libs/gsl/coupling.pxd +21 -0
  329. sage/libs/gsl/dawson.pxd +12 -0
  330. sage/libs/gsl/debye.pxd +24 -0
  331. sage/libs/gsl/dilog.pxd +14 -0
  332. sage/libs/gsl/eigen.pxd +46 -0
  333. sage/libs/gsl/elementary.pxd +12 -0
  334. sage/libs/gsl/ellint.pxd +48 -0
  335. sage/libs/gsl/elljac.pxd +8 -0
  336. sage/libs/gsl/erf.pxd +32 -0
  337. sage/libs/gsl/errno.pxd +26 -0
  338. sage/libs/gsl/exp.pxd +44 -0
  339. sage/libs/gsl/expint.pxd +44 -0
  340. sage/libs/gsl/fermi_dirac.pxd +44 -0
  341. sage/libs/gsl/fft.pxd +121 -0
  342. sage/libs/gsl/fit.pxd +50 -0
  343. sage/libs/gsl/gamma.pxd +94 -0
  344. sage/libs/gsl/gegenbauer.pxd +26 -0
  345. sage/libs/gsl/histogram.pxd +176 -0
  346. sage/libs/gsl/hyperg.pxd +52 -0
  347. sage/libs/gsl/integration.pxd +69 -0
  348. sage/libs/gsl/interp.pxd +109 -0
  349. sage/libs/gsl/laguerre.pxd +24 -0
  350. sage/libs/gsl/lambert.pxd +16 -0
  351. sage/libs/gsl/legendre.pxd +90 -0
  352. sage/libs/gsl/linalg.pxd +185 -0
  353. sage/libs/gsl/log.pxd +26 -0
  354. sage/libs/gsl/math.pxd +43 -0
  355. sage/libs/gsl/matrix.pxd +143 -0
  356. sage/libs/gsl/matrix_complex.pxd +130 -0
  357. sage/libs/gsl/min.pxd +67 -0
  358. sage/libs/gsl/monte.pxd +56 -0
  359. sage/libs/gsl/ntuple.pxd +32 -0
  360. sage/libs/gsl/odeiv.pxd +70 -0
  361. sage/libs/gsl/permutation.pxd +78 -0
  362. sage/libs/gsl/poly.pxd +40 -0
  363. sage/libs/gsl/pow_int.pxd +12 -0
  364. sage/libs/gsl/psi.pxd +28 -0
  365. sage/libs/gsl/qrng.pxd +29 -0
  366. sage/libs/gsl/random.pxd +257 -0
  367. sage/libs/gsl/rng.pxd +100 -0
  368. sage/libs/gsl/roots.pxd +72 -0
  369. sage/libs/gsl/sort.pxd +36 -0
  370. sage/libs/gsl/statistics.pxd +59 -0
  371. sage/libs/gsl/sum.pxd +55 -0
  372. sage/libs/gsl/synchrotron.pxd +16 -0
  373. sage/libs/gsl/transport.pxd +24 -0
  374. sage/libs/gsl/trig.pxd +58 -0
  375. sage/libs/gsl/types.pxd +137 -0
  376. sage/libs/gsl/vector.pxd +101 -0
  377. sage/libs/gsl/vector_complex.pxd +83 -0
  378. sage/libs/gsl/wavelet.pxd +49 -0
  379. sage/libs/gsl/zeta.pxd +28 -0
  380. sage/libs/mpc/__init__.pxd +114 -0
  381. sage/libs/mpc/types.pxd +28 -0
  382. sage/libs/mpfr/__init__.pxd +299 -0
  383. sage/libs/mpfr/types.pxd +26 -0
  384. sage/libs/mpmath/__init__.py +1 -0
  385. sage/libs/mpmath/all.py +27 -0
  386. sage/libs/mpmath/all__sagemath_modules.py +1 -0
  387. sage/libs/mpmath/utils.cpython-314-x86_64-linux-gnu.so +0 -0
  388. sage/libs/mpmath/utils.pxd +4 -0
  389. sage/libs/mpmath/utils.pyx +319 -0
  390. sage/matrix/action.cpython-314-x86_64-linux-gnu.so +0 -0
  391. sage/matrix/action.pxd +26 -0
  392. sage/matrix/action.pyx +596 -0
  393. sage/matrix/all.py +9 -0
  394. sage/matrix/args.cpython-314-x86_64-linux-gnu.so +0 -0
  395. sage/matrix/args.pxd +144 -0
  396. sage/matrix/args.pyx +1668 -0
  397. sage/matrix/benchmark.py +1258 -0
  398. sage/matrix/berlekamp_massey.py +95 -0
  399. sage/matrix/compute_J_ideal.py +926 -0
  400. sage/matrix/constructor.cpython-314-x86_64-linux-gnu.so +0 -0
  401. sage/matrix/constructor.pyx +750 -0
  402. sage/matrix/docs.py +430 -0
  403. sage/matrix/echelon_matrix.cpython-314-x86_64-linux-gnu.so +0 -0
  404. sage/matrix/echelon_matrix.pyx +155 -0
  405. sage/matrix/matrix.pxd +2 -0
  406. sage/matrix/matrix0.cpython-314-x86_64-linux-gnu.so +0 -0
  407. sage/matrix/matrix0.pxd +68 -0
  408. sage/matrix/matrix0.pyx +6324 -0
  409. sage/matrix/matrix1.cpython-314-x86_64-linux-gnu.so +0 -0
  410. sage/matrix/matrix1.pxd +8 -0
  411. sage/matrix/matrix1.pyx +2851 -0
  412. sage/matrix/matrix2.cpython-314-x86_64-linux-gnu.so +0 -0
  413. sage/matrix/matrix2.pxd +25 -0
  414. sage/matrix/matrix2.pyx +20181 -0
  415. sage/matrix/matrix_cdv.cpython-314-x86_64-linux-gnu.so +0 -0
  416. sage/matrix/matrix_cdv.pxd +4 -0
  417. sage/matrix/matrix_cdv.pyx +93 -0
  418. sage/matrix/matrix_complex_double_dense.cpython-314-x86_64-linux-gnu.so +0 -0
  419. sage/matrix/matrix_complex_double_dense.pxd +5 -0
  420. sage/matrix/matrix_complex_double_dense.pyx +98 -0
  421. sage/matrix/matrix_dense.cpython-314-x86_64-linux-gnu.so +0 -0
  422. sage/matrix/matrix_dense.pxd +5 -0
  423. sage/matrix/matrix_dense.pyx +343 -0
  424. sage/matrix/matrix_domain_dense.pxd +5 -0
  425. sage/matrix/matrix_domain_sparse.pxd +5 -0
  426. sage/matrix/matrix_double_dense.cpython-314-x86_64-linux-gnu.so +0 -0
  427. sage/matrix/matrix_double_dense.pxd +7 -0
  428. sage/matrix/matrix_double_dense.pyx +3906 -0
  429. sage/matrix/matrix_double_sparse.cpython-314-x86_64-linux-gnu.so +0 -0
  430. sage/matrix/matrix_double_sparse.pxd +6 -0
  431. sage/matrix/matrix_double_sparse.pyx +248 -0
  432. sage/matrix/matrix_generic_dense.cpython-314-x86_64-linux-gnu.so +0 -0
  433. sage/matrix/matrix_generic_dense.pxd +7 -0
  434. sage/matrix/matrix_generic_dense.pyx +354 -0
  435. sage/matrix/matrix_generic_sparse.cpython-314-x86_64-linux-gnu.so +0 -0
  436. sage/matrix/matrix_generic_sparse.pxd +7 -0
  437. sage/matrix/matrix_generic_sparse.pyx +461 -0
  438. sage/matrix/matrix_laurent_mpolynomial_dense.cpython-314-x86_64-linux-gnu.so +0 -0
  439. sage/matrix/matrix_laurent_mpolynomial_dense.pxd +5 -0
  440. sage/matrix/matrix_laurent_mpolynomial_dense.pyx +115 -0
  441. sage/matrix/matrix_misc.py +313 -0
  442. sage/matrix/matrix_numpy_dense.cpython-314-x86_64-linux-gnu.so +0 -0
  443. sage/matrix/matrix_numpy_dense.pxd +14 -0
  444. sage/matrix/matrix_numpy_dense.pyx +450 -0
  445. sage/matrix/matrix_numpy_integer_dense.cpython-314-x86_64-linux-gnu.so +0 -0
  446. sage/matrix/matrix_numpy_integer_dense.pxd +7 -0
  447. sage/matrix/matrix_numpy_integer_dense.pyx +59 -0
  448. sage/matrix/matrix_polynomial_dense.cpython-314-x86_64-linux-gnu.so +0 -0
  449. sage/matrix/matrix_polynomial_dense.pxd +5 -0
  450. sage/matrix/matrix_polynomial_dense.pyx +5341 -0
  451. sage/matrix/matrix_real_double_dense.cpython-314-x86_64-linux-gnu.so +0 -0
  452. sage/matrix/matrix_real_double_dense.pxd +7 -0
  453. sage/matrix/matrix_real_double_dense.pyx +122 -0
  454. sage/matrix/matrix_space.py +2848 -0
  455. sage/matrix/matrix_sparse.cpython-314-x86_64-linux-gnu.so +0 -0
  456. sage/matrix/matrix_sparse.pxd +5 -0
  457. sage/matrix/matrix_sparse.pyx +1222 -0
  458. sage/matrix/matrix_window.cpython-314-x86_64-linux-gnu.so +0 -0
  459. sage/matrix/matrix_window.pxd +37 -0
  460. sage/matrix/matrix_window.pyx +242 -0
  461. sage/matrix/misc_mpfr.cpython-314-x86_64-linux-gnu.so +0 -0
  462. sage/matrix/misc_mpfr.pyx +80 -0
  463. sage/matrix/operation_table.py +1182 -0
  464. sage/matrix/special.py +3666 -0
  465. sage/matrix/strassen.cpython-314-x86_64-linux-gnu.so +0 -0
  466. sage/matrix/strassen.pyx +851 -0
  467. sage/matrix/symplectic_basis.py +541 -0
  468. sage/matrix/template.pxd +6 -0
  469. sage/matrix/tests.py +71 -0
  470. sage/matroids/advanced.py +77 -0
  471. sage/matroids/all.py +13 -0
  472. sage/matroids/basis_exchange_matroid.cpython-314-x86_64-linux-gnu.so +0 -0
  473. sage/matroids/basis_exchange_matroid.pxd +96 -0
  474. sage/matroids/basis_exchange_matroid.pyx +2344 -0
  475. sage/matroids/basis_matroid.cpython-314-x86_64-linux-gnu.so +0 -0
  476. sage/matroids/basis_matroid.pxd +45 -0
  477. sage/matroids/basis_matroid.pyx +1217 -0
  478. sage/matroids/catalog.py +44 -0
  479. sage/matroids/chow_ring.py +473 -0
  480. sage/matroids/chow_ring_ideal.py +849 -0
  481. sage/matroids/circuit_closures_matroid.cpython-314-x86_64-linux-gnu.so +0 -0
  482. sage/matroids/circuit_closures_matroid.pxd +16 -0
  483. sage/matroids/circuit_closures_matroid.pyx +559 -0
  484. sage/matroids/circuits_matroid.cpython-314-x86_64-linux-gnu.so +0 -0
  485. sage/matroids/circuits_matroid.pxd +38 -0
  486. sage/matroids/circuits_matroid.pyx +947 -0
  487. sage/matroids/constructor.py +1086 -0
  488. sage/matroids/database_collections.py +365 -0
  489. sage/matroids/database_matroids.py +5338 -0
  490. sage/matroids/dual_matroid.py +583 -0
  491. sage/matroids/extension.cpython-314-x86_64-linux-gnu.so +0 -0
  492. sage/matroids/extension.pxd +34 -0
  493. sage/matroids/extension.pyx +519 -0
  494. sage/matroids/flats_matroid.cpython-314-x86_64-linux-gnu.so +0 -0
  495. sage/matroids/flats_matroid.pxd +28 -0
  496. sage/matroids/flats_matroid.pyx +715 -0
  497. sage/matroids/gammoid.py +600 -0
  498. sage/matroids/graphic_matroid.cpython-314-x86_64-linux-gnu.so +0 -0
  499. sage/matroids/graphic_matroid.pxd +39 -0
  500. sage/matroids/graphic_matroid.pyx +2024 -0
  501. sage/matroids/lean_matrix.cpython-314-x86_64-linux-gnu.so +0 -0
  502. sage/matroids/lean_matrix.pxd +126 -0
  503. sage/matroids/lean_matrix.pyx +3667 -0
  504. sage/matroids/linear_matroid.cpython-314-x86_64-linux-gnu.so +0 -0
  505. sage/matroids/linear_matroid.pxd +180 -0
  506. sage/matroids/linear_matroid.pyx +6649 -0
  507. sage/matroids/matroid.cpython-314-x86_64-linux-gnu.so +0 -0
  508. sage/matroids/matroid.pxd +243 -0
  509. sage/matroids/matroid.pyx +8759 -0
  510. sage/matroids/matroids_catalog.py +190 -0
  511. sage/matroids/matroids_plot_helpers.py +890 -0
  512. sage/matroids/minor_matroid.py +480 -0
  513. sage/matroids/minorfix.h +9 -0
  514. sage/matroids/named_matroids.py +5 -0
  515. sage/matroids/rank_matroid.py +268 -0
  516. sage/matroids/set_system.cpython-314-x86_64-linux-gnu.so +0 -0
  517. sage/matroids/set_system.pxd +38 -0
  518. sage/matroids/set_system.pyx +800 -0
  519. sage/matroids/transversal_matroid.cpython-314-x86_64-linux-gnu.so +0 -0
  520. sage/matroids/transversal_matroid.pxd +14 -0
  521. sage/matroids/transversal_matroid.pyx +893 -0
  522. sage/matroids/union_matroid.cpython-314-x86_64-linux-gnu.so +0 -0
  523. sage/matroids/union_matroid.pxd +20 -0
  524. sage/matroids/union_matroid.pyx +331 -0
  525. sage/matroids/unpickling.cpython-314-x86_64-linux-gnu.so +0 -0
  526. sage/matroids/unpickling.pyx +843 -0
  527. sage/matroids/utilities.py +809 -0
  528. sage/misc/all__sagemath_modules.py +20 -0
  529. sage/misc/c3.cpython-314-x86_64-linux-gnu.so +0 -0
  530. sage/misc/c3.pyx +238 -0
  531. sage/misc/compat.py +87 -0
  532. sage/misc/element_with_label.py +173 -0
  533. sage/misc/func_persist.py +79 -0
  534. sage/misc/pickle_old.cpython-314-x86_64-linux-gnu.so +0 -0
  535. sage/misc/pickle_old.pyx +19 -0
  536. sage/misc/proof.py +7 -0
  537. sage/misc/replace_dot_all.py +472 -0
  538. sage/misc/sagedoc_conf.py +168 -0
  539. sage/misc/sphinxify.py +167 -0
  540. sage/misc/test_class_pickling.py +85 -0
  541. sage/modules/all.py +42 -0
  542. sage/modules/complex_double_vector.py +25 -0
  543. sage/modules/diamond_cutting.py +380 -0
  544. sage/modules/fg_pid/all.py +1 -0
  545. sage/modules/fg_pid/fgp_element.py +456 -0
  546. sage/modules/fg_pid/fgp_module.py +2091 -0
  547. sage/modules/fg_pid/fgp_morphism.py +550 -0
  548. sage/modules/filtered_vector_space.py +1271 -0
  549. sage/modules/finite_submodule_iter.cpython-314-x86_64-linux-gnu.so +0 -0
  550. sage/modules/finite_submodule_iter.pxd +27 -0
  551. sage/modules/finite_submodule_iter.pyx +452 -0
  552. sage/modules/fp_graded/all.py +1 -0
  553. sage/modules/fp_graded/element.py +346 -0
  554. sage/modules/fp_graded/free_element.py +298 -0
  555. sage/modules/fp_graded/free_homspace.py +53 -0
  556. sage/modules/fp_graded/free_module.py +1060 -0
  557. sage/modules/fp_graded/free_morphism.py +217 -0
  558. sage/modules/fp_graded/homspace.py +563 -0
  559. sage/modules/fp_graded/module.py +1340 -0
  560. sage/modules/fp_graded/morphism.py +1990 -0
  561. sage/modules/fp_graded/steenrod/all.py +1 -0
  562. sage/modules/fp_graded/steenrod/homspace.py +65 -0
  563. sage/modules/fp_graded/steenrod/module.py +477 -0
  564. sage/modules/fp_graded/steenrod/morphism.py +404 -0
  565. sage/modules/fp_graded/steenrod/profile.py +241 -0
  566. sage/modules/free_module.py +8447 -0
  567. sage/modules/free_module_element.cpython-314-x86_64-linux-gnu.so +0 -0
  568. sage/modules/free_module_element.pxd +22 -0
  569. sage/modules/free_module_element.pyx +5445 -0
  570. sage/modules/free_module_homspace.py +369 -0
  571. sage/modules/free_module_integer.py +896 -0
  572. sage/modules/free_module_morphism.py +823 -0
  573. sage/modules/free_module_pseudohomspace.py +352 -0
  574. sage/modules/free_module_pseudomorphism.py +578 -0
  575. sage/modules/free_quadratic_module.py +1706 -0
  576. sage/modules/free_quadratic_module_integer_symmetric.py +1790 -0
  577. sage/modules/matrix_morphism.py +1745 -0
  578. sage/modules/misc.py +103 -0
  579. sage/modules/module_functors.py +192 -0
  580. sage/modules/multi_filtered_vector_space.py +719 -0
  581. sage/modules/ore_module.py +2208 -0
  582. sage/modules/ore_module_element.py +178 -0
  583. sage/modules/ore_module_homspace.py +147 -0
  584. sage/modules/ore_module_morphism.py +968 -0
  585. sage/modules/quotient_module.py +699 -0
  586. sage/modules/real_double_vector.py +22 -0
  587. sage/modules/submodule.py +255 -0
  588. sage/modules/tensor_operations.py +567 -0
  589. sage/modules/torsion_quadratic_module.py +1352 -0
  590. sage/modules/tutorial_free_modules.py +248 -0
  591. sage/modules/vector_complex_double_dense.cpython-314-x86_64-linux-gnu.so +0 -0
  592. sage/modules/vector_complex_double_dense.pxd +6 -0
  593. sage/modules/vector_complex_double_dense.pyx +117 -0
  594. sage/modules/vector_double_dense.cpython-314-x86_64-linux-gnu.so +0 -0
  595. sage/modules/vector_double_dense.pxd +6 -0
  596. sage/modules/vector_double_dense.pyx +604 -0
  597. sage/modules/vector_integer_dense.cpython-314-x86_64-linux-gnu.so +0 -0
  598. sage/modules/vector_integer_dense.pxd +15 -0
  599. sage/modules/vector_integer_dense.pyx +361 -0
  600. sage/modules/vector_integer_sparse.cpython-314-x86_64-linux-gnu.so +0 -0
  601. sage/modules/vector_integer_sparse.pxd +29 -0
  602. sage/modules/vector_integer_sparse.pyx +406 -0
  603. sage/modules/vector_modn_dense.cpython-314-x86_64-linux-gnu.so +0 -0
  604. sage/modules/vector_modn_dense.pxd +12 -0
  605. sage/modules/vector_modn_dense.pyx +394 -0
  606. sage/modules/vector_modn_sparse.cpython-314-x86_64-linux-gnu.so +0 -0
  607. sage/modules/vector_modn_sparse.pxd +21 -0
  608. sage/modules/vector_modn_sparse.pyx +298 -0
  609. sage/modules/vector_numpy_dense.cpython-314-x86_64-linux-gnu.so +0 -0
  610. sage/modules/vector_numpy_dense.pxd +15 -0
  611. sage/modules/vector_numpy_dense.pyx +304 -0
  612. sage/modules/vector_numpy_integer_dense.cpython-314-x86_64-linux-gnu.so +0 -0
  613. sage/modules/vector_numpy_integer_dense.pxd +7 -0
  614. sage/modules/vector_numpy_integer_dense.pyx +54 -0
  615. sage/modules/vector_rational_dense.cpython-314-x86_64-linux-gnu.so +0 -0
  616. sage/modules/vector_rational_dense.pxd +15 -0
  617. sage/modules/vector_rational_dense.pyx +387 -0
  618. sage/modules/vector_rational_sparse.cpython-314-x86_64-linux-gnu.so +0 -0
  619. sage/modules/vector_rational_sparse.pxd +30 -0
  620. sage/modules/vector_rational_sparse.pyx +413 -0
  621. sage/modules/vector_real_double_dense.cpython-314-x86_64-linux-gnu.so +0 -0
  622. sage/modules/vector_real_double_dense.pxd +6 -0
  623. sage/modules/vector_real_double_dense.pyx +126 -0
  624. sage/modules/vector_space_homspace.py +430 -0
  625. sage/modules/vector_space_morphism.py +989 -0
  626. sage/modules/with_basis/all.py +15 -0
  627. sage/modules/with_basis/cell_module.py +494 -0
  628. sage/modules/with_basis/indexed_element.cpython-314-x86_64-linux-gnu.so +0 -0
  629. sage/modules/with_basis/indexed_element.pxd +13 -0
  630. sage/modules/with_basis/indexed_element.pyx +1058 -0
  631. sage/modules/with_basis/invariant.py +1075 -0
  632. sage/modules/with_basis/morphism.py +1636 -0
  633. sage/modules/with_basis/representation.py +2939 -0
  634. sage/modules/with_basis/subquotient.py +685 -0
  635. sage/numerical/all__sagemath_modules.py +6 -0
  636. sage/numerical/gauss_legendre.cpython-314-x86_64-linux-gnu.so +0 -0
  637. sage/numerical/gauss_legendre.pyx +381 -0
  638. sage/numerical/optimize.py +910 -0
  639. sage/probability/all.py +10 -0
  640. sage/probability/probability_distribution.cpython-314-x86_64-linux-gnu.so +0 -0
  641. sage/probability/probability_distribution.pyx +1242 -0
  642. sage/probability/random_variable.py +411 -0
  643. sage/quadratic_forms/all.py +4 -0
  644. sage/quadratic_forms/all__sagemath_modules.py +15 -0
  645. sage/quadratic_forms/binary_qf.py +2042 -0
  646. sage/quadratic_forms/bqf_class_group.py +748 -0
  647. sage/quadratic_forms/constructions.py +93 -0
  648. sage/quadratic_forms/count_local_2.cpython-314-x86_64-linux-gnu.so +0 -0
  649. sage/quadratic_forms/count_local_2.pyx +365 -0
  650. sage/quadratic_forms/extras.py +195 -0
  651. sage/quadratic_forms/quadratic_form.py +1753 -0
  652. sage/quadratic_forms/quadratic_form__count_local_2.py +221 -0
  653. sage/quadratic_forms/quadratic_form__equivalence_testing.py +708 -0
  654. sage/quadratic_forms/quadratic_form__evaluate.cpython-314-x86_64-linux-gnu.so +0 -0
  655. sage/quadratic_forms/quadratic_form__evaluate.pyx +139 -0
  656. sage/quadratic_forms/quadratic_form__local_density_congruence.py +977 -0
  657. sage/quadratic_forms/quadratic_form__local_field_invariants.py +1072 -0
  658. sage/quadratic_forms/quadratic_form__neighbors.py +424 -0
  659. sage/quadratic_forms/quadratic_form__reduction_theory.py +488 -0
  660. sage/quadratic_forms/quadratic_form__split_local_covering.py +416 -0
  661. sage/quadratic_forms/quadratic_form__ternary_Tornaria.py +657 -0
  662. sage/quadratic_forms/quadratic_form__theta.py +352 -0
  663. sage/quadratic_forms/quadratic_form__variable_substitutions.py +370 -0
  664. sage/quadratic_forms/random_quadraticform.py +209 -0
  665. sage/quadratic_forms/ternary.cpython-314-x86_64-linux-gnu.so +0 -0
  666. sage/quadratic_forms/ternary.pyx +1154 -0
  667. sage/quadratic_forms/ternary_qf.py +2027 -0
  668. sage/rings/all__sagemath_modules.py +28 -0
  669. sage/rings/asymptotic/all__sagemath_modules.py +1 -0
  670. sage/rings/asymptotic/misc.py +1252 -0
  671. sage/rings/cc.py +4 -0
  672. sage/rings/cfinite_sequence.py +1306 -0
  673. sage/rings/complex_conversion.cpython-314-x86_64-linux-gnu.so +0 -0
  674. sage/rings/complex_conversion.pxd +8 -0
  675. sage/rings/complex_conversion.pyx +23 -0
  676. sage/rings/complex_double.cpython-314-x86_64-linux-gnu.so +0 -0
  677. sage/rings/complex_double.pxd +21 -0
  678. sage/rings/complex_double.pyx +2654 -0
  679. sage/rings/complex_mpc.cpython-314-x86_64-linux-gnu.so +0 -0
  680. sage/rings/complex_mpc.pxd +21 -0
  681. sage/rings/complex_mpc.pyx +2576 -0
  682. sage/rings/complex_mpfr.cpython-314-x86_64-linux-gnu.so +0 -0
  683. sage/rings/complex_mpfr.pxd +18 -0
  684. sage/rings/complex_mpfr.pyx +3602 -0
  685. sage/rings/derivation.py +2334 -0
  686. sage/rings/finite_rings/all__sagemath_modules.py +1 -0
  687. sage/rings/finite_rings/maps_finite_field.py +191 -0
  688. sage/rings/function_field/all__sagemath_modules.py +8 -0
  689. sage/rings/function_field/derivations.py +102 -0
  690. sage/rings/function_field/derivations_rational.py +132 -0
  691. sage/rings/function_field/differential.py +853 -0
  692. sage/rings/function_field/divisor.py +1107 -0
  693. sage/rings/function_field/drinfeld_modules/action.py +199 -0
  694. sage/rings/function_field/drinfeld_modules/all.py +1 -0
  695. sage/rings/function_field/drinfeld_modules/charzero_drinfeld_module.py +673 -0
  696. sage/rings/function_field/drinfeld_modules/drinfeld_module.py +2087 -0
  697. sage/rings/function_field/drinfeld_modules/finite_drinfeld_module.py +1131 -0
  698. sage/rings/function_field/drinfeld_modules/homset.py +420 -0
  699. sage/rings/function_field/drinfeld_modules/morphism.py +820 -0
  700. sage/rings/function_field/hermite_form_polynomial.cpython-314-x86_64-linux-gnu.so +0 -0
  701. sage/rings/function_field/hermite_form_polynomial.pyx +188 -0
  702. sage/rings/function_field/khuri_makdisi.cpython-314-x86_64-linux-gnu.so +0 -0
  703. sage/rings/function_field/khuri_makdisi.pyx +935 -0
  704. sage/rings/invariants/all.py +4 -0
  705. sage/rings/invariants/invariant_theory.py +4597 -0
  706. sage/rings/invariants/reconstruction.py +395 -0
  707. sage/rings/polynomial/all__sagemath_modules.py +17 -0
  708. sage/rings/polynomial/integer_valued_polynomials.py +1230 -0
  709. sage/rings/polynomial/laurent_polynomial_mpair.cpython-314-x86_64-linux-gnu.so +0 -0
  710. sage/rings/polynomial/laurent_polynomial_mpair.pxd +15 -0
  711. sage/rings/polynomial/laurent_polynomial_mpair.pyx +2023 -0
  712. sage/rings/polynomial/ore_function_element.py +952 -0
  713. sage/rings/polynomial/ore_function_field.py +1028 -0
  714. sage/rings/polynomial/ore_polynomial_element.cpython-314-x86_64-linux-gnu.so +0 -0
  715. sage/rings/polynomial/ore_polynomial_element.pxd +48 -0
  716. sage/rings/polynomial/ore_polynomial_element.pyx +3145 -0
  717. sage/rings/polynomial/ore_polynomial_ring.py +1334 -0
  718. sage/rings/polynomial/polynomial_real_mpfr_dense.cpython-314-x86_64-linux-gnu.so +0 -0
  719. sage/rings/polynomial/polynomial_real_mpfr_dense.pyx +788 -0
  720. sage/rings/polynomial/q_integer_valued_polynomials.py +1264 -0
  721. sage/rings/polynomial/skew_polynomial_element.cpython-314-x86_64-linux-gnu.so +0 -0
  722. sage/rings/polynomial/skew_polynomial_element.pxd +9 -0
  723. sage/rings/polynomial/skew_polynomial_element.pyx +684 -0
  724. sage/rings/polynomial/skew_polynomial_finite_field.cpython-314-x86_64-linux-gnu.so +0 -0
  725. sage/rings/polynomial/skew_polynomial_finite_field.pxd +19 -0
  726. sage/rings/polynomial/skew_polynomial_finite_field.pyx +1093 -0
  727. sage/rings/polynomial/skew_polynomial_finite_order.cpython-314-x86_64-linux-gnu.so +0 -0
  728. sage/rings/polynomial/skew_polynomial_finite_order.pxd +10 -0
  729. sage/rings/polynomial/skew_polynomial_finite_order.pyx +567 -0
  730. sage/rings/polynomial/skew_polynomial_ring.py +908 -0
  731. sage/rings/real_double_element_gsl.cpython-314-x86_64-linux-gnu.so +0 -0
  732. sage/rings/real_double_element_gsl.pxd +8 -0
  733. sage/rings/real_double_element_gsl.pyx +794 -0
  734. sage/rings/real_field.py +58 -0
  735. sage/rings/real_mpfr.cpython-314-x86_64-linux-gnu.so +0 -0
  736. sage/rings/real_mpfr.pxd +29 -0
  737. sage/rings/real_mpfr.pyx +6122 -0
  738. sage/rings/ring_extension.cpython-314-x86_64-linux-gnu.so +0 -0
  739. sage/rings/ring_extension.pxd +42 -0
  740. sage/rings/ring_extension.pyx +2779 -0
  741. sage/rings/ring_extension_conversion.cpython-314-x86_64-linux-gnu.so +0 -0
  742. sage/rings/ring_extension_conversion.pxd +16 -0
  743. sage/rings/ring_extension_conversion.pyx +462 -0
  744. sage/rings/ring_extension_element.cpython-314-x86_64-linux-gnu.so +0 -0
  745. sage/rings/ring_extension_element.pxd +21 -0
  746. sage/rings/ring_extension_element.pyx +1635 -0
  747. sage/rings/ring_extension_homset.py +64 -0
  748. sage/rings/ring_extension_morphism.cpython-314-x86_64-linux-gnu.so +0 -0
  749. sage/rings/ring_extension_morphism.pxd +35 -0
  750. sage/rings/ring_extension_morphism.pyx +920 -0
  751. sage/schemes/all__sagemath_modules.py +1 -0
  752. sage/schemes/projective/all__sagemath_modules.py +1 -0
  753. sage/schemes/projective/coherent_sheaf.py +300 -0
  754. sage/schemes/projective/cohomology.py +510 -0
  755. sage/stats/all.py +15 -0
  756. sage/stats/basic_stats.py +489 -0
  757. sage/stats/distributions/all.py +7 -0
  758. sage/stats/distributions/catalog.py +34 -0
  759. sage/stats/distributions/dgs.h +50 -0
  760. sage/stats/distributions/dgs.pxd +111 -0
  761. sage/stats/distributions/dgs_bern.h +400 -0
  762. sage/stats/distributions/dgs_gauss.h +614 -0
  763. sage/stats/distributions/dgs_misc.h +104 -0
  764. sage/stats/distributions/discrete_gaussian_integer.cpython-314-x86_64-linux-gnu.so +0 -0
  765. sage/stats/distributions/discrete_gaussian_integer.pxd +14 -0
  766. sage/stats/distributions/discrete_gaussian_integer.pyx +498 -0
  767. sage/stats/distributions/discrete_gaussian_lattice.py +908 -0
  768. sage/stats/distributions/discrete_gaussian_polynomial.py +141 -0
  769. sage/stats/hmm/all.py +15 -0
  770. sage/stats/hmm/chmm.cpython-314-x86_64-linux-gnu.so +0 -0
  771. sage/stats/hmm/chmm.pyx +1595 -0
  772. sage/stats/hmm/distributions.cpython-314-x86_64-linux-gnu.so +0 -0
  773. sage/stats/hmm/distributions.pxd +29 -0
  774. sage/stats/hmm/distributions.pyx +531 -0
  775. sage/stats/hmm/hmm.cpython-314-x86_64-linux-gnu.so +0 -0
  776. sage/stats/hmm/hmm.pxd +17 -0
  777. sage/stats/hmm/hmm.pyx +1388 -0
  778. sage/stats/hmm/util.cpython-314-x86_64-linux-gnu.so +0 -0
  779. sage/stats/hmm/util.pxd +7 -0
  780. sage/stats/hmm/util.pyx +165 -0
  781. sage/stats/intlist.cpython-314-x86_64-linux-gnu.so +0 -0
  782. sage/stats/intlist.pxd +14 -0
  783. sage/stats/intlist.pyx +588 -0
  784. sage/stats/r.py +49 -0
  785. sage/stats/time_series.cpython-314-x86_64-linux-gnu.so +0 -0
  786. sage/stats/time_series.pxd +6 -0
  787. sage/stats/time_series.pyx +2546 -0
  788. sage/tensor/all.py +2 -0
  789. sage/tensor/modules/all.py +8 -0
  790. sage/tensor/modules/alternating_contr_tensor.py +761 -0
  791. sage/tensor/modules/comp.py +5598 -0
  792. sage/tensor/modules/ext_pow_free_module.py +824 -0
  793. sage/tensor/modules/finite_rank_free_module.py +3589 -0
  794. sage/tensor/modules/format_utilities.py +333 -0
  795. sage/tensor/modules/free_module_alt_form.py +858 -0
  796. sage/tensor/modules/free_module_automorphism.py +1207 -0
  797. sage/tensor/modules/free_module_basis.py +1074 -0
  798. sage/tensor/modules/free_module_element.py +284 -0
  799. sage/tensor/modules/free_module_homset.py +652 -0
  800. sage/tensor/modules/free_module_linear_group.py +564 -0
  801. sage/tensor/modules/free_module_morphism.py +1581 -0
  802. sage/tensor/modules/free_module_tensor.py +3289 -0
  803. sage/tensor/modules/reflexive_module.py +386 -0
  804. sage/tensor/modules/tensor_free_module.py +780 -0
  805. sage/tensor/modules/tensor_free_submodule.py +538 -0
  806. sage/tensor/modules/tensor_free_submodule_basis.py +140 -0
  807. sage/tensor/modules/tensor_with_indices.py +1043 -0
@@ -0,0 +1,2939 @@
1
+ # sage_setup: distribution = sagemath-modules
2
+ # sage.doctest: needs sage.groups
3
+ """
4
+ Representations of a semigroup
5
+
6
+ AUTHORS:
7
+
8
+ - Travis Scrimshaw (2015-11-21): initial version
9
+ - Siddharth Singh (2020-03-21): signed representation
10
+ - Travis Scrimshaw (2024-02-17): tensor products
11
+ """
12
+
13
+ ##############################################################################
14
+ # Copyright (C) 2015-2024 Travis Scrimshaw <tcscrims at gmail.com>
15
+ #
16
+ # Distributed under the terms of the GNU General Public License (GPL)
17
+ # The full text of the GPL is available at:
18
+ # https://www.gnu.org/licenses/
19
+ ##############################################################################
20
+
21
+ from sage.misc.abstract_method import abstract_method
22
+ from sage.misc.cachefunc import cached_method
23
+ from sage.structure.element import Element
24
+ from sage.combinat.free_module import CombinatorialFreeModule, CombinatorialFreeModule_Tensor
25
+ from sage.categories.modules import Modules
26
+ from sage.matrix.constructor import matrix
27
+ from sage.modules.free_module_element import vector
28
+ from sage.modules.with_basis.subquotient import SubmoduleWithBasis, QuotientModuleWithBasis
29
+
30
+
31
+ class Representation_abstract:
32
+ """
33
+ Abstract base class for representations of semigroups.
34
+
35
+ INPUT:
36
+
37
+ - ``semigroup`` -- a semigroup
38
+ - ``side`` -- (default: ``'left'``) whether this is a
39
+ ``'left'`` or ``'right'`` representation
40
+ - ``algebra`` -- (default: ``semigroup.algebra(self.base_ring())``)
41
+ the semigroup algebra
42
+
43
+ .. NOTE::
44
+
45
+ This class should come before :class:`CombinatorialFreeModule` in the
46
+ MRO in order for tensor products to use the correct class.
47
+ """
48
+ def __init__(self, semigroup, side, algebra=None):
49
+ """
50
+ Initialize ``self``.
51
+
52
+ EXAMPLES::
53
+
54
+ sage: G = FreeGroup(3)
55
+ sage: T = G.trivial_representation()
56
+ sage: TestSuite(T).run()
57
+
58
+ Verify that the dynamic mixin classes work::
59
+
60
+ sage: SGA = SymmetricGroupAlgebra(QQ, 3)
61
+ sage: S21 = SGA.specht_module([2,1])
62
+ sage: T = tensor([S21, S21])
63
+ sage: s21 = S21.frobenius_image()
64
+ sage: T.frobenius_image() == s21.kronecker_product(s21)
65
+ True
66
+ """
67
+ self._semigroup = semigroup
68
+ if algebra is None:
69
+ algebra = semigroup.algebra(self.base_ring())
70
+ self._semigroup_algebra = algebra
71
+ self._side = side
72
+ if side not in ["left", "right", "twosided"]:
73
+ raise ValueError("the side must be either 'left', 'right', or 'twosided'")
74
+ self._left_repr = bool(side == "left" or side == "twosided")
75
+ self._right_repr = bool(side == "right" or side == "twosided")
76
+
77
+ if hasattr(self._semigroup_algebra, "_representation_mixin_class"):
78
+ mixin = self._semigroup_algebra._representation_mixin_class
79
+ # No need to do anything if it is already in the MRO
80
+ if mixin not in self.__class__.__mro__:
81
+ from sage.structure.dynamic_class import dynamic_class
82
+ cat = self.category()
83
+ # perhaps the category has not been initialized yet
84
+ if not isinstance(self, cat.parent_class):
85
+ self.__class__ = dynamic_class(f"{type(self).__name__}_with_mixin",
86
+ (type(self), mixin),
87
+ doccls=type(self))
88
+ else:
89
+ base = self.__class__.__base__ # strip off the category dynamic class
90
+ # recreate the dynamic class with adding the mixin
91
+ self.__class__ = dynamic_class(f"{base.__name__}_with_category",
92
+ (base, mixin, cat.parent_class),
93
+ doccls=base)
94
+
95
+ def semigroup(self):
96
+ """
97
+ Return the semigroup whose representation ``self`` is.
98
+
99
+ EXAMPLES::
100
+
101
+ sage: G = SymmetricGroup(4)
102
+ sage: M = CombinatorialFreeModule(QQ, ['v'])
103
+ sage: on_basis = lambda g,m: M.term(m, g.sign())
104
+ sage: R = G.representation(M, on_basis)
105
+ sage: R.semigroup()
106
+ Symmetric group of order 4! as a permutation group
107
+ """
108
+ return self._semigroup
109
+
110
+ def semigroup_algebra(self):
111
+ """
112
+ Return the semigroup algebra whose representation ``self`` is.
113
+
114
+ EXAMPLES::
115
+
116
+ sage: G = SymmetricGroup(4)
117
+ sage: M = CombinatorialFreeModule(QQ, ['v'])
118
+ sage: on_basis = lambda g,m: M.term(m, g.sign())
119
+ sage: R = G.representation(M, on_basis)
120
+ sage: R.semigroup_algebra()
121
+ Symmetric group algebra of order 4 over Rational Field
122
+ """
123
+ return self._semigroup_algebra
124
+
125
+ def side(self):
126
+ """
127
+ Return whether ``self`` is a left, right, or two-sided representation.
128
+
129
+ OUTPUT: the string ``'left'``, ``'right'``, or ``'twosided'``
130
+
131
+ EXAMPLES::
132
+
133
+ sage: G = groups.permutation.Dihedral(4)
134
+ sage: R = G.regular_representation()
135
+ sage: R.side()
136
+ 'left'
137
+ sage: S = G.regular_representation(side='right')
138
+ sage: S.side()
139
+ 'right'
140
+ sage: R = G.sign_representation()
141
+ sage: R.side()
142
+ 'twosided'
143
+ sage: R = G.trivial_representation()
144
+ sage: R.side()
145
+ 'twosided'
146
+ """
147
+ return self._side
148
+
149
+ def invariant_module(self, S=None, **kwargs):
150
+ r"""
151
+ Return the submodule of ``self`` invariant under the action of ``S``.
152
+
153
+ For a semigroup `S` acting on a module `M`, the invariant
154
+ submodule is given by
155
+
156
+ .. MATH::
157
+
158
+ M^S = \{m \in M : s \cdot m = m \forall s \in S\}.
159
+
160
+ INPUT:
161
+
162
+ - ``S`` -- a finitely-generated semigroup (default: the semigroup
163
+ this is a representation of)
164
+ - ``action`` -- a function (default: :obj:`operator.mul`)
165
+ - ``side`` -- ``'left'`` or ``'right'`` (default: :meth:`side()`);
166
+ which side of ``self`` the elements of ``S`` acts
167
+
168
+ .. NOTE::
169
+
170
+ Two sided actions are considered as left actions for the
171
+ invariant module.
172
+
173
+ OUTPUT: :class:`~sage.modules.with_basis.invariant.FiniteDimensionalInvariantModule`
174
+
175
+ EXAMPLES::
176
+
177
+ sage: S3 = SymmetricGroup(3)
178
+ sage: M = S3.regular_representation()
179
+ sage: I = M.invariant_module()
180
+ sage: [I.lift(b) for b in I.basis()]
181
+ [() + (2,3) + (1,2) + (1,2,3) + (1,3,2) + (1,3)]
182
+
183
+ We build the `D_4`-invariant representation inside of the regular
184
+ representation of `S_4`::
185
+
186
+ sage: D4 = groups.permutation.Dihedral(4)
187
+ sage: S4 = SymmetricGroup(4)
188
+ sage: R = S4.regular_representation()
189
+ sage: I = R.invariant_module(D4)
190
+ sage: [I.lift(b) for b in I.basis()]
191
+ [() + (2,4) + (1,2)(3,4) + (1,2,3,4) + (1,3) + (1,3)(2,4) + (1,4,3,2) + (1,4)(2,3),
192
+ (3,4) + (2,3,4) + (1,2) + (1,2,4) + (1,3,2) + (1,3,2,4) + (1,4,3) + (1,4,2,3),
193
+ (2,3) + (2,4,3) + (1,2,3) + (1,2,4,3) + (1,3,4,2) + (1,3,4) + (1,4,2) + (1,4)]
194
+ """
195
+ if S is None:
196
+ S = self.semigroup()
197
+ side = kwargs.pop('side', self.side())
198
+ if side == "twosided":
199
+ side = "left"
200
+
201
+ return super().invariant_module(S, side=side, **kwargs)
202
+
203
+ def twisted_invariant_module(self, chi, G=None, **kwargs):
204
+ r"""
205
+ Create the isotypic component of the action of ``G`` on
206
+ ``self`` with irreducible character given by ``chi``.
207
+
208
+ .. SEEALSO::
209
+
210
+ - :class:`~sage.modules.with_basis.invariant.FiniteDimensionalTwistedInvariantModule`
211
+
212
+ INPUT:
213
+
214
+ - ``chi`` -- list/tuple of character values or an instance
215
+ of :class:`~sage.groups.class_function.ClassFunction_gap`
216
+ - ``G`` -- a finitely-generated semigroup (default: the semigroup
217
+ this is a representation of)
218
+
219
+ This also accepts the first argument to be the group.
220
+
221
+ OUTPUT: :class:`~sage.modules.with_basis.invariant.FiniteDimensionalTwistedInvariantModule`
222
+
223
+ EXAMPLES::
224
+
225
+ sage: G = SymmetricGroup(3)
226
+ sage: R = G.regular_representation(QQ)
227
+ sage: T = R.twisted_invariant_module([2,0,-1])
228
+ sage: T.basis()
229
+ Finite family {0: B[0], 1: B[1], 2: B[2], 3: B[3]}
230
+ sage: [T.lift(b) for b in T.basis()]
231
+ [() - (1,2,3), -(1,2,3) + (1,3,2), (2,3) - (1,2), -(1,2) + (1,3)]
232
+
233
+ We check the different inputs work::
234
+
235
+ sage: R.twisted_invariant_module([2,0,-1], G) is T
236
+ True
237
+ sage: R.twisted_invariant_module(G, [2,0,-1]) is T
238
+ True
239
+ """
240
+ from sage.categories.groups import Groups
241
+ if G is None:
242
+ G = self.semigroup()
243
+ elif chi in Groups():
244
+ G, chi = chi, G
245
+ side = kwargs.pop('side', self.side())
246
+ if side == "twosided":
247
+ side = "left"
248
+
249
+ return super().twisted_invariant_module(G, chi, side=side, **kwargs)
250
+
251
+ def representation_matrix(self, g, side=None, sparse=False):
252
+ r"""
253
+ Return the matrix representation of ``g`` acting on ``self``.
254
+
255
+ EXAMPLES::
256
+
257
+ sage: S3 = SymmetricGroup(3)
258
+ sage: g = S3.an_element(); g
259
+ (2,3)
260
+ sage: L = S3.regular_representation(side='left')
261
+ sage: R = S3.regular_representation(side='right')
262
+ sage: R.representation_matrix(g)
263
+ [0 0 0 1 0 0]
264
+ [0 0 0 0 0 1]
265
+ [0 0 0 0 1 0]
266
+ [1 0 0 0 0 0]
267
+ [0 0 1 0 0 0]
268
+ [0 1 0 0 0 0]
269
+ sage: L.representation_matrix(g)
270
+ [0 0 0 1 0 0]
271
+ [0 0 0 0 1 0]
272
+ [0 0 0 0 0 1]
273
+ [1 0 0 0 0 0]
274
+ [0 1 0 0 0 0]
275
+ [0 0 1 0 0 0]
276
+ sage: A = S3.algebra(ZZ)
277
+ sage: R.representation_matrix(sum(A.basis()), side='right')
278
+ [1 1 1 1 1 1]
279
+ [1 1 1 1 1 1]
280
+ [1 1 1 1 1 1]
281
+ [1 1 1 1 1 1]
282
+ [1 1 1 1 1 1]
283
+ [1 1 1 1 1 1]
284
+
285
+ We verify tensor products agree::
286
+
287
+ sage: T = tensor([L, R])
288
+ sage: for g in S3:
289
+ ....: gL = L.representation_matrix(g, side='left')
290
+ ....: gR = R.representation_matrix(g, side='left')
291
+ ....: gT = T.representation_matrix(g, side='left')
292
+ ....: assert gL.tensor_product(gR) == gT
293
+
294
+ Some examples with Specht modules::
295
+
296
+ sage: SM = Partition([3,1,1]).specht_module(QQ)
297
+ sage: SM.representation_matrix(Permutation([2,1,3,5,4]))
298
+ [-1 0 1 0 1 0]
299
+ [ 0 0 0 -1 -1 -1]
300
+ [ 0 0 0 0 1 0]
301
+ [ 0 -1 -1 0 0 1]
302
+ [ 0 0 1 0 0 0]
303
+ [ 0 0 0 0 0 -1]
304
+
305
+ sage: SGA = SymmetricGroupAlgebra(QQ, 5)
306
+ sage: SM = SGA.specht_module([(0,0), (0,1), (0,2), (1,0), (2,0)])
307
+ sage: SM.representation_matrix(Permutation([2,1,3,5,4]))
308
+ [-1 0 0 0 0 0]
309
+ [ 0 0 1 0 0 0]
310
+ [ 0 1 0 0 0 0]
311
+ [ 1 0 -1 0 -1 0]
312
+ [-1 -1 0 -1 0 0]
313
+ [ 0 1 1 0 0 -1]
314
+ sage: SM.representation_matrix(SGA([3,1,5,2,4]))
315
+ [ 0 0 0 0 1 0]
316
+ [-1 0 0 0 0 0]
317
+ [ 0 0 0 -1 0 0]
318
+ [ 1 0 -1 0 -1 0]
319
+ [ 0 0 0 1 1 1]
320
+ [-1 -1 0 -1 0 0]
321
+
322
+ sage: SGA = SymmetricGroupAlgebra(QQ, 4)
323
+ sage: SM = SGA.specht_module([3, 1])
324
+ sage: all(SM.representation_matrix(g) * b.to_vector() == (g * b).to_vector()
325
+ ....: for b in SM.basis() for g in SGA.group())
326
+ True
327
+
328
+ sage: SGA = SymmetricGroupAlgebra(QQ, SymmetricGroup(4))
329
+ sage: SM = SGA.specht_module([3, 1])
330
+ sage: all(SM.representation_matrix(g) * b.to_vector() == (g * b).to_vector()
331
+ ....: for b in SM.basis() for g in SGA.group())
332
+ True
333
+ """
334
+ if self.dimension() == float('inf'):
335
+ raise NotImplementedError("only implemented for finite dimensional modules")
336
+
337
+ B = self.basis()
338
+ order = self.get_order()
339
+ inv_order = {b: i for i, b in enumerate(order)}
340
+ ret = matrix.zero(self.base_ring(), len(order), sparse=sparse)
341
+ if side is None:
342
+ if self._side == "twosided":
343
+ side = "left"
344
+ else:
345
+ side = self._side
346
+ use_left = side == "left"
347
+ for i, k in enumerate(order):
348
+ if use_left:
349
+ temp = g * B[k]
350
+ else:
351
+ temp = B[k] * g
352
+ for m, c in temp.monomial_coefficients(copy=False).items():
353
+ if not use_left:
354
+ ret[i, inv_order[m]] = c
355
+ else:
356
+ ret[inv_order[m], i] = c
357
+ return ret
358
+
359
+ @cached_method
360
+ def character(self):
361
+ r"""
362
+ Return the character of ``self``.
363
+
364
+ EXAMPLES::
365
+
366
+ sage: SGA = SymmetricGroupAlgebra(QQ, 5)
367
+ sage: SM = SGA.specht_module([3,2])
368
+ sage: SM.character()
369
+ (5, 1, 1, -1, 1, -1, 0)
370
+ sage: matrix(SGA.specht_module(la).character() for la in Partitions(5))
371
+ [ 1 1 1 1 1 1 1]
372
+ [ 4 2 0 1 -1 0 -1]
373
+ [ 5 1 1 -1 1 -1 0]
374
+ [ 6 0 -2 0 0 0 1]
375
+ [ 5 -1 1 -1 -1 1 0]
376
+ [ 4 -2 0 1 1 0 -1]
377
+ [ 1 -1 1 1 -1 -1 1]
378
+
379
+ sage: SGA = SymmetricGroupAlgebra(QQ, SymmetricGroup(5))
380
+ sage: SM = SGA.specht_module([3,2])
381
+ sage: SM.character()
382
+ Character of Symmetric group of order 5! as a permutation group
383
+ sage: SM.character().values()
384
+ [5, 1, 1, -1, 1, -1, 0]
385
+ sage: matrix(SGA.specht_module(la).character().values() for la in reversed(Partitions(5)))
386
+ [ 1 -1 1 1 -1 -1 1]
387
+ [ 4 -2 0 1 1 0 -1]
388
+ [ 5 -1 1 -1 -1 1 0]
389
+ [ 6 0 -2 0 0 0 1]
390
+ [ 5 1 1 -1 1 -1 0]
391
+ [ 4 2 0 1 -1 0 -1]
392
+ [ 1 1 1 1 1 1 1]
393
+ sage: SGA.group().character_table()
394
+ [ 1 -1 1 1 -1 -1 1]
395
+ [ 4 -2 0 1 1 0 -1]
396
+ [ 5 -1 1 -1 -1 1 0]
397
+ [ 6 0 -2 0 0 0 1]
398
+ [ 5 1 1 -1 1 -1 0]
399
+ [ 4 2 0 1 -1 0 -1]
400
+ [ 1 1 1 1 1 1 1]
401
+ """
402
+ G = self._semigroup
403
+ B = self.basis()
404
+ chi = [sum((g * B[k])[k] for k in B.keys())
405
+ for g in G.conjugacy_classes_representatives()]
406
+ try:
407
+ return G.character(chi)
408
+ except AttributeError:
409
+ return vector(chi, immutable=True)
410
+
411
+ @cached_method
412
+ def brauer_character(self):
413
+ r"""
414
+ Return the Brauer character of ``self``.
415
+
416
+ EXAMPLES::
417
+
418
+ sage: SGA = SymmetricGroupAlgebra(GF(2), 5)
419
+ sage: SM = SGA.specht_module([3, 2])
420
+ sage: SM.brauer_character()
421
+ (5, -1, 0)
422
+ sage: SM.simple_module().brauer_character()
423
+ (4, -2, -1)
424
+
425
+ sage: T = SM.subrepresentation([])
426
+ sage: T.brauer_character()
427
+ (0, 0, 0)
428
+
429
+ sage: W = CoxeterGroup(['D', 4], implementation='permutation')
430
+ sage: R = W.reflection_representation(GF(2))
431
+ sage: R.brauer_character()
432
+ (4, 1)
433
+ sage: T = R.subrepresentation([])
434
+ sage: T.brauer_character()
435
+ (0, 0)
436
+ """
437
+ G = self._semigroup
438
+ p = self.base_ring().characteristic()
439
+
440
+ if self.dimension() == 0:
441
+ from sage.rings.rational_field import QQ
442
+ ccrep = [g for g in G.conjugacy_classes_representatives()
443
+ if not p.divides(g.order())]
444
+ return vector(QQ, [QQ.zero()] * len(ccrep))
445
+
446
+ from sage.rings.number_field.number_field import CyclotomicField
447
+ chi = []
448
+ for g in G.conjugacy_classes_representatives():
449
+ if p.divides(g.order()):
450
+ # ignore the non-p-regular elements
451
+ continue
452
+ evals = self.representation_matrix(g).eigenvalues()
453
+ K = evals[0].parent()
454
+ val = 0
455
+ orders = {la: la.multiplicative_order() for la in evals if la != K.one()}
456
+ zetas = {o: CyclotomicField(o).gen() for o in orders.values()}
457
+ prims = {o: K.zeta(o) for o in orders.values()}
458
+ for la in evals:
459
+ if la == K.one():
460
+ val += 1
461
+ continue
462
+ o = la.multiplicative_order()
463
+ zeta = zetas[o]
464
+ prim = prims[o]
465
+ for deg in range(o):
466
+ if prim ** deg == la:
467
+ val += zeta ** deg
468
+ break
469
+ chi.append(val)
470
+
471
+ return vector(chi, immutable=True)
472
+
473
+ def exterior_power(self, degree=None):
474
+ r"""
475
+ Return the exterior power of ``self``.
476
+
477
+ INPUT:
478
+
479
+ - ``degree`` -- (optional) if given, then only consider the
480
+ given degree
481
+
482
+ EXAMPLES::
483
+
484
+ sage: DC3 = groups.permutation.DiCyclic(3)
485
+ sage: L = DC3.regular_representation(QQ, side='left')
486
+ sage: E5 = L.exterior_power(5)
487
+ sage: E5
488
+ Exterior power representation of Left Regular Representation of
489
+ Dicyclic group of order 12 as a permutation group over Rational Field
490
+ in degree 5
491
+ sage: L.exterior_power()
492
+ Exterior algebra representation of Left Regular Representation of
493
+ Dicyclic group of order 12 as a permutation group over Rational Field
494
+ """
495
+ if degree is None or degree == 0:
496
+ return Representation_ExteriorAlgebra(self, degree)
497
+ return Representation_Exterior(self, degree)
498
+
499
+ def symmetric_power(self, degree=None):
500
+ r"""
501
+ Return the symmetric power of ``self`` in degree ``degree``.
502
+
503
+ EXAMPLES::
504
+
505
+ sage: W = CoxeterGroup(['H', 3])
506
+ sage: R = W.reflection_representation()
507
+ sage: S3R = R.symmetric_power(3)
508
+ sage: S3R
509
+ Symmetric power representation of Reflection representation of
510
+ Finite Coxeter group over ... with Coxeter matrix:
511
+ [1 3 2]
512
+ [3 1 5]
513
+ [2 5 1] in degree 3
514
+ """
515
+ return Representation_Symmetric(self, degree)
516
+
517
+ def schur_functor(self, la):
518
+ r"""
519
+ Return the :class:`Schur functor
520
+ <sage.modules.with_basis.representation.SchurFunctorRepresentation>`
521
+ with shape ``la`` applied to ``self``.
522
+
523
+ EXAMPLES::
524
+
525
+ sage: W = CoxeterGroup(['H', 3])
526
+ sage: R = W.reflection_representation()
527
+ sage: S111 = R.schur_functor([1,1,1])
528
+ sage: S111.dimension()
529
+ 1
530
+ sage: S3 = R.schur_functor([3])
531
+ sage: S3.dimension()
532
+ 10
533
+ """
534
+ return SchurFunctorRepresentation(self, la)
535
+
536
+ @abstract_method(optional=True)
537
+ def _semigroup_action(self, g, vec, vec_on_left):
538
+ """
539
+ Return the action of the semigroup element ``g`` on the
540
+ vector ``vec`` of ``self``.
541
+
542
+ If this is not defined, the representation element must
543
+ override ``_acted_upon_``.
544
+
545
+ EXAMPLES::
546
+
547
+ sage: DC3 = groups.permutation.DiCyclic(3)
548
+ sage: T = DC3.trivial_representation()
549
+ sage: T._semigroup_action(DC3.an_element(), T.basis()['v'], True)
550
+ B['v']
551
+ """
552
+
553
+ @cached_method
554
+ def is_irreducible(self) -> bool:
555
+ r"""
556
+ Return if ``self`` is an irreducible module or not.
557
+
558
+ A representation `M` is *irreducible* (also known as simple)
559
+ if the only subrepresentations of `M` are the trivial module
560
+ `\{0\}` and `M` itself.
561
+
562
+ EXAMPLES::
563
+
564
+ sage: DC3 = groups.permutation.DiCyclic(3)
565
+ sage: L = DC3.regular_representation(GF(3), side='left')
566
+ sage: L.is_irreducible()
567
+ False
568
+ sage: E3 = L.exterior_power(3)
569
+ sage: E3.is_irreducible()
570
+ False
571
+ sage: E12 = L.exterior_power(12)
572
+ sage: E12.is_irreducible()
573
+ True
574
+
575
+ sage: SGA = SymmetricGroupAlgebra(GF(2), 5)
576
+ sage: SGA.specht_module([3, 2]).is_irreducible()
577
+ False
578
+ sage: SGA.specht_module([4, 1]).is_irreducible()
579
+ True
580
+ """
581
+ return bool(self.find_subrepresentation() is None)
582
+
583
+ def find_subrepresentation(self):
584
+ r"""
585
+ Return a nontrivial (not ``self`` or the trivial module) submodule
586
+ of ``self`` or ``None`` if ``self`` is irreducible.
587
+
588
+ EXAMPLES::
589
+
590
+ sage: SGA = SymmetricGroupAlgebra(GF(2), 5)
591
+ sage: SM = SGA.specht_module([3, 2])
592
+ sage: U = SM.find_subrepresentation()
593
+ sage: [SM(b) for b in U.basis()]
594
+ [S[[1, 2, 3], [4, 5]] + S[[1, 2, 4], [3, 5]]
595
+ + S[[1, 2, 5], [3, 4]] + S[[1, 3, 4], [2, 5]]]
596
+ sage: B = U.basis()[0].lift()
597
+ sage: all(g * B == B for g in SGA.gens())
598
+ True
599
+ sage: SGA.specht_module([4, 1]).find_subrepresentation() is None
600
+ True
601
+ sage: SGA.specht_module([5]).find_subrepresentation() is None
602
+ True
603
+ """
604
+ if self.dimension() <= 1: # trivially irreducible
605
+ return None
606
+
607
+ if not self.is_finite():
608
+ raise NotImplementedError("only implemented for finite modules")
609
+
610
+ if self._semigroup.cardinality() < 2:
611
+ return self.subrepresentation([next(iter(self.basis()))], is_closed=True)
612
+
613
+ R = self.base_ring()
614
+ gens = [self.representation_matrix(g) for g in self._semigroup.gens()]
615
+ try:
616
+ # add the identity to the generators (if it exists)
617
+ gens.append(self.representation_matrix(self._semigroup.one()))
618
+ except (AttributeError, NotImplementedError, TypeError, ValueError):
619
+ pass
620
+ gens_transpose = tuple([g.transpose() for g in gens])
621
+ amb_dim = self.dimension()
622
+
623
+ def check_submodule(xi, G):
624
+ N = xi.right_kernel_matrix()
625
+ SM = N[:1]
626
+ dim = 0
627
+ while dim < SM.nrows() < amb_dim:
628
+ dim = SM.nrows()
629
+ added = matrix([g * vec for g in G for vec in SM.rows()])
630
+ SM = SM.stack(added)
631
+ SM.echelonize()
632
+ SM = SM[:SM.rank()]
633
+ if SM.nrows() < amb_dim:
634
+ return SM
635
+ return None
636
+
637
+ def generate_elements():
638
+ cur = sum(R.random_element() * g for g in gens)
639
+ while True:
640
+ if cur.is_zero():
641
+ cur = sum(R.random_element() * g for g in gens)
642
+ yield cur
643
+ cur *= sum(R.random_element() * g for g in gens)
644
+
645
+ for theta in generate_elements():
646
+ chi = theta.charpoly()
647
+ factors = sorted(chi.factor(), key=lambda c: c[0].degree())
648
+ for f, _ in factors:
649
+ xi = f(theta)
650
+ if not xi.is_singular(): # no nullspaces
651
+ continue
652
+ SM = check_submodule(xi, gens)
653
+ if SM is not None:
654
+ return self.subrepresentation([self.from_vector(v) for v in SM.rows()],
655
+ is_closed=True)
656
+ SM = check_submodule(xi.transpose(), gens_transpose)
657
+ if SM is not None:
658
+ # We instead want the submodule given by the orthogonal complement
659
+ return self.subrepresentation([self.from_vector(v) for v in SM.right_kernel_matrix().rows()],
660
+ is_closed=True)
661
+ if xi.right_kernel_matrix().nrows() == f.degree(): # good factor
662
+ return None # irreducible
663
+
664
+ def subrepresentation(self, gens, check=True, already_echelonized=False,
665
+ *args, is_closed=False, **opts):
666
+ """
667
+ Construct a subrepresentation of ``self`` generated by ``gens``.
668
+
669
+ INPUT:
670
+
671
+ - ``gens`` -- the generators of the submodule
672
+ - ``check`` -- ignored
673
+ - ``already_echelonized`` -- (default: ``False``) whether
674
+ the elements of ``gens`` are already in (not necessarily
675
+ reduced) echelon form
676
+ - ``is_closed`` -- (keyword only; default: ``False``) whether ``gens``
677
+ already spans the subspace closed under the semigroup action
678
+
679
+ EXAMPLES::
680
+
681
+ sage: SGA = SymmetricGroupAlgebra(GF(2), 5)
682
+ sage: SM = SGA.specht_module([3, 2])
683
+ sage: B = next(iter(SM.basis()))
684
+ sage: U = SM.subrepresentation([B])
685
+ sage: U.dimension()
686
+ 5
687
+ """
688
+ if not is_closed and gens:
689
+ repr_mats = [self.representation_matrix(g)
690
+ for g in self._semigroup.gens()]
691
+ amb_dim = self.dimension()
692
+ SM = matrix([v._vector_() for v in gens])
693
+ SM.echelonize()
694
+ SM = SM[:SM.rank()]
695
+ dim = 0
696
+ while dim < SM.nrows() < amb_dim:
697
+ dim = SM.nrows()
698
+ added = matrix([g * vec for g in repr_mats for vec in SM.rows()])
699
+ SM = SM.stack(added)
700
+ SM.echelonize()
701
+ SM = SM[:SM.rank()]
702
+ gens = [self.from_vector(v) for v in SM.rows()]
703
+ # it might not be echelonized w.r.t. the module's basis ordering
704
+ already_echelonized = False
705
+ return self.submodule(gens, *args, submodule_class=Subrepresentation, check=check,
706
+ already_echelonized=already_echelonized, **opts)
707
+
708
+ def quotient_representation(self, subrepr, already_echelonized=False, **kwds):
709
+ r"""
710
+ Construct a quotient representation of ``self`` by ``subrepr``.
711
+
712
+ EXAMPLES::
713
+
714
+ sage: SGA = SymmetricGroupAlgebra(GF(2), 5)
715
+ sage: SM = SGA.specht_module([3, 2])
716
+ sage: v = sum(list(SM.basis())[1:])
717
+ sage: Q = SM.quotient_representation([v]); Q
718
+ Quotient representation with basis {[[1, 3, 5], [2, 4]],
719
+ [[1, 3, 4], [2, 5]], [[1, 2, 4], [3, 5]], [[1, 2, 3], [4, 5]]}
720
+ of Specht module of [3, 2] over Finite Field of size 2
721
+ sage: Q.is_irreducible()
722
+ True
723
+ """
724
+ if not isinstance(subrepr, Subrepresentation):
725
+ subrepr = self.subrepresentation(subrepr, unitriangular=True,
726
+ already_echelonized=already_echelonized)
727
+ return QuotientRepresentation(subrepr, **kwds)
728
+
729
+ @cached_method
730
+ def _composition_series_data(self):
731
+ r"""
732
+ Return a composition series and the simple quotients (i.e.,
733
+ the composition factors) of ``self``.
734
+
735
+ EXAMPLES:
736
+
737
+ The algorithm used here uses random elements, so we set the seed
738
+ for testing purposes::
739
+
740
+ sage: set_random_seed(0)
741
+ sage: G = groups.permutation.Cyclic(6)
742
+ sage: R = G.regular_representation(GF(3))
743
+ sage: CS, CF = R._composition_series_data()
744
+ sage: [[R(b) for b in F.basis()] for F in CS]
745
+ [[(),
746
+ (1,2,3,4,5,6),
747
+ (1,3,5)(2,4,6),
748
+ (1,4)(2,5)(3,6),
749
+ (1,5,3)(2,6,4),
750
+ (1,6,5,4,3,2)],
751
+ [() + 2*(1,6,5,4,3,2),
752
+ (1,2,3,4,5,6) + 2*(1,6,5,4,3,2),
753
+ (1,3,5)(2,4,6) + 2*(1,6,5,4,3,2),
754
+ (1,4)(2,5)(3,6) + 2*(1,6,5,4,3,2),
755
+ (1,5,3)(2,6,4) + 2*(1,6,5,4,3,2)],
756
+ [() + (1,5,3)(2,6,4) + (1,6,5,4,3,2),
757
+ (1,2,3,4,5,6) + 2*(1,5,3)(2,6,4),
758
+ (1,3,5)(2,4,6) + 2*(1,6,5,4,3,2),
759
+ (1,4)(2,5)(3,6) + (1,5,3)(2,6,4) + (1,6,5,4,3,2)],
760
+ [() + 2*(1,4)(2,5)(3,6),
761
+ (1,2,3,4,5,6) + 2*(1,5,3)(2,6,4),
762
+ (1,3,5)(2,4,6) + 2*(1,6,5,4,3,2)],
763
+ [() + 2*(1,3,5)(2,4,6) + 2*(1,4)(2,5)(3,6) + (1,6,5,4,3,2),
764
+ (1,2,3,4,5,6) + (1,3,5)(2,4,6) + 2*(1,5,3)(2,6,4) + 2*(1,6,5,4,3,2)],
765
+ [() + 2*(1,2,3,4,5,6) + (1,3,5)(2,4,6) + 2*(1,4)(2,5)(3,6)
766
+ + (1,5,3)(2,6,4) + 2*(1,6,5,4,3,2)],
767
+ []]
768
+ sage: [F.dimension() for F in CF]
769
+ [1, 1, 1, 1, 1, 1]
770
+ """
771
+ from sage.data_structures.blas_dict import linear_combination
772
+ series = [self]
773
+ cur = 0
774
+ # The natural condition is ``while cur < len(series)``. However, the
775
+ # loop will always terminate from the break statement. So we skip
776
+ # this test for speed.
777
+ while True:
778
+ V = series[cur]
779
+ if cur == len(series) - 1:
780
+ W = V.find_subrepresentation()
781
+ if W is None: # V is irreducible
782
+ break
783
+ # Construct W as a subrepresentation of ``self`` for consistency
784
+ Wp = self.subrepresentation([self(b) for b in W._basis],
785
+ already_echelonized=True, is_closed=True)
786
+ series.append(Wp)
787
+ else:
788
+ W = V.subrepresentation([V.retract(b) for b in series[cur+1]._basis],
789
+ already_echelonized=True, is_closed=True)
790
+
791
+ Q = V.quotient_representation(W)
792
+ S = Q.find_subrepresentation()
793
+ while S is not None: # found a nontrivial subrepresentation
794
+ # Lift S -> Q -> V -> self
795
+ # S_basis = [b.lift().lift().lift() for b in S.basis()]
796
+ # Fast version not creating transient elements
797
+ if V is self:
798
+ S_basis = [self.element_class(self, b._monomial_coefficients) for b in S._basis]
799
+ else:
800
+ S_basis = [self.element_class(self, linear_combination((V._basis[i]._monomial_coefficients, coeff)
801
+ for i, coeff in b._monomial_coefficients.items()))
802
+ for b in S._basis]
803
+ # Lift the basis of W', which is W as a subrepresentation of ``self``
804
+ # This is equivalent to [b.lift() for b in series[cur+1].basis()]
805
+ Wp_basis = list(series[cur+1]._basis)
806
+ Wp = self.subrepresentation(S_basis + Wp_basis, is_closed=True)
807
+ series.insert(cur+1, Wp)
808
+ if V is self:
809
+ W = Wp
810
+ else:
811
+ W = V.subrepresentation([V.retract(b) for b in series[cur+1]._basis],
812
+ already_echelonized=True, is_closed=True)
813
+ Q = V.quotient_representation(W)
814
+ S = Q.find_subrepresentation()
815
+
816
+ cur += 1
817
+
818
+ # Special case when ``self`` is irreducible
819
+ if len(series) == 1:
820
+ simples = (self,)
821
+ series.append(self.subrepresentation([], is_closed=True))
822
+ return (tuple(series), simples)
823
+
824
+ # Convert series to a tower and include the 0 dimensional
825
+ # representation at the end.
826
+ ret = [self, series[1]]
827
+ prev = series[1]
828
+ lift = prev.lift
829
+ retract = lift.section()
830
+ for W in series[2:]:
831
+ prev = prev.subrepresentation([retract(b) for b in W._basis],
832
+ already_echelonized=True, is_closed=True)
833
+ ret.append(prev)
834
+
835
+ # Construct the lift map prev -> self
836
+ data = {i: lift(prev._basis[i]) for i in prev._basis.keys()}
837
+ lift = prev.module_morphism(data.__getitem__,
838
+ codomain=self,
839
+ triangular='lower',
840
+ unitriangular=False,
841
+ key=W._support_key,
842
+ inverse_on_support='compute')
843
+ retract = lift.section()
844
+
845
+ ret.append(ret[-1].subrepresentation([], is_closed=True))
846
+
847
+ # Construct the simples
848
+ simples = [ret[i].quotient_representation(ret[i+1])
849
+ for i in range(len(ret)-2)]
850
+ simples.append(ret[-2])
851
+
852
+ return (tuple(ret), tuple(simples))
853
+
854
+ def composition_series(self):
855
+ r"""
856
+ Return a composition series of ``self``.
857
+
858
+ EXAMPLES:
859
+
860
+ The algorithm used here uses random elements, so we set the seed
861
+ for testing purposes::
862
+
863
+ sage: set_random_seed(0)
864
+ sage: G = groups.permutation.Dihedral(5)
865
+ sage: CFM = CombinatorialFreeModule(GF(2), [1, 2, 3, 4, 5],
866
+ ....: bracket=False, prefix='e')
867
+ sage: CFM.an_element()
868
+ e3
869
+ sage: R = G.representation(CFM, lambda g, i: CFM.basis()[g(i)], side='right')
870
+ sage: CS = R.composition_series()
871
+ sage: len(CS)
872
+ 3
873
+ sage: [[R(b) for b in F.basis()] for F in CS]
874
+ [[e1, e2, e3, e4, e5], [e1 + e5, e2 + e5, e3 + e5, e4 + e5], []]
875
+ sage: [F.brauer_character() for F in CS]
876
+ [(5, 0, 0), (4, -1, -1), (0, 0, 0)]
877
+ sage: [F.brauer_character() for F in R.composition_factors()]
878
+ [(1, 1, 1), (4, -1, -1)]
879
+ sage: Reg = G.regular_representation(GF(2))
880
+ sage: simple_brauer_chars = set([F.brauer_character()
881
+ ....: for F in Reg.composition_factors()])
882
+ sage: sorted(simple_brauer_chars)
883
+ [(1, 1, 1), (4, -1, -1)]
884
+ """
885
+ return self._composition_series_data()[0]
886
+
887
+ def composition_factors(self):
888
+ r"""
889
+ Return the composition factors of ``self``.
890
+
891
+ Given a composition series `V = V_0 \subseteq V_1 \subseteq \cdots
892
+ \subseteq V_{\ell} = 0`, the composition factor `S_i` is defined as
893
+ `V_i / V_{i+1}`.
894
+
895
+ EXAMPLES:
896
+
897
+ The algorithm used here uses random elements, so we set the seed
898
+ for testing purposes::
899
+
900
+ sage: set_random_seed(0)
901
+ sage: SGA = SymmetricGroupAlgebra(GF(3), 6)
902
+ sage: SM = SGA.specht_module([4, 1, 1])
903
+ sage: CF = SM.composition_factors()
904
+ sage: CF
905
+ (Quotient representation with basis
906
+ {[[1, 2, 5, 6], [3], [4]], [[1, 2, 4, 6], [3], [5]], [[1, 2, 3, 6], [4], [5]],
907
+ [[1, 2, 4, 5], [3], [6]], [[1, 2, 3, 5], [4], [6]], [[1, 2, 3, 4], [5], [6]]}
908
+ of Specht module of [4, 1, 1] over Finite Field of size 3,
909
+ Subrepresentation with basis {0, 1, 2, 3} of Specht module
910
+ of [4, 1, 1] over Finite Field of size 3)
911
+ sage: x = SGA.an_element()
912
+ sage: v = CF[1].an_element(); v
913
+ 2*B[0] + 2*B[1]
914
+ sage: x * v
915
+ B[1] + B[2]
916
+
917
+ We reproduce the decomposition matrix for `S_5` over `\GF{2}`::
918
+
919
+ sage: SGA = SymmetricGroupAlgebra(GF(2), 5)
920
+ sage: simples = [SGA.simple_module(la).brauer_character()
921
+ ....: for la in SGA.simple_module_parameterization()]
922
+ sage: D = []
923
+ sage: for la in Partitions(5):
924
+ ....: SM = SGA.specht_module(la)
925
+ ....: data = [CF.brauer_character() for CF in SM.composition_factors()]
926
+ ....: D.append([data.count(bc) for bc in simples])
927
+ sage: matrix(D)
928
+ [1 0 0]
929
+ [0 1 0]
930
+ [1 0 1]
931
+ [2 0 1]
932
+ [1 0 1]
933
+ [0 1 0]
934
+ [1 0 0]
935
+ """
936
+ return self._composition_series_data()[1]
937
+
938
+ class Element(CombinatorialFreeModule.Element):
939
+ def _acted_upon_(self, scalar, self_on_left=False):
940
+ """
941
+ Return the action of ``scalar`` on ``self``.
942
+
943
+ EXAMPLES::
944
+
945
+ sage: G = groups.misc.WeylGroup(['B',2], prefix='s')
946
+ sage: R = G.regular_representation()
947
+ sage: s1,s2 = G.gens()
948
+ sage: x = R.an_element(); x
949
+ 2*s2*s1*s2 + s1*s2 + 3*s2 + 1
950
+ sage: 2 * x
951
+ 4*s2*s1*s2 + 2*s1*s2 + 6*s2 + 2
952
+ sage: s1 * x
953
+ 2*s2*s1*s2*s1 + 3*s1*s2 + s1 + s2
954
+ sage: s2 * x
955
+ s2*s1*s2 + 2*s1*s2 + s2 + 3
956
+
957
+ sage: G = groups.misc.WeylGroup(['B',2], prefix='s')
958
+ sage: R = G.regular_representation(side='right')
959
+ sage: s1,s2 = G.gens()
960
+ sage: x = R.an_element(); x
961
+ 2*s2*s1*s2 + s1*s2 + 3*s2 + 1
962
+ sage: x * s1
963
+ 2*s2*s1*s2*s1 + s1*s2*s1 + 3*s2*s1 + s1
964
+ sage: x * s2
965
+ 2*s2*s1 + s1 + s2 + 3
966
+
967
+ sage: G = groups.misc.WeylGroup(['B',2], prefix='s')
968
+ sage: R = G.regular_representation()
969
+ sage: R.base_ring()
970
+ Integer Ring
971
+ sage: A = G.algebra(ZZ)
972
+ sage: s1,s2 = A.algebra_generators()
973
+ sage: x = R.an_element(); x
974
+ 2*s2*s1*s2 + s1*s2 + 3*s2 + 1
975
+ sage: s1 * x
976
+ 2*s2*s1*s2*s1 + 3*s1*s2 + s1 + s2
977
+ sage: s2 * x
978
+ s2*s1*s2 + 2*s1*s2 + s2 + 3
979
+ sage: (2*s1 - s2) * x
980
+ 4*s2*s1*s2*s1 - s2*s1*s2 + 4*s1*s2 + 2*s1 + s2 - 3
981
+ sage: (3*s1 + s2) * R.zero()
982
+ 0
983
+
984
+ sage: A = G.algebra(QQ)
985
+ sage: s1,s2 = A.algebra_generators()
986
+ sage: a = 1/2 * s1
987
+ sage: a * x
988
+ Traceback (most recent call last):
989
+ ...
990
+ TypeError: unsupported operand parent(s) for *:
991
+ 'Algebra of Weyl Group of type ['B', 2] ... over Rational Field'
992
+ and 'Left Regular Representation of Weyl Group of type ['B', 2] ... over Integer Ring'
993
+
994
+ Check that things that coerce into the group (algebra) also have
995
+ an action::
996
+
997
+ sage: D4 = groups.permutation.Dihedral(4)
998
+ sage: S4 = SymmetricGroup(4)
999
+ sage: S4.has_coerce_map_from(D4)
1000
+ True
1001
+ sage: R = S4.regular_representation()
1002
+ sage: D4.an_element() * R.an_element()
1003
+ 2*(2,4) + 3*(1,2,3,4) + (1,3) + (1,4,2,3)
1004
+ """
1005
+ if isinstance(scalar, Element):
1006
+ P = self.parent()
1007
+ sP = scalar.parent()
1008
+ if sP is P._semigroup:
1009
+ if not self:
1010
+ return self
1011
+ return P._semigroup_action(scalar, self, self_on_left)
1012
+
1013
+ if sP is P._semigroup_algebra:
1014
+ if not self:
1015
+ return self
1016
+ return P.linear_combination(((P._semigroup_action(ms, self, self_on_left), cs)
1017
+ for ms, cs in scalar), not self_on_left)
1018
+
1019
+ if P._semigroup.has_coerce_map_from(sP):
1020
+ scalar = P._semigroup(scalar)
1021
+ return self._acted_upon_(scalar, self_on_left)
1022
+
1023
+ # Check for scalars first before general coercion to the semigroup algebra.
1024
+ # This will result in a faster action for the scalars.
1025
+ ret = CombinatorialFreeModule.Element._acted_upon_(self, scalar, self_on_left)
1026
+ if ret is not None:
1027
+ return ret
1028
+
1029
+ if P._semigroup_algebra.has_coerce_map_from(sP):
1030
+ scalar = P._semigroup_algebra(scalar)
1031
+ return self._acted_upon_(scalar, self_on_left)
1032
+
1033
+ return None
1034
+
1035
+ return CombinatorialFreeModule.Element._acted_upon_(self, scalar, self_on_left)
1036
+
1037
+
1038
+ class Representation(Representation_abstract, CombinatorialFreeModule):
1039
+ r"""
1040
+ Representation of a semigroup.
1041
+
1042
+ INPUT:
1043
+
1044
+ - ``semigroup`` -- a semigroup
1045
+ - ``module`` -- a module with a basis
1046
+ - ``on_basis`` -- function which takes as input ``g``, ``m``, where
1047
+ ``g`` is an element of the semigroup and ``m`` is an element of the
1048
+ indexing set for the basis, and returns the result of ``g`` acting
1049
+ on ``m``
1050
+ - ``side`` -- (default: ``'left'``) whether this is a
1051
+ ``'left'`` or ``'right'`` representation
1052
+
1053
+ EXAMPLES:
1054
+
1055
+ We construct the sign representation of a symmetric group::
1056
+
1057
+ sage: G = SymmetricGroup(4)
1058
+ sage: M = CombinatorialFreeModule(QQ, ['v'])
1059
+ sage: on_basis = lambda g,m: M.term(m, g.sign())
1060
+ sage: R = G.representation(M, on_basis)
1061
+ sage: x = R.an_element(); x
1062
+ 2*B['v']
1063
+ sage: c,s = G.gens()
1064
+ sage: c,s
1065
+ ((1,2,3,4), (1,2))
1066
+ sage: c * x
1067
+ -2*B['v']
1068
+ sage: s * x
1069
+ -2*B['v']
1070
+ sage: c * s * x
1071
+ 2*B['v']
1072
+ sage: (c * s) * x
1073
+ 2*B['v']
1074
+
1075
+ This extends naturally to the corresponding group algebra::
1076
+
1077
+ sage: A = G.algebra(QQ)
1078
+ sage: s,c = A.algebra_generators()
1079
+ sage: c,s
1080
+ ((1,2,3,4), (1,2))
1081
+ sage: c * x
1082
+ -2*B['v']
1083
+ sage: s * x
1084
+ -2*B['v']
1085
+ sage: c * s * x
1086
+ 2*B['v']
1087
+ sage: (c * s) * x
1088
+ 2*B['v']
1089
+ sage: (c + s) * x
1090
+ -4*B['v']
1091
+
1092
+ REFERENCES:
1093
+
1094
+ - :wikipedia:`Group_representation`
1095
+ """
1096
+ def __init__(self, semigroup, module, on_basis, side='left', **kwargs):
1097
+ """
1098
+ Initialize ``self``.
1099
+
1100
+ EXAMPLES::
1101
+
1102
+ sage: G = SymmetricGroup(4)
1103
+ sage: M = CombinatorialFreeModule(QQ, ['v'])
1104
+ sage: def on_basis(g, m):
1105
+ ....: return M.term(m, g.sign())
1106
+ sage: R = G.representation(M, on_basis)
1107
+ sage: R._test_representation()
1108
+
1109
+ sage: G = CyclicPermutationGroup(3)
1110
+ sage: M = algebras.Exterior(QQ, 'x', 3)
1111
+ sage: def on_basis(g, m): # cyclically permute generators
1112
+ ....: return M.prod([M.monomial(FrozenBitset([g(j+1)-1])) for j in m])
1113
+ sage: from sage.categories.algebras import Algebras
1114
+ sage: R = G.representation(M, on_basis, category=Algebras(QQ).WithBasis().FiniteDimensional())
1115
+ sage: r = R.an_element(); r
1116
+ 1 + 2*x0 + x0*x1 + 3*x1
1117
+ sage: r*r
1118
+ 1 + 4*x0 + 2*x0*x1 + 6*x1
1119
+ sage: x0, x1, x2 = M.gens()
1120
+ sage: s = R(x0*x1)
1121
+ sage: g = G.an_element()
1122
+ sage: g*s
1123
+ x1*x2
1124
+ sage: g*R(x1*x2)
1125
+ -x0*x2
1126
+ sage: g*r
1127
+ 1 + 2*x1 + x1*x2 + 3*x2
1128
+ sage: g^2*r
1129
+ 1 + 3*x0 - x0*x2 + 2*x2
1130
+
1131
+ sage: G = SymmetricGroup(4)
1132
+ sage: A = SymmetricGroup(4).algebra(QQ)
1133
+ sage: def action(g, x):
1134
+ ....: return A.monomial(g*x)
1135
+ sage: category = Algebras(QQ).WithBasis().FiniteDimensional()
1136
+ sage: R = G.representation(A, action, 'left', category=category)
1137
+ sage: r = R.an_element(); r
1138
+ () + (2,3,4) + 2*(1,3)(2,4) + 3*(1,4)(2,3)
1139
+ sage: r^2
1140
+ 14*() + 2*(2,3,4) + (2,4,3) + 12*(1,2)(3,4) + 3*(1,2,4) + 2*(1,3,2) + 4*(1,3)(2,4) + 5*(1,4,3) + 6*(1,4)(2,3)
1141
+ sage: g = G.an_element(); g
1142
+ (2,3,4)
1143
+ sage: g*r
1144
+ (2,3,4) + (2,4,3) + 2*(1,3,2) + 3*(1,4,3)
1145
+ """
1146
+ try:
1147
+ self.product_on_basis = module.product_on_basis
1148
+ except AttributeError:
1149
+ pass
1150
+
1151
+ category = kwargs.pop('category', Modules(module.base_ring()).WithBasis())
1152
+
1153
+ self._on_basis = on_basis
1154
+ self._module = module
1155
+ if side == "twosided":
1156
+ raise ValueError("the defined action must be either left or right")
1157
+
1158
+ indices = module.basis().keys()
1159
+
1160
+ if 'FiniteDimensional' in module.category().axioms():
1161
+ category = category.FiniteDimensional()
1162
+
1163
+ CombinatorialFreeModule.__init__(self, module.base_ring(), indices, category=category,
1164
+ **module.print_options())
1165
+ Representation_abstract.__init__(self, semigroup, side)
1166
+
1167
+ def _test_representation(self, **options):
1168
+ """
1169
+ Check (on some elements) that ``self`` is a representation of the
1170
+ given semigroup.
1171
+
1172
+ EXAMPLES::
1173
+
1174
+ sage: G = groups.permutation.Dihedral(4)
1175
+ sage: R = G.regular_representation()
1176
+ sage: R._test_representation()
1177
+
1178
+ sage: G = CoxeterGroup(['A',4,1], base_ring=ZZ)
1179
+ sage: M = CombinatorialFreeModule(QQ, ['v'])
1180
+ sage: def on_basis(g, m):
1181
+ ....: return M.term(m, (-1)**g.length())
1182
+ sage: R = G.representation(M, on_basis, side='right')
1183
+ sage: R._test_representation(max_runs=500)
1184
+ """
1185
+ from sage.misc.functional import sqrt
1186
+ tester = self._tester(**options)
1187
+ S = tester.some_elements()
1188
+ L = []
1189
+ max_len = int(sqrt(tester._max_runs)) + 1
1190
+ for i, x in enumerate(self._semigroup):
1191
+ L.append(x)
1192
+ if i >= max_len:
1193
+ break
1194
+ for x in L:
1195
+ for y in L:
1196
+ for elt in S:
1197
+ if self._left_repr:
1198
+ tester.assertEqual(x*(y*elt), (x*y)*elt)
1199
+ else:
1200
+ tester.assertEqual((elt*y)*x, elt*(y*x))
1201
+
1202
+ def _repr_(self):
1203
+ """
1204
+ Return a string representation of ``self``.
1205
+
1206
+ EXAMPLES::
1207
+
1208
+ sage: P = Permutations(4)
1209
+ sage: M = CombinatorialFreeModule(QQ, ['v'])
1210
+ sage: on_basis = lambda g,m: M.term(m, g.sign())
1211
+ sage: P.representation(M, on_basis)
1212
+ Representation of Standard permutations of 4 indexed by {'v'}
1213
+ over Rational Field
1214
+ """
1215
+ return "Representation of {} indexed by {} over {}".format(
1216
+ self._semigroup, self.basis().keys(), self.base_ring())
1217
+
1218
+ def _repr_term(self, b):
1219
+ """
1220
+ Return a string representation of a basis index ``b`` of ``self``.
1221
+
1222
+ EXAMPLES::
1223
+
1224
+ sage: SGA = SymmetricGroupAlgebra(QQ, 3)
1225
+ sage: R = SGA.regular_representation()
1226
+ sage: all(R._repr_term(b) == SGA._repr_term(b) for b in SGA.basis().keys())
1227
+ True
1228
+ """
1229
+ return self._module._repr_term(b)
1230
+
1231
+ def _latex_term(self, b):
1232
+ """
1233
+ Return a LaTeX representation of a basis index ``b`` of ``self``.
1234
+
1235
+ EXAMPLES::
1236
+
1237
+ sage: SGA = SymmetricGroupAlgebra(QQ, 3)
1238
+ sage: R = SGA.regular_representation()
1239
+ sage: all(R._latex_term(b) == SGA._latex_term(b) for b in SGA.basis().keys())
1240
+ True
1241
+ """
1242
+ return self._module._latex_term(b)
1243
+
1244
+ def _element_constructor_(self, x):
1245
+ """
1246
+ Construct an element of ``self`` from ``x``.
1247
+
1248
+ EXAMPLES::
1249
+
1250
+ sage: G = groups.permutation.Dihedral(4)
1251
+ sage: A = G.algebra(ZZ)
1252
+ sage: R = A.regular_representation()
1253
+ sage: x = A.an_element(); x
1254
+ () + (1,3) + 2*(1,3)(2,4) + 3*(1,4,3,2)
1255
+ sage: R(x)
1256
+ () + (1,3) + 2*(1,3)(2,4) + 3*(1,4,3,2)
1257
+ """
1258
+ if isinstance(x, Element) and x.parent() is self._module:
1259
+ return self._from_dict(x.monomial_coefficients(copy=False), remove_zeros=False)
1260
+ return super()._element_constructor_(x)
1261
+
1262
+ def product_by_coercion(self, left, right):
1263
+ r"""
1264
+ Return the product of ``left`` and ``right`` by passing to
1265
+ ``self._module`` and then building a new element of ``self``.
1266
+
1267
+ EXAMPLES::
1268
+
1269
+ sage: G = groups.permutation.KleinFour()
1270
+ sage: E = algebras.Exterior(QQ,'e',4)
1271
+ sage: on_basis = lambda g,m: E.monomial(m) # the trivial representation
1272
+ sage: R = G.representation(E, on_basis)
1273
+ sage: r = R.an_element(); r
1274
+ 1 + 2*e0 + 3*e1 + e1*e2
1275
+ sage: g = G.an_element();
1276
+ sage: g * r == r # indirect doctest
1277
+ True
1278
+ sage: r * r # indirect doctest
1279
+ Traceback (most recent call last):
1280
+ ...
1281
+ TypeError: unsupported operand parent(s) for *:
1282
+ 'Representation of The Klein 4 group of order 4, as a permutation
1283
+ group indexed by Subsets of {0,1,...,3} over Rational Field' and
1284
+ 'Representation of The Klein 4 group of order 4, as a permutation
1285
+ group indexed by Subsets of {0,1,...,3} over Rational Field'
1286
+
1287
+ sage: from sage.categories.algebras import Algebras
1288
+ sage: category = Algebras(QQ).FiniteDimensional().WithBasis()
1289
+ sage: T = G.representation(E, on_basis, category=category)
1290
+ sage: t = T.an_element(); t
1291
+ 1 + 2*e0 + 3*e1 + e1*e2
1292
+ sage: g * t == t # indirect doctest
1293
+ True
1294
+ sage: t * t # indirect doctest
1295
+ 1 + 4*e0 + 4*e0*e1*e2 + 6*e1 + 2*e1*e2
1296
+ """
1297
+ M = self._module
1298
+
1299
+ # Multiply in self._module
1300
+ p = M._from_dict(left._monomial_coefficients, False, False) * M._from_dict(right._monomial_coefficients, False, False)
1301
+
1302
+ # Convert from a term in self._module to a term in self
1303
+ return self._from_dict(p.monomial_coefficients(copy=False), False, False)
1304
+
1305
+ def _semigroup_action(self, g, vec, vec_on_left):
1306
+ """
1307
+ Return the action of the semigroup element ``g`` on the
1308
+ vector ``vec`` of ``self``.
1309
+
1310
+ EXAMPLES::
1311
+
1312
+ sage: G = groups.permutation.KleinFour()
1313
+ sage: E = algebras.Exterior(QQ,'e',4)
1314
+ sage: on_basis = lambda g,m: E.monomial(m) # the trivial representation
1315
+ sage: R = G.representation(E, on_basis)
1316
+ sage: R._semigroup_action(G.an_element(), R.an_element(), True)
1317
+ 1 + 2*e0 + 3*e1 + e1*e2
1318
+ """
1319
+ if self._left_repr == vec_on_left:
1320
+ g = ~g
1321
+ return self.linear_combination(((self._on_basis(g, m), c)
1322
+ for m, c in vec._monomial_coefficients.items()), not vec_on_left)
1323
+
1324
+
1325
+ class Subrepresentation(Representation_abstract, SubmoduleWithBasis):
1326
+ r"""
1327
+ A subrepresentation.
1328
+
1329
+ Let `R` be a representation of an algebraic object `X`. A
1330
+ subrepresentation is a submodule of `R` that is closed under
1331
+ the action of `X`.
1332
+ """
1333
+ # Use the same normalization as the base class
1334
+ __classcall_private__ = SubmoduleWithBasis.__classcall_private__
1335
+
1336
+ def __init__(self, basis, support_order, ambient, *args, **opts):
1337
+ r"""
1338
+ Initialize ``self``.
1339
+
1340
+ EXAMPLES::
1341
+
1342
+ sage: G = groups.permutation.Dihedral(4)
1343
+ sage: R = G.regular_representation(QQ)
1344
+ sage: S = R.subrepresentation([sum(R.basis())])
1345
+ sage: TestSuite(S).run()
1346
+ """
1347
+ SubmoduleWithBasis.__init__(self, basis, support_order, ambient, *args, **opts)
1348
+ Representation_abstract.__init__(self, ambient.semigroup(), ambient.side(), ambient.semigroup_algebra())
1349
+
1350
+ def _repr_(self):
1351
+ r"""
1352
+ Return a string representation of ``self``.
1353
+
1354
+ EXAMPLES::
1355
+
1356
+ sage: G = groups.permutation.Dihedral(4)
1357
+ sage: R = G.regular_representation()
1358
+ sage: R.subrepresentation([sum(R.basis())], is_closed=True)
1359
+ Subrepresentation with basis {0} of Left Regular Representation of
1360
+ Dihedral group of order 8 as a permutation group over Integer Ring
1361
+ """
1362
+ return "Subrepresentation with basis {} of {}".format(self.basis().keys(), self._ambient)
1363
+
1364
+ class Element(SubmoduleWithBasis.Element):
1365
+ def _acted_upon_(self, scalar, self_on_left=True):
1366
+ """
1367
+ Return the action of ``scalar`` on ``self``.
1368
+
1369
+ EXAMPLES::
1370
+
1371
+ sage: G = groups.permutation.Dihedral(4)
1372
+ sage: CFM = CombinatorialFreeModule(GF(2), [1, 2, 3, 4],
1373
+ ....: bracket=False, prefix='e')
1374
+ sage: R = G.representation(CFM, lambda g, i: CFM.basis()[g(i)], side='right')
1375
+ sage: e1, e2, e3, e4 = R.basis()
1376
+ sage: S = R.subrepresentation([e1 + e3, e2 + e4], is_closed=True)
1377
+ sage: x = G.an_element(); x
1378
+ (1,3)
1379
+ sage: v = sum(S.basis()); v
1380
+ B[0] + B[1]
1381
+ sage: x * v
1382
+ B[0] + B[1]
1383
+ sage: [x * b for b in S.basis()]
1384
+ [B[0], B[1]]
1385
+ sage: [[g * b for g in G] for b in S.basis()]
1386
+ [[B[0], B[0], B[1], B[1], B[0], B[0], B[1], B[1]],
1387
+ [B[1], B[1], B[0], B[0], B[1], B[1], B[0], B[0]]]
1388
+ sage: 2 * v
1389
+ 0
1390
+
1391
+ sage: Q = R.quotient_representation(S)
1392
+ sage: [[g * b for g in G] for b in Q.basis()]
1393
+ [[B[3], B[3], B[4], B[4], B[3], B[3], B[4], B[4]],
1394
+ [B[4], B[4], B[3], B[3], B[4], B[4], B[3], B[3]]]
1395
+ """
1396
+ ret = super()._acted_upon_(scalar, self_on_left)
1397
+ if ret is not None:
1398
+ return ret
1399
+ P = self.parent()
1400
+ if scalar in P._semigroup or scalar in P._semigroup_algebra:
1401
+ return P.retract(self.lift()._acted_upon_(scalar, self_on_left))
1402
+ return None
1403
+
1404
+
1405
+ class QuotientRepresentation(Representation_abstract, QuotientModuleWithBasis):
1406
+ """
1407
+ The quotient of a representation by another representation, which
1408
+ admits a natural structure of a representation.
1409
+ """
1410
+ # Use the same normalization as the base class
1411
+ __classcall_private__ = QuotientModuleWithBasis.__classcall_private__
1412
+
1413
+ def __init__(self, *args, **kwds):
1414
+ r"""
1415
+ Initialize ``self``.
1416
+
1417
+ EXAMPLES::
1418
+
1419
+ sage: G = groups.permutation.Dihedral(4)
1420
+ sage: R = G.regular_representation(QQ)
1421
+ sage: S = R.subrepresentation([sum(R.basis())], is_closed=True)
1422
+ sage: Q = R.quotient_representation(S)
1423
+ sage: TestSuite(Q).run()
1424
+ """
1425
+ QuotientModuleWithBasis.__init__(self, *args, **kwds)
1426
+ amb = self.ambient()
1427
+ Representation_abstract.__init__(self, amb.semigroup(), amb.side(), amb.semigroup_algebra())
1428
+
1429
+ def _repr_(self):
1430
+ r"""
1431
+ Return a string representation of ``self``.
1432
+
1433
+ EXAMPLES::
1434
+
1435
+ sage: G = groups.permutation.Dihedral(4)
1436
+ sage: R = G.regular_representation(QQ)
1437
+ sage: S = R.subrepresentation([sum(R.basis())], is_closed=True)
1438
+ sage: R.quotient_representation(S)
1439
+ Quotient representation with basis
1440
+ {(1,3)(2,4), (1,4,3,2), (1,2,3,4), (2,4), (1,3), (1,4)(2,3), (1,2)(3,4)}
1441
+ of Left Regular Representation of Dihedral group of order 8
1442
+ as a permutation group over Rational Field
1443
+ """
1444
+ return "Quotient representation with basis {} of {}".format(self.basis().keys(), self._ambient)
1445
+
1446
+ Element = Subrepresentation.Element
1447
+
1448
+
1449
+ class Representation_Tensor(Representation_abstract, CombinatorialFreeModule_Tensor):
1450
+ r"""
1451
+ Tensor product of representations.
1452
+ """
1453
+ @staticmethod
1454
+ def __classcall_private__(cls, reps, **options):
1455
+ r"""
1456
+ Normalize input to ensure a unique representation.
1457
+
1458
+ EXAMPLES::
1459
+
1460
+ sage: S3 = SymmetricGroup(3)
1461
+ sage: L = S3.regular_representation(side='left')
1462
+ sage: S = S3.sign_representation()
1463
+ sage: R = S3.regular_representation(side='right')
1464
+ sage: tensor([tensor([L, S]), R]) == tensor([L, S, R])
1465
+ True
1466
+ sage: tensor([L, tensor([S, R])]) == tensor([L, S, R])
1467
+ True
1468
+
1469
+ Check that the tensor product with more general modules
1470
+ can be constructed::
1471
+
1472
+ sage: C = CombinatorialFreeModule(ZZ, ['a','b'])
1473
+ sage: T = tensor([C, R])
1474
+ sage: type(T)
1475
+ <class 'sage.combinat.free_module.CombinatorialFreeModule_Tensor_with_category'>
1476
+ sage: T = tensor([R, C])
1477
+ sage: type(T)
1478
+ <class 'sage.combinat.free_module.CombinatorialFreeModule_Tensor_with_category'>
1479
+ """
1480
+ assert len(reps) > 0
1481
+ assert isinstance(reps[0], Representation_abstract)
1482
+ S = reps[0].semigroup()
1483
+ if not all(isinstance(module, Representation_abstract)
1484
+ and module.semigroup() == S for module in reps):
1485
+ return CombinatorialFreeModule_Tensor(reps, **options)
1486
+ R = reps[0].base_ring()
1487
+ if not all(module in Modules(R).WithBasis() for module in reps):
1488
+ raise ValueError("not all representations over the same base ring")
1489
+ # flatten the list of modules so that tensor(A, tensor(B,C)) gets rewritten into tensor(A, B, C)
1490
+ reps = sum((module._sets if isinstance(module, Representation_Tensor) else (module,) for module in reps), ())
1491
+ if all('FiniteDimensional' in M.category().axioms() for M in reps):
1492
+ options['category'] = options['category'].FiniteDimensional()
1493
+ return super().__classcall__(cls, reps, **options)
1494
+
1495
+ def __init__(self, reps, **options):
1496
+ r"""
1497
+ Initialize ``self``.
1498
+
1499
+ EXAMPLES::
1500
+
1501
+ sage: G = groups.permutation.Alternating(5)
1502
+ sage: L = G.regular_representation(side='left')
1503
+ sage: S = G.sign_representation()
1504
+ sage: T = tensor([L, S, L])
1505
+ sage: TestSuite(T).run()
1506
+ """
1507
+ sides = set(M.side() for M in reps)
1508
+ if "left" and "right" in sides:
1509
+ side = reps[0].side() # make a choice as this is not fundamentally important
1510
+ else:
1511
+ if len(sides) == 2: # mix of one side and twosided
1512
+ sides.remove("twosided")
1513
+ side, = sides # get the unique side remaining
1514
+ CombinatorialFreeModule_Tensor.__init__(self, reps, **options)
1515
+ Representation_abstract.__init__(self, reps[0].semigroup(), side)
1516
+
1517
+ def _semigroup_action(self, g, vec, vec_on_left):
1518
+ """
1519
+ Return the action of the semigroup element ``g`` on the
1520
+ vector ``vec`` of ``self``.
1521
+
1522
+ EXAMPLES::
1523
+
1524
+ sage: S3 = SymmetricGroup(3)
1525
+ sage: L = S3.regular_representation(side='left')
1526
+ sage: R = S3.regular_representation(side='right')
1527
+ sage: T = tensor([R, L])
1528
+ sage: g = S3.an_element(); g
1529
+ (2,3)
1530
+ sage: v = T.an_element(); v
1531
+ 2*() # () + 3*() # (1,2,3) + 2*() # (1,3,2)
1532
+ sage: g * v
1533
+ 2*(2,3) # (2,3) + 3*(2,3) # (1,2) + 2*(2,3) # (1,3)
1534
+ sage: T._semigroup_action(g, v, True)
1535
+ 2*(2,3) # (2,3) + 3*(2,3) # (1,2) + 2*(2,3) # (1,3)
1536
+ """
1537
+ bases = [M.basis() for M in self._sets]
1538
+ if vec_on_left:
1539
+ return self.linear_combination((self._tensor_of_elements([B[k] * g for B, k in zip(bases, b)]), c)
1540
+ for b, c in vec._monomial_coefficients.items())
1541
+ return self.linear_combination((self._tensor_of_elements([g * B[k] for B, k in zip(bases, b)]), c)
1542
+ for b, c in vec._monomial_coefficients.items())
1543
+
1544
+ class Element(Representation_abstract.Element):
1545
+ pass
1546
+
1547
+
1548
+ Representation_abstract.Tensor = Representation_Tensor
1549
+
1550
+
1551
+ class Representation_Exterior(Representation_abstract, CombinatorialFreeModule):
1552
+ r"""
1553
+ The exterior power representation (in a fixed degree).
1554
+ """
1555
+ def __init__(self, rep, degree=None, category=None, **options):
1556
+ r"""
1557
+ Initialize ``self``.
1558
+
1559
+ EXAMPLES::
1560
+
1561
+ sage: G = groups.matrix.GL(3, 2)
1562
+ sage: R = G.regular_representation(side='right')
1563
+ sage: E2 = R.exterior_power(2)
1564
+ sage: E2.category()
1565
+ Category of finite dimensional modules with basis over Integer Ring
1566
+ sage: TestSuite(E2).run()
1567
+
1568
+ sage: G = groups.matrix.GL(2, 3)
1569
+ sage: L = G.regular_representation(side='left')
1570
+ sage: E48 = L.exterior_power(48)
1571
+ sage: TestSuite(E48).run()
1572
+
1573
+ sage: L.exterior_power(-2)
1574
+ Traceback (most recent call last):
1575
+ ...
1576
+ ValueError: the degree must be an integer in [0, 48]
1577
+ sage: L.exterior_power(120)
1578
+ Traceback (most recent call last):
1579
+ ...
1580
+ ValueError: the degree must be an integer in [0, 48]
1581
+ sage: L.exterior_power(5/6)
1582
+ Traceback (most recent call last):
1583
+ ...
1584
+ ValueError: the degree must be an integer in [0, 48]
1585
+ """
1586
+ from sage.algebras.clifford_algebra import ExteriorAlgebra
1587
+ from sage.algebras.clifford_algebra import CliffordAlgebraIndices
1588
+ from sage.rings.integer_ring import ZZ
1589
+ self._degree = degree
1590
+ self._rep = rep
1591
+ R = rep.base_ring()
1592
+ dim = rep.dimension()
1593
+ if degree is not None and (degree not in ZZ or degree > dim or degree < 0):
1594
+ raise ValueError(f"the degree must be an integer in [0, {dim}]")
1595
+ self._extalg = ExteriorAlgebra(R, dim)
1596
+ self._basis_order = list(rep.basis().keys())
1597
+ self._inv_map = {b: i for i, b in enumerate(self._basis_order)}
1598
+ ind = CliffordAlgebraIndices(dim, degree)
1599
+ R = rep.base_ring()
1600
+ category = Modules(R).WithBasis().or_subcategory(category)
1601
+ CombinatorialFreeModule.__init__(self, R, ind, category=category, **options)
1602
+ Representation_abstract.__init__(self, rep.semigroup(), rep.side(), rep.semigroup_algebra())
1603
+
1604
+ def _repr_(self):
1605
+ r"""
1606
+ Return a string representation of ``self``.
1607
+
1608
+ EXAMPLES::
1609
+
1610
+ sage: DC3 = groups.permutation.DiCyclic(3)
1611
+ sage: L = DC3.regular_representation(QQ, side='left')
1612
+ sage: L.exterior_power(7)
1613
+ Exterior power representation of Left Regular Representation of
1614
+ Dicyclic group of order 12 as a permutation group over Rational Field
1615
+ in degree 7
1616
+ sage: L.exterior_power()
1617
+ Exterior algebra representation of Left Regular Representation of
1618
+ Dicyclic group of order 12 as a permutation group over Rational Field
1619
+ """
1620
+ if self._degree is None:
1621
+ return "Exterior algebra representation of {}".format(repr(self._rep))
1622
+ return "Exterior power representation of {} in degree {}".format(repr(self._rep), self._degree)
1623
+
1624
+ def _latex_(self):
1625
+ r"""
1626
+ Return a latex representation of ``self``.
1627
+
1628
+ EXAMPLES::
1629
+
1630
+ sage: DC3 = groups.permutation.DiCyclic(3)
1631
+ sage: L = DC3.regular_representation(QQ, side='left')
1632
+ sage: latex(L.exterior_power(4))
1633
+ \bigwedge^{4} ...
1634
+ sage: latex(L.exterior_power())
1635
+ \bigwedge ...
1636
+ """
1637
+ from sage.misc.latex import latex
1638
+ if self._degree is None:
1639
+ return "\\bigwedge " + latex(self._rep)
1640
+ return "\\bigwedge^{{{}}} ".format(self._degree) + latex(self._rep)
1641
+
1642
+ def _repr_term(self, m):
1643
+ r"""
1644
+ Return a string representation of the basis element indexed by
1645
+ ``m``.
1646
+
1647
+ EXAMPLES::
1648
+
1649
+ sage: DC3 = groups.permutation.DiCyclic(3)
1650
+ sage: L = DC3.regular_representation(QQ, side='left')
1651
+ sage: E2 = L.exterior_power(2)
1652
+ sage: E2._repr_term(E2.an_element().leading_support())
1653
+ '()*(5,6,7)'
1654
+ """
1655
+ if len(m) == 0:
1656
+ return '1'
1657
+ B = self._rep.basis()
1658
+ return '*'.join(repr(B[self._basis_order[i]]) for i in m)
1659
+
1660
+ def _ascii_art_term(self, m):
1661
+ r"""
1662
+ Return ascii art for the basis element indexed by ``m``.
1663
+
1664
+ EXAMPLES::
1665
+
1666
+ sage: DC3 = groups.permutation.DiCyclic(3)
1667
+ sage: L = DC3.regular_representation(QQ, side='left')
1668
+ sage: E2 = L.exterior_power(2)
1669
+ sage: E2._ascii_art_term(E2.an_element().leading_support())
1670
+ ()/\(5,6,7)
1671
+ sage: ascii_art(E2.an_element())
1672
+ 2*()/\(5,6,7) + 2*()/\(5,7,6) + 3*()/\(1,2)(3,4)
1673
+ """
1674
+ from sage.typeset.ascii_art import ascii_art
1675
+ if len(m) == 0:
1676
+ return ascii_art('1')
1677
+ wedge = '/\\'
1678
+ B = self._rep.basis()
1679
+ return ascii_art(*[B[self._basis_order[i]] for i in m], sep=wedge)
1680
+
1681
+ def _unicode_art_term(self, m):
1682
+ r"""
1683
+ Return unicode art for the basis element indexed by ``m``.
1684
+
1685
+ EXAMPLES::
1686
+
1687
+ sage: DC3 = groups.permutation.DiCyclic(3)
1688
+ sage: L = DC3.regular_representation(QQ, side='left')
1689
+ sage: E2 = L.exterior_power(2)
1690
+ sage: E2._unicode_art_term(E2.an_element().leading_support())
1691
+ ()∧(5,6,7)
1692
+ sage: unicode_art(E2.an_element())
1693
+ 2*()∧(5,6,7) + 2*()∧(5,7,6) + 3*()∧(1,2)(3,4)
1694
+ """
1695
+ from sage.typeset.unicode_art import unicode_art
1696
+ if len(m) == 0:
1697
+ return unicode_art('1')
1698
+ import unicodedata
1699
+ wedge = unicodedata.lookup('LOGICAL AND')
1700
+ B = self._rep.basis()
1701
+ return unicode_art(*[B[self._basis_order[i]] for i in m], sep=wedge)
1702
+
1703
+ def _latex_term(self, m):
1704
+ r"""
1705
+ Return a `\LaTeX` representation of the basis element indexed
1706
+ by ``m``.
1707
+
1708
+ EXAMPLES::
1709
+
1710
+ sage: DC3 = groups.permutation.DiCyclic(3)
1711
+ sage: L = DC3.regular_representation(QQ, side='left')
1712
+ sage: E2 = L.exterior_power(2)
1713
+ sage: E2._latex_term(E2.an_element().leading_support())
1714
+ '1 \\wedge (5,6,7)'
1715
+ """
1716
+ if len(m) == 0:
1717
+ return '1'
1718
+ from sage.misc.latex import latex
1719
+ B = self._rep.basis()
1720
+ return " \\wedge ".join(latex(B[self._basis_order[i]]) for i in m)
1721
+
1722
+ def _from_repr_to_ext(self, elt):
1723
+ r"""
1724
+ Return the element ``elt`` from the defining representation
1725
+ to the corresponding exterior algebra.
1726
+
1727
+ EXAMPLES::
1728
+
1729
+ sage: G = groups.matrix.GL(2, 2)
1730
+ sage: L = G.regular_representation(side='left')
1731
+ sage: E = L.exterior_power()
1732
+ sage: E._from_repr_to_ext(sum(i*b for i,b in enumerate(L.basis(), start=1)))
1733
+ e0 + 2*e1 + 3*e2 + 4*e3 + 5*e4 + 6*e5
1734
+ """
1735
+ ind = self._indices
1736
+ data = {ind([self._inv_map[k]]): c for k, c in elt._monomial_coefficients.items()}
1737
+ return self._extalg.element_class(self._extalg, data)
1738
+
1739
+ def _semigroup_action(self, g, vec, vec_on_left):
1740
+ r"""
1741
+ Return the action of the semigroup element ``g`` on the
1742
+ vector ``vec`` of ``self``.
1743
+
1744
+ EXAMPLES::
1745
+
1746
+ sage: DC3 = groups.permutation.DiCyclic(3)
1747
+ sage: g = DC3.an_element(); g
1748
+ (1,4,2,3)(5,6)
1749
+ sage: R = DC3.regular_representation(side='right')
1750
+ sage: E2 = R.exterior_power(2)
1751
+ sage: vec = E2.an_element(); vec
1752
+ 2*()*(5,6,7) + 2*()*(5,7,6) + 3*()*(1,2)(3,4)
1753
+ sage: E2._semigroup_action(g, vec, True)
1754
+ -2*(1,4,2,3)(6,7)*(1,4,2,3)(5,6) + 2*(1,4,2,3)(5,6)*(1,4,2,3)(5,7)
1755
+ + 3*(1,4,2,3)(5,6)*(1,3,2,4)(5,6)
1756
+ sage: E2._semigroup_action(g, vec, False)
1757
+ -2*(1,3,2,4)(6,7)*(1,3,2,4)(5,6) + 2*(1,3,2,4)(5,6)*(1,3,2,4)(5,7)
1758
+ - 3*(1,4,2,3)(5,6)*(1,3,2,4)(5,6)
1759
+ """
1760
+ return self.linear_combination(((self._action_on_basis(g, b, vec_on_left), c)
1761
+ for b, c in vec._monomial_coefficients.items()), not vec_on_left)
1762
+
1763
+ def _action_on_basis(self, g, b, vec_on_left):
1764
+ r"""
1765
+ Return the action of ``g`` on the basis element indexed by ``b``.
1766
+
1767
+ EXAMPLES::
1768
+
1769
+ sage: S3 = SymmetricGroup(3)
1770
+ sage: g = S3.an_element(); g
1771
+ (2,3)
1772
+ sage: L = S3.regular_representation(side='left')
1773
+ sage: E2 = L.exterior_power(2)
1774
+ sage: vec = E2.an_element(); vec
1775
+ 2*()*(1,3,2) + 2*()*(1,2,3) + 3*()*(2,3)
1776
+ sage: g * vec
1777
+ 2*(2,3)*(1,3) + 2*(2,3)*(1,2) - 3*()*(2,3)
1778
+ sage: vec * g
1779
+ 2*(2,3)*(1,3) + 2*(2,3)*(1,2) - 3*()*(2,3)
1780
+ sage: supp = vec.leading_support(); supp
1781
+ 11
1782
+ sage: E2._action_on_basis(g, supp, True)
1783
+ (2,3)*(1,3)
1784
+ sage: E2._action_on_basis(g, supp, False)
1785
+ (2,3)*(1,3)
1786
+ """
1787
+ B = self._rep.basis()
1788
+ if vec_on_left:
1789
+ temp = self._extalg.prod(self._from_repr_to_ext(B[self._basis_order[bk]] * g)
1790
+ for bk in b)
1791
+ else:
1792
+ temp = self._extalg.prod(self._from_repr_to_ext(g * B[self._basis_order[bk]])
1793
+ for bk in b)
1794
+ return self.element_class(self, temp._monomial_coefficients)
1795
+
1796
+
1797
+ class Representation_ExteriorAlgebra(Representation_Exterior):
1798
+ r"""
1799
+ The exterior algebra representation.
1800
+ """
1801
+ def __init__(self, rep, degree=None, category=None, **options):
1802
+ r"""
1803
+ Initialize ``self``.
1804
+
1805
+ EXAMPLES::
1806
+
1807
+ sage: G = groups.matrix.GL(3, 2)
1808
+ sage: R = G.regular_representation(side='right')
1809
+ sage: E0 = R.exterior_power(0)
1810
+ sage: E0.category()
1811
+ Category of finite dimensional algebras with basis over Integer Ring
1812
+ sage: TestSuite(E0).run()
1813
+
1814
+ sage: G = groups.matrix.GL(2, 3)
1815
+ sage: L = G.regular_representation(side='left')
1816
+ sage: E = L.exterior_power()
1817
+ sage: E.category()
1818
+ Category of finite dimensional algebras with basis over Integer Ring
1819
+ sage: TestSuite(E).run()
1820
+ """
1821
+ R = rep.base_ring()
1822
+ from sage.categories.algebras_with_basis import AlgebrasWithBasis
1823
+ category = AlgebrasWithBasis(R).or_subcategory(category)
1824
+ Representation_Exterior.__init__(self, rep, degree=degree, category=category, **options)
1825
+
1826
+ @cached_method
1827
+ def one_basis(self):
1828
+ r"""
1829
+ Return the basis element indexing `1` in ``self`` if it exists.
1830
+
1831
+ EXAMPLES::
1832
+
1833
+ sage: S3 = SymmetricGroup(3)
1834
+ sage: L = S3.regular_representation(side='left')
1835
+ sage: E = L.exterior_power()
1836
+ sage: E.one_basis()
1837
+ 0
1838
+ sage: E0 = L.exterior_power(0)
1839
+ sage: E0.one_basis()
1840
+ 0
1841
+ """
1842
+ return self._indices([])
1843
+
1844
+ def product_on_basis(self, x, y):
1845
+ r"""
1846
+ Return the product of basis elements indexed by ``x`` and ``y``.
1847
+
1848
+ EXAMPLES::
1849
+
1850
+ sage: S3 = SymmetricGroup(3)
1851
+ sage: L = S3.regular_representation(side='left')
1852
+ sage: E = L.exterior_power()
1853
+ sage: B = list(E.basis())
1854
+ sage: B[:7]
1855
+ [1, (), (1,3,2), (1,2,3), (2,3), (1,3), (1,2)]
1856
+ sage: B[2] * B[4] # indirect doctest
1857
+ (1,3,2)*(2,3)
1858
+ """
1859
+ B = self._extalg.basis()
1860
+ temp = B[x] * B[y]
1861
+ return self.element_class(self, temp._monomial_coefficients)
1862
+
1863
+
1864
+ class Representation_Symmetric(Representation_abstract, CombinatorialFreeModule):
1865
+ r"""
1866
+ The symmetric power representation in a fixed degree.
1867
+ """
1868
+ def __init__(self, rep, degree, **options):
1869
+ r"""
1870
+ Initialize ``self``.
1871
+
1872
+ EXAMPLES::
1873
+
1874
+ sage: G = groups.matrix.GL(3, 2)
1875
+ sage: R = G.regular_representation(side='right')
1876
+ sage: S2 = R.symmetric_power(2)
1877
+ sage: TestSuite(S2).run()
1878
+ sage: S0 = R.symmetric_power(0)
1879
+ sage: TestSuite(S2).run()
1880
+
1881
+ sage: R.symmetric_power(-2)
1882
+ Traceback (most recent call last):
1883
+ ...
1884
+ ValueError: the degree must be a nonnegative integer
1885
+ sage: R.symmetric_power(3/2)
1886
+ Traceback (most recent call last):
1887
+ ...
1888
+ ValueError: the degree must be a nonnegative integer
1889
+ """
1890
+ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
1891
+ from sage.combinat.integer_vector import IntegerVectors
1892
+ from sage.rings.integer_ring import ZZ
1893
+ self._degree = degree
1894
+ self._rep = rep
1895
+ R = rep.base_ring()
1896
+ dim = rep.dimension()
1897
+ if degree not in ZZ or degree < 0:
1898
+ raise ValueError("the degree must be a nonnegative integer")
1899
+ self._symalg = PolynomialRing(R, 'e', dim)
1900
+ self._basis_order = list(rep.basis().keys())
1901
+ G = self._symalg.gens()
1902
+ self._inv_map = {b: G[i] for i, b in enumerate(self._basis_order)}
1903
+ ind = IntegerVectors(degree, dim)
1904
+ CombinatorialFreeModule.__init__(self, rep.base_ring(), ind, **options)
1905
+ Representation_abstract.__init__(self, rep.semigroup(), rep.side(), rep.semigroup_algebra())
1906
+
1907
+ def _repr_(self):
1908
+ r"""
1909
+ Return a string representation of ``self``.
1910
+
1911
+ EXAMPLES::
1912
+
1913
+ sage: DC3 = groups.permutation.DiCyclic(3)
1914
+ sage: L = DC3.regular_representation(QQ, side='left')
1915
+ sage: L.symmetric_power(7)
1916
+ Symmetric power representation of Left Regular Representation of
1917
+ Dicyclic group of order 12 as a permutation group over Rational Field
1918
+ in degree 7
1919
+ """
1920
+ return "Symmetric power representation of {} in degree {}".format(repr(self._rep), self._degree)
1921
+
1922
+ def _latex_(self):
1923
+ r"""
1924
+ Return a latex representation of ``self``.
1925
+
1926
+ EXAMPLES::
1927
+
1928
+ sage: DC3 = groups.permutation.DiCyclic(3)
1929
+ sage: L = DC3.regular_representation(QQ, side='left')
1930
+ sage: latex(L.symmetric_power(4))
1931
+ S^{4} ...
1932
+ """
1933
+ from sage.misc.latex import latex
1934
+ return "S^{{{}}} {}".format(self._degree, latex(self._rep))
1935
+
1936
+ def _repr_term(self, m):
1937
+ r"""
1938
+ Return a string representation of the basis element indexed by
1939
+ ``m``.
1940
+
1941
+ EXAMPLES::
1942
+
1943
+ sage: DC3 = groups.permutation.DiCyclic(3)
1944
+ sage: L = DC3.regular_representation(QQ, side='left')
1945
+ sage: S2L = L.symmetric_power(2)
1946
+ sage: S2L.an_element()
1947
+ 3*()*(5,7,6) + 2*()*(5,6,7) + 2*()^2
1948
+ sage: S2L._repr_term(S2L.an_element().trailing_support())
1949
+ '()*(5,7,6)'
1950
+ sage: S2L._repr_term(S2L.an_element().leading_support())
1951
+ '()^2'
1952
+ sage: L.symmetric_power(0).an_element()
1953
+ 2
1954
+ """
1955
+ if not self._degree:
1956
+ return '1'
1957
+ B = self._rep.basis()
1958
+ return '*'.join(repr(B[self._basis_order[i]]) if e == 1 else repr(B[self._basis_order[i]]) + f'^{e}'
1959
+ for i,e in enumerate(m) if e)
1960
+
1961
+ def _ascii_art_term(self, m):
1962
+ r"""
1963
+ Return ascii art for the basis element indexed by ``m``.
1964
+
1965
+ EXAMPLES::
1966
+
1967
+ sage: DC3 = groups.permutation.DiCyclic(3)
1968
+ sage: L = DC3.regular_representation(QQ, side='left')
1969
+ sage: S2L = L.symmetric_power(2)
1970
+ sage: S2L._ascii_art_term(S2L.an_element().leading_support())
1971
+ 2
1972
+ ()
1973
+ sage: ascii_art(S2L.an_element())
1974
+ 2
1975
+ 3*()*(5,7,6) + 2*()*(5,6,7) + 2*()
1976
+ sage: ascii_art(L.symmetric_power(0).an_element())
1977
+ 2*1
1978
+ """
1979
+ from sage.typeset.ascii_art import ascii_art
1980
+ if not self._degree:
1981
+ return ascii_art('1')
1982
+ B = self._rep.basis()
1983
+ ret = ascii_art("")
1984
+ for i, e in enumerate(m):
1985
+ if not e:
1986
+ continue
1987
+ cur = ascii_art(B[self._basis_order[i]])
1988
+ if e > 1:
1989
+ cur += ascii_art(e, baseline=-cur.height())
1990
+ if ret:
1991
+ ret += ascii_art('*')
1992
+ ret += cur
1993
+ return ret
1994
+
1995
+ def _unicode_art_term(self, m):
1996
+ r"""
1997
+ Return unicode art for the basis element indexed by ``m``.
1998
+
1999
+ EXAMPLES::
2000
+
2001
+ sage: DC3 = groups.permutation.DiCyclic(3)
2002
+ sage: L = DC3.regular_representation(QQ, side='left')
2003
+ sage: S2L = L.symmetric_power(2)
2004
+ sage: S2L._unicode_art_term(S2L.an_element().leading_support())
2005
+ 2
2006
+ ()
2007
+ sage: unicode_art(S2L.an_element())
2008
+ 2
2009
+ 3*()*(5,7,6) + 2*()*(5,6,7) + 2*()
2010
+ sage: unicode_art(L.symmetric_power(0).an_element())
2011
+ 2*1
2012
+ """
2013
+ from sage.typeset.unicode_art import unicode_art
2014
+ if not self._degree:
2015
+ return unicode_art('1')
2016
+ B = self._rep.basis()
2017
+ ret = unicode_art("")
2018
+ for i, e in enumerate(m):
2019
+ if not e:
2020
+ continue
2021
+ cur = unicode_art(B[self._basis_order[i]])
2022
+ if e > 1:
2023
+ cur += unicode_art(e, baseline=-cur.height())
2024
+ if ret:
2025
+ ret += unicode_art('*')
2026
+ ret += cur
2027
+ return ret
2028
+
2029
+ def _latex_term(self, m):
2030
+ r"""
2031
+ Return a `\LaTeX` representation of the basis element indexed
2032
+ by ``m``.
2033
+
2034
+ EXAMPLES::
2035
+
2036
+ sage: DC3 = groups.permutation.DiCyclic(3)
2037
+ sage: L = DC3.regular_representation(QQ, side='left')
2038
+ sage: S2L = L.symmetric_power(2)
2039
+ sage: S2L._latex_term(S2L.an_element().leading_support())
2040
+ '1 ^{2}'
2041
+ sage: latex(S2L.an_element())
2042
+ 3 1 (5,7,6) + 2 1 (5,6,7) + 2 1 ^{2}
2043
+ sage: latex(L.symmetric_power(0).an_element())
2044
+ 2
2045
+ """
2046
+ if not self._degree:
2047
+ return '1'
2048
+ from sage.misc.latex import latex
2049
+ B = self._rep.basis()
2050
+ return " ".join(latex(B[self._basis_order[i]]) if e == 1 else latex(B[self._basis_order[i]]) + f"^{{{e}}}"
2051
+ for i, e in enumerate(m) if e)
2052
+
2053
+ def _from_repr_to_sym(self, elt):
2054
+ r"""
2055
+ Return the element ``elt`` from the defining representation
2056
+ to the corresponding exterior algebra.
2057
+
2058
+ EXAMPLES::
2059
+
2060
+ sage: G = groups.matrix.GL(2, 2)
2061
+ sage: L = G.regular_representation(side='left')
2062
+ sage: S3L = L.symmetric_power(3)
2063
+ sage: S3L._from_repr_to_sym(sum(i*b for i,b in enumerate(L.basis(), start=1)))
2064
+ e0 + 2*e1 + 3*e2 + 4*e3 + 5*e4 + 6*e5
2065
+ """
2066
+ return self._symalg.sum(c * self._inv_map[k]
2067
+ for k, c in elt._monomial_coefficients.items())
2068
+
2069
+ def _semigroup_action(self, g, vec, vec_on_left):
2070
+ r"""
2071
+ Return the action of the semigroup element ``g`` on the
2072
+ vector ``vec`` of ``self``.
2073
+
2074
+ EXAMPLES::
2075
+
2076
+ sage: DC3 = groups.permutation.DiCyclic(3)
2077
+ sage: g = DC3.an_element(); g
2078
+ (1,4,2,3)(5,6)
2079
+ sage: R = DC3.regular_representation(side='right')
2080
+ sage: S2L = R.symmetric_power(2)
2081
+ sage: vec = S2L.an_element(); vec
2082
+ 3*()*(5,7,6) + 2*()*(5,6,7) + 2*()^2
2083
+ sage: S2L._semigroup_action(g, vec, True)
2084
+ 3*(1,4,2,3)(5,6)*(1,4,2,3)(5,7) + 2*(1,4,2,3)(5,6)^2
2085
+ + 2*(1,4,2,3)(6,7)*(1,4,2,3)(5,6)
2086
+ sage: S2L._semigroup_action(g, vec, False)
2087
+ 3*(1,3,2,4)(5,6)*(1,3,2,4)(5,7) + 2*(1,3,2,4)(5,6)^2
2088
+ + 2*(1,3,2,4)(6,7)*(1,3,2,4)(5,6)
2089
+ """
2090
+ return self.linear_combination(((self._action_on_basis(g, b, vec_on_left), c)
2091
+ for b, c in vec._monomial_coefficients.items()), not vec_on_left)
2092
+
2093
+ def _action_on_basis(self, g, b, vec_on_left):
2094
+ r"""
2095
+ Return the action of ``g`` on the basis element indexed by ``b``.
2096
+
2097
+ EXAMPLES::
2098
+
2099
+ sage: S3 = SymmetricGroup(3)
2100
+ sage: g = S3.an_element(); g
2101
+ (2,3)
2102
+ sage: L = S3.regular_representation(side='left')
2103
+ sage: S2L = L.symmetric_power(2)
2104
+ sage: vec = S2L.an_element(); vec
2105
+ 3*()*(1,2,3) + 2*()*(1,3,2) + 2*()^2
2106
+ sage: g * vec
2107
+ 3*(2,3)*(1,2) + 2*(2,3)*(1,3) + 2*(2,3)^2
2108
+ sage: vec * g
2109
+ 3*(2,3)*(1,2) + 2*(2,3)*(1,3) + 2*(2,3)^2
2110
+ sage: supp = vec.leading_support(); supp
2111
+ [2, 0, 0, 0, 0, 0]
2112
+ sage: S2L._action_on_basis(g, supp, True)
2113
+ (2,3)^2
2114
+ sage: S2L._action_on_basis(g, supp, False)
2115
+ (2,3)^2
2116
+ """
2117
+ B = self._rep.basis()
2118
+ if vec_on_left:
2119
+ temp = self._symalg.prod(self._from_repr_to_sym(B[self._basis_order[bk]] * g) ** e
2120
+ for bk, e in enumerate(b))
2121
+ else:
2122
+ temp = self._symalg.prod(self._from_repr_to_sym(g * B[self._basis_order[bk]]) ** e
2123
+ for bk, e in enumerate(b))
2124
+ ind = self._indices
2125
+ data = {ind(mon.exponents()[0]): c for c, mon in temp}
2126
+ return self.element_class(self, data)
2127
+
2128
+
2129
+ class RegularRepresentation(Representation):
2130
+ r"""
2131
+ The regular representation of a semigroup.
2132
+
2133
+ The left regular representation of a semigroup `S` over a commutative
2134
+ ring `R` is the semigroup ring `R[S]` equipped with the left
2135
+ `S`-action `x b_y = b_{xy}`, where `(b_z)_{z \in S}` is the natural
2136
+ basis of `R[S]` and `x,y \in S`.
2137
+
2138
+ INPUT:
2139
+
2140
+ - ``semigroup`` -- a semigroup
2141
+ - ``base_ring`` -- the base ring for the representation
2142
+ - ``side`` -- (default: ``'left'``) whether this is a
2143
+ ``'left'`` or ``'right'`` representation
2144
+
2145
+ REFERENCES:
2146
+
2147
+ - :wikipedia:`Regular_representation`
2148
+ """
2149
+ def __init__(self, semigroup, base_ring, side='left'):
2150
+ """
2151
+ Initialize ``self``.
2152
+
2153
+ EXAMPLES::
2154
+
2155
+ sage: G = groups.permutation.Dihedral(4)
2156
+ sage: R = G.regular_representation()
2157
+ sage: TestSuite(R).run()
2158
+ """
2159
+ if side == "left":
2160
+ on_basis = self._left_on_basis
2161
+ else:
2162
+ on_basis = self._right_on_basis
2163
+ module = semigroup.algebra(base_ring)
2164
+ Representation.__init__(self, semigroup, module, on_basis, side)
2165
+
2166
+ def _repr_(self):
2167
+ """
2168
+ Return a string representation of ``self``.
2169
+
2170
+ EXAMPLES::
2171
+
2172
+ sage: G = groups.permutation.Dihedral(4)
2173
+ sage: G.regular_representation()
2174
+ Left Regular Representation of Dihedral group of order 8
2175
+ as a permutation group over Integer Ring
2176
+ sage: G.regular_representation(side='right')
2177
+ Right Regular Representation of Dihedral group of order 8
2178
+ as a permutation group over Integer Ring
2179
+ """
2180
+ if self._left_repr:
2181
+ base = "Left Regular Representation"
2182
+ else:
2183
+ base = "Right Regular Representation"
2184
+ return base + " of {} over {}".format(self._semigroup, self.base_ring())
2185
+
2186
+ def _left_on_basis(self, g, m):
2187
+ """
2188
+ Return the left action of ``g`` on ``m``.
2189
+
2190
+ EXAMPLES::
2191
+
2192
+ sage: G = groups.permutation.Dihedral(4)
2193
+ sage: R = G.regular_representation()
2194
+ sage: R._test_representation() # indirect doctest
2195
+ """
2196
+ return self.monomial(g * m)
2197
+
2198
+ def _right_on_basis(self, g, m):
2199
+ """
2200
+ Return the right action of ``g`` on ``m``.
2201
+
2202
+ EXAMPLES::
2203
+
2204
+ sage: G = groups.permutation.Dihedral(4)
2205
+ sage: R = G.regular_representation(side='right')
2206
+ sage: R._test_representation() # indirect doctest
2207
+ """
2208
+ return self.monomial(m * g)
2209
+
2210
+
2211
+ class TrivialRepresentation(Representation_abstract, CombinatorialFreeModule):
2212
+ """
2213
+ The trivial representation of a semigroup.
2214
+
2215
+ The trivial representation of a semigroup `S` over a commutative ring
2216
+ `R` is the `1`-dimensional `R`-module on which every element of `S`
2217
+ acts by the identity.
2218
+
2219
+ This is simultaneously a left and right representation.
2220
+
2221
+ INPUT:
2222
+
2223
+ - ``semigroup`` -- a semigroup
2224
+ - ``base_ring`` -- the base ring for the representation
2225
+
2226
+ REFERENCES:
2227
+
2228
+ - :wikipedia:`Trivial_representation`
2229
+ """
2230
+ def __init__(self, semigroup, base_ring):
2231
+ """
2232
+ Initialize ``self``.
2233
+
2234
+ EXAMPLES::
2235
+
2236
+ sage: G = groups.permutation.PGL(2, 3)
2237
+ sage: V = G.trivial_representation()
2238
+ sage: TestSuite(V).run()
2239
+ """
2240
+ cat = Modules(base_ring).WithBasis().FiniteDimensional()
2241
+ from sage.sets.finite_enumerated_set import FiniteEnumeratedSet
2242
+ indices = FiniteEnumeratedSet(['v'])
2243
+ CombinatorialFreeModule.__init__(self, base_ring, indices, category=cat)
2244
+ Representation_abstract.__init__(self, semigroup, "twosided")
2245
+
2246
+ def _repr_(self):
2247
+ """
2248
+ Return a string representation of ``self``.
2249
+
2250
+ EXAMPLES::
2251
+
2252
+ sage: G = groups.permutation.Dihedral(4)
2253
+ sage: G.trivial_representation()
2254
+ Trivial representation of Dihedral group of order 8
2255
+ as a permutation group over Integer Ring
2256
+ """
2257
+ return "Trivial representation of {} over {}".format(self._semigroup,
2258
+ self.base_ring())
2259
+
2260
+ def _semigroup_action(self, g, vec, vec_on_left):
2261
+ r"""
2262
+ Return the action of the semigroup element ``g`` on the
2263
+ vector ``vec`` of ``self``.
2264
+
2265
+ EXAMPLES::
2266
+
2267
+ sage: SGA = SymmetricGroupAlgebra(QQ, 4)
2268
+ sage: V = SGA.trivial_representation()
2269
+ sage: x = V.an_element()
2270
+ sage: V._semigroup_action(SGA.group().random_element(), x, True) == x
2271
+ True
2272
+ """
2273
+ return vec
2274
+
2275
+ class Element(Representation_abstract.Element):
2276
+ def _acted_upon_(self, scalar, self_on_left=False):
2277
+ """
2278
+ Return the action of ``scalar`` on ``self``.
2279
+
2280
+ EXAMPLES::
2281
+
2282
+ sage: SGA = SymmetricGroupAlgebra(QQ, 3)
2283
+ sage: V = SGA.trivial_representation()
2284
+ sage: x = V.an_element()
2285
+ sage: 2 * x
2286
+ 4*B['v']
2287
+ sage: all(x * b == x for b in SGA.basis())
2288
+ True
2289
+ sage: all(b * x == x for b in SGA.basis())
2290
+ True
2291
+ sage: z = V.zero()
2292
+ sage: all(b * z == z for b in SGA.basis())
2293
+ True
2294
+
2295
+ sage: H = groups.permutation.Dihedral(5)
2296
+ sage: G = SymmetricGroup(5)
2297
+ sage: G.has_coerce_map_from(H)
2298
+ True
2299
+ sage: R = G.trivial_representation(QQ)
2300
+ sage: H.an_element() * R.an_element()
2301
+ 2*B['v']
2302
+
2303
+ sage: AG = G.algebra(QQ)
2304
+ sage: AG.an_element() * R.an_element()
2305
+ 14*B['v']
2306
+
2307
+ sage: AH = H.algebra(ZZ)
2308
+ sage: AG.has_coerce_map_from(AH)
2309
+ True
2310
+ sage: AH.an_element() * R.an_element()
2311
+ 14*B['v']
2312
+ """
2313
+ if isinstance(scalar, Element):
2314
+ P = self.parent()
2315
+ if P._semigroup.has_coerce_map_from(scalar.parent()):
2316
+ return self
2317
+ if P._semigroup_algebra.has_coerce_map_from(scalar.parent()):
2318
+ if not self:
2319
+ return self
2320
+ scalar = P._semigroup_algebra(scalar)
2321
+ d = self.monomial_coefficients(copy=True)
2322
+ d['v'] *= sum(scalar.coefficients())
2323
+ return P._from_dict(d)
2324
+ return CombinatorialFreeModule.Element._acted_upon_(self, scalar, self_on_left)
2325
+
2326
+
2327
+ class SignRepresentation_abstract(Representation_abstract, CombinatorialFreeModule):
2328
+ """
2329
+ Generic implementation of a sign representation.
2330
+
2331
+ The sign representation of a semigroup `S` over a commutative ring
2332
+ `R` is the `1`-dimensional `R`-module on which every element of `S`
2333
+ acts by `1` if order of element is even (including 0) or `-1` if
2334
+ order of element if odd.
2335
+
2336
+ This is simultaneously a left and right representation.
2337
+
2338
+ INPUT:
2339
+
2340
+ - ``permgroup`` -- a permgroup
2341
+ - ``base_ring`` -- the base ring for the representation
2342
+ - ``sign_function`` -- a function which returns `1` or `-1` depending
2343
+ on the elements sign
2344
+
2345
+ REFERENCES:
2346
+
2347
+ - :wikipedia:`Representation_theory_of_the_symmetric_group`
2348
+ """
2349
+ def __init__(self, group, base_ring, sign_function=None):
2350
+ """
2351
+ Initialize ``self``.
2352
+
2353
+ EXAMPLES::
2354
+
2355
+ sage: G = groups.permutation.PGL(2, 3)
2356
+ sage: V = G.sign_representation()
2357
+ sage: TestSuite(V).run()
2358
+ """
2359
+ self.sign_function = sign_function
2360
+ if sign_function is None:
2361
+ try:
2362
+ self.sign_function = self._default_sign
2363
+ except AttributeError:
2364
+ raise TypeError("a sign function must be given")
2365
+
2366
+ cat = Modules(base_ring).WithBasis().FiniteDimensional()
2367
+
2368
+ CombinatorialFreeModule.__init__(self, base_ring, ["v"], category=cat)
2369
+ Representation_abstract.__init__(self, group, "twosided")
2370
+
2371
+ def _repr_(self):
2372
+ """
2373
+ Return a string representation of ``self``.
2374
+
2375
+ EXAMPLES::
2376
+
2377
+ sage: G = groups.permutation.Dihedral(4)
2378
+ sage: G.sign_representation()
2379
+ Sign representation of Dihedral group of order 8
2380
+ as a permutation group over Integer Ring
2381
+ """
2382
+ return "Sign representation of {} over {}".format(
2383
+ self._semigroup, self.base_ring()
2384
+ )
2385
+
2386
+ def _semigroup_action(self, g, vec, vec_on_left):
2387
+ r"""
2388
+ Return the action of the semigroup element ``g`` on the
2389
+ vector ``vec`` of ``self``.
2390
+
2391
+ EXAMPLES::
2392
+
2393
+ sage: G = PermutationGroup(gens=[(1,2,3), (1,2)])
2394
+ sage: S = G.sign_representation()
2395
+ sage: x = S.an_element(); x
2396
+ 2*B['v']
2397
+ sage: s, c = G.gens(); c
2398
+ (1,2,3)
2399
+ sage: S._semigroup_action(s, x, True)
2400
+ -2*B['v']
2401
+ sage: S._semigroup_action(s, x, False)
2402
+ -2*B['v']
2403
+ sage: s * x
2404
+ -2*B['v']
2405
+ sage: s*x*s
2406
+ 2*B['v']
2407
+ sage: s*x*s*s*c
2408
+ -2*B['v']
2409
+ sage: A = G.algebra(ZZ)
2410
+ sage: s,c = A.algebra_generators()
2411
+ sage: c
2412
+ (1,2,3)
2413
+ sage: s
2414
+ (1,2)
2415
+ sage: c*x
2416
+ 2*B['v']
2417
+ sage: c*c*x
2418
+ 2*B['v']
2419
+ sage: c*x*s
2420
+ -2*B['v']
2421
+ sage: c*x*s*s
2422
+ 2*B['v']
2423
+ sage: (c+s)*x
2424
+ 0
2425
+ sage: (c-s)*x
2426
+ 4*B['v']
2427
+
2428
+ sage: H = groups.permutation.Dihedral(4)
2429
+ sage: G = SymmetricGroup(4)
2430
+ sage: G.has_coerce_map_from(H)
2431
+ True
2432
+ sage: R = G.sign_representation()
2433
+ sage: H.an_element() * R.an_element()
2434
+ -2*B['v']
2435
+
2436
+ sage: AG = G.algebra(ZZ)
2437
+ sage: AH = H.algebra(ZZ)
2438
+ sage: AG.has_coerce_map_from(AH)
2439
+ True
2440
+ sage: AH.an_element() * R.an_element()
2441
+ -2*B['v']
2442
+ """
2443
+ return vec if self.sign_function(g) > 0 else -vec
2444
+
2445
+
2446
+ class SignRepresentationPermgroup(SignRepresentation_abstract):
2447
+ """
2448
+ The sign representation for a permutation group.
2449
+
2450
+ EXAMPLES::
2451
+
2452
+ sage: G = groups.permutation.PGL(2, 3)
2453
+ sage: V = G.sign_representation()
2454
+ sage: TestSuite(V).run()
2455
+ """
2456
+ def _default_sign(self, elem):
2457
+ """
2458
+ Return the sign of the element.
2459
+
2460
+ INPUT:
2461
+
2462
+ - ``elem`` -- the element of the group
2463
+
2464
+ EXAMPLES::
2465
+
2466
+ sage: G = groups.permutation.PGL(2, 3)
2467
+ sage: V = G.sign_representation()
2468
+ sage: elem = G.an_element()
2469
+ sage: elem
2470
+ (1,2,4,3)
2471
+ sage: V._default_sign(elem)
2472
+ -1
2473
+ """
2474
+ return elem.sign()
2475
+
2476
+
2477
+ class SignRepresentationMatrixGroup(SignRepresentation_abstract):
2478
+ """
2479
+ The sign representation for a matrix group.
2480
+
2481
+ EXAMPLES::
2482
+
2483
+ sage: G = groups.permutation.PGL(2, 3)
2484
+ sage: V = G.sign_representation()
2485
+ sage: TestSuite(V).run()
2486
+ """
2487
+ def _default_sign(self, elem):
2488
+ """
2489
+ Return the sign of the element.
2490
+
2491
+ INPUT:
2492
+
2493
+ - ``elem`` -- the element of the group
2494
+
2495
+ EXAMPLES::
2496
+
2497
+ sage: G = GL(2, QQ)
2498
+ sage: V = G.sign_representation()
2499
+ sage: m = G.an_element()
2500
+ sage: m
2501
+ [1 0]
2502
+ [0 1]
2503
+ sage: V._default_sign(m)
2504
+ 1
2505
+ """
2506
+ return 1 if elem.matrix().det() > 0 else -1
2507
+
2508
+
2509
+ class SignRepresentationCoxeterGroup(SignRepresentation_abstract):
2510
+ r"""
2511
+ The sign representation for a Coxeter group.
2512
+
2513
+ EXAMPLES::
2514
+
2515
+ sage: G = WeylGroup(["A", 1, 1])
2516
+ sage: V = G.sign_representation()
2517
+ sage: TestSuite(V).run()
2518
+
2519
+ sage: # optional - gap3
2520
+ sage: W = CoxeterGroup(['B', 3], implementation="coxeter3")
2521
+ sage: S = W.sign_representation()
2522
+ sage: TestSuite(S).run()
2523
+ """
2524
+ def _default_sign(self, elem):
2525
+ """
2526
+ Return the sign of the element.
2527
+
2528
+ INPUT:
2529
+
2530
+ - ``elem`` -- the element of the group
2531
+
2532
+ EXAMPLES::
2533
+
2534
+ sage: G = WeylGroup(["A", 1, 1])
2535
+ sage: elem = G.an_element()
2536
+ sage: V = G.sign_representation()
2537
+ sage: V._default_sign(elem)
2538
+ 1
2539
+
2540
+ sage: # optional - gap3
2541
+ sage: W = CoxeterGroup(['B', 3], implementation="coxeter3")
2542
+ sage: S = W.sign_representation()
2543
+ sage: elem = W.an_element()
2544
+ sage: S._default_sign(elem)
2545
+ 1
2546
+ """
2547
+ return -1 if elem.length() % 2 else 1
2548
+
2549
+
2550
+ class ReflectionRepresentation(Representation_abstract, CombinatorialFreeModule):
2551
+ r"""
2552
+ The reflection representation of a Coxeter group.
2553
+
2554
+ This is the canonical faithful representation of a Coxeter group.
2555
+
2556
+ EXAMPLES::
2557
+
2558
+ sage: W = CoxeterGroup(['B', 4])
2559
+ sage: R = W.reflection_representation()
2560
+ sage: all(g.matrix() == R.representation_matrix(g) for g in W)
2561
+ True
2562
+ """
2563
+ @staticmethod
2564
+ def __classcall_private__(cls, W, base_ring=None):
2565
+ r"""
2566
+ Normalize input to ensure a unique representation.
2567
+
2568
+ EXAMPLES::
2569
+
2570
+ sage: W = CoxeterGroup(['D', 4])
2571
+ sage: R1 = W.reflection_representation()
2572
+ sage: R2 = W.reflection_representation(ZZ)
2573
+ sage: R1 is R2
2574
+ True
2575
+ """
2576
+ if base_ring is None:
2577
+ base_ring = W.one().canonical_matrix().base_ring()
2578
+ return super().__classcall__(cls, W, base_ring)
2579
+
2580
+ def __init__(self, W, base_ring):
2581
+ r"""
2582
+ Initialize ``self``.
2583
+
2584
+ EXAMPLES::
2585
+
2586
+ sage: W = CoxeterGroup(['C', 3])
2587
+ sage: R = W.reflection_representation()
2588
+ sage: TestSuite(R).run()
2589
+
2590
+ sage: W = CoxeterGroup(['E', 6, 1])
2591
+ sage: R = W.reflection_representation()
2592
+ sage: TestSuite(R).run()
2593
+ """
2594
+ self._W = W
2595
+ rk = W.coxeter_matrix().rank()
2596
+ from sage.sets.finite_enumerated_set import FiniteEnumeratedSet
2597
+ indices = FiniteEnumeratedSet(range(rk))
2598
+ CombinatorialFreeModule.__init__(self, base_ring, indices, prefix='e', bracket=False)
2599
+ Representation_abstract.__init__(self, W, "left")
2600
+
2601
+ def _repr_(self):
2602
+ r"""
2603
+ Return a string representation of ``self``.
2604
+
2605
+ EXAMPLES::
2606
+
2607
+ sage: W = CoxeterGroup(['E', 8])
2608
+ sage: W.reflection_representation()
2609
+ Reflection representation of Finite Coxeter group over Integer Ring with Coxeter matrix:
2610
+ [1 2 3 2 2 2 2 2]
2611
+ [2 1 2 3 2 2 2 2]
2612
+ [3 2 1 3 2 2 2 2]
2613
+ [2 3 3 1 3 2 2 2]
2614
+ [2 2 2 3 1 3 2 2]
2615
+ [2 2 2 2 3 1 3 2]
2616
+ [2 2 2 2 2 3 1 3]
2617
+ [2 2 2 2 2 2 3 1]
2618
+ """
2619
+ return "Reflection representation of {}".format(self._W)
2620
+
2621
+ def _semigroup_action(self, g, vec, vec_on_left):
2622
+ r"""
2623
+ Return the action of the Coxeter group element ``g`` on the
2624
+ vector ``vec`` of ``self``.
2625
+
2626
+ EXAMPLES::
2627
+
2628
+ sage: W = CoxeterGroup(['E', 8])
2629
+ sage: R = W.reflection_representation()
2630
+ sage: g = W.an_element()
2631
+ sage: g == ~g
2632
+ False
2633
+ sage: vec = R.an_element()
2634
+ sage: R._semigroup_action(g, vec, True)
2635
+ e0 - 2*e1 - 2*e2 - 4*e3 - 4*e4 - 4*e5 - 4*e6 - 4*e7
2636
+ sage: R._semigroup_action(g, vec, False)
2637
+ 2*e0 + 3*e1 + 4*e2 + 5*e3
2638
+ """
2639
+ if vec_on_left:
2640
+ g = ~g
2641
+ return self.from_vector(g.canonical_matrix() * vec.to_vector())
2642
+
2643
+
2644
+ class NaturalMatrixRepresentation(Representation):
2645
+ r"""
2646
+ The natural representation of a matrix semigroup.
2647
+
2648
+ A matrix semigroup is defined by its representation on a (finite
2649
+ dimensional) vector space `V`, which is called the *natural
2650
+ representation*.
2651
+
2652
+ INPUT:
2653
+
2654
+ - ``matrix_semigroup`` -- a matrix semigroup
2655
+ - ``base_ring`` -- (optional) the base ring; the default is the base ring
2656
+ of the semigroup
2657
+ """
2658
+ @staticmethod
2659
+ def __classcall_private__(cls, semigroup, base_ring=None):
2660
+ r"""
2661
+ Normalize input to ensure a unique representation.
2662
+
2663
+ EXAMPLES::
2664
+
2665
+ sage: G = groups.matrix.SO(5, 2)
2666
+ sage: N1 = G.natural_representation()
2667
+ sage: N2 = G.natural_representation(GF(2))
2668
+ sage: N1 is N2
2669
+ True
2670
+ """
2671
+ if base_ring is None:
2672
+ base_ring = semigroup.base_ring()
2673
+ return super().__classcall__(cls, semigroup, base_ring)
2674
+
2675
+ def __init__(self, semigroup, base_ring):
2676
+ r"""
2677
+ Initialize ``self``.
2678
+
2679
+ EXAMPLES::
2680
+
2681
+ sage: G = groups.matrix.SU(2, 2)
2682
+ sage: N = G.natural_representation()
2683
+ sage: TestSuite(N).run()
2684
+
2685
+ sage: G = groups.matrix.Sp(4, 2)
2686
+ sage: N = G.natural_representation()
2687
+ sage: TestSuite(N).run() # long time
2688
+ """
2689
+ base_ring = semigroup.base_ring()
2690
+ n = semigroup.degree()
2691
+ module = CombinatorialFreeModule(base_ring, list(range(n)), prefix='e')
2692
+ Representation.__init__(self, semigroup, module, None, "left")
2693
+
2694
+ def _repr_(self):
2695
+ r"""
2696
+ Return a string representation of ``self``.
2697
+
2698
+ EXAMPLES::
2699
+
2700
+ sage: G = groups.matrix.GL(3, 2)
2701
+ sage: G.natural_representation()
2702
+ Natural representation of General Linear Group of degree 3
2703
+ over Finite Field of size 2
2704
+ """
2705
+ return "Natural representation of {}".format(self._semigroup)
2706
+
2707
+ def _latex_(self):
2708
+ r"""
2709
+ Return a latex representation of ``self``.
2710
+
2711
+ EXAMPLES::
2712
+
2713
+ sage: G = groups.matrix.GL(3, 2)
2714
+ sage: latex(G.natural_representation())
2715
+ \Bold{F}_{2} ^{3}
2716
+ """
2717
+ from sage.misc.latex import latex
2718
+ return latex(self.base_ring()) + "^{{{}}}".format(self.dimension())
2719
+
2720
+ def _semigroup_action(self, g, vec, vec_on_left):
2721
+ r"""
2722
+ Return the action of the semigroup element ``g`` on the
2723
+ vector ``vec`` of ``self``.
2724
+
2725
+ EXAMPLES::
2726
+
2727
+ sage: G = groups.matrix.SL(2, 3)
2728
+ sage: N = G.natural_representation()
2729
+ sage: N._test_representation() # indirect doctest
2730
+ """
2731
+ if self._left_repr == vec_on_left:
2732
+ g = ~g
2733
+ # TODO: currently, the slowest part is getting the matrix from g
2734
+ return self.from_vector(g.matrix() * vec.to_vector())
2735
+
2736
+
2737
+ class SchurFunctorRepresentation(Subrepresentation):
2738
+ r"""
2739
+ The representation constructed by the Schur functor.
2740
+
2741
+ Let `G` be a semigroup and let `V` be a representation of `G`. The
2742
+ *Schur functor* for a partition `\lambda` of size `k` is the functor
2743
+ `\mathbb{S}_{\lambda}` that sends `V` to the `G`-subrepresentation of
2744
+ `V^{\otimes k}` spanned by `(v_1 \otimes \cdots \otimes v_k) c_{\lambda}`,
2745
+ where `c_{\lambda}` is the :meth:`Young symmetrizer
2746
+ <sage.combinat.symmetric_group_algebra.SymmetricGroupAlgebra.young_symmetrizer>`
2747
+ corresponding to `\lambda`. When `G = GL_n(F)`, the Schur functor image
2748
+ `\mathbb{S}_{\lambda} F^n` is the (irreducible when `F` has characteristic
2749
+ `0`) highest representation of shape `\lambda`.
2750
+
2751
+ EXAMPLES::
2752
+
2753
+ sage: G = groups.permutation.Dihedral(3)
2754
+ sage: V = G.regular_representation()
2755
+ sage: S21V = V.schur_functor([2, 1])
2756
+ sage: S21V.dimension()
2757
+ 70
2758
+ sage: SemistandardTableaux([2,1], max_entry=V.dimension()).cardinality()
2759
+ 70
2760
+ sage: chi = G.character([S21V.representation_matrix(g).trace()
2761
+ ....: for g in G.conjugacy_classes_representatives()])
2762
+ sage: chi.values()
2763
+ [70, 0, -2]
2764
+ sage: G.character_table()
2765
+ [ 1 -1 1]
2766
+ [ 2 0 -1]
2767
+ [ 1 1 1]
2768
+ sage: for m, phi in chi.decompose():
2769
+ ....: print(m, phi.values())
2770
+ 11 [1, -1, 1]
2771
+ 11 [1, 1, 1]
2772
+ 24 [2, 0, -1]
2773
+
2774
+ sage: # long time
2775
+ sage: S211V = V.schur_functor([2, 1, 1])
2776
+ sage: S211V.dimension()
2777
+ 105
2778
+ sage: SemistandardTableaux([2, 1, 1], max_entry=V.dimension()).cardinality()
2779
+ 105
2780
+ sage: chi = G.character([S211V.representation_matrix(g).trace()
2781
+ ....: for g in G.conjugacy_classes_representatives()])
2782
+ sage: chi.values()
2783
+ [105, -3, 0]
2784
+ sage: for m, phi in chi.decompose():
2785
+ ....: print(m, phi.values())
2786
+ 19 [1, -1, 1]
2787
+ 16 [1, 1, 1]
2788
+ 35 [2, 0, -1]
2789
+
2790
+ An example with the cyclic group::
2791
+
2792
+ sage: C3 = groups.permutation.Cyclic(3)
2793
+ sage: V3 = C3.regular_representation()
2794
+ sage: S31V3 = V3.schur_functor([3, 1])
2795
+ sage: S31V3.dimension()
2796
+ 15
2797
+ sage: chi = C3.character([S31V3.representation_matrix(g).trace()
2798
+ ....: for g in C3.conjugacy_classes_representatives()])
2799
+ sage: chi.values()
2800
+ [15, 0, 0]
2801
+ sage: C3.character_table()
2802
+ [ 1 1 1]
2803
+ [ 1 zeta3 -zeta3 - 1]
2804
+ [ 1 -zeta3 - 1 zeta3]
2805
+ sage: for m, phi in chi.decompose():
2806
+ ....: print(m, phi.values())
2807
+ 5 [1, 1, 1]
2808
+ 5 [1, -zeta3 - 1, zeta3]
2809
+ 5 [1, zeta3, -zeta3 - 1]
2810
+
2811
+ An example of `GL_3(\GF{2})`::
2812
+
2813
+ sage: G = groups.matrix.GL(3, 2)
2814
+ sage: from sage.modules.with_basis.representation import Representation
2815
+ sage: N = G.natural_representation()
2816
+ sage: S21N = N.schur_functor([2, 1])
2817
+ sage: S21N.dimension()
2818
+ 8
2819
+
2820
+ An example with the Weyl/Coxeter group of type `C_3`::
2821
+
2822
+ sage: G = WeylGroup(['C', 3], prefix='s')
2823
+ sage: R = G.reflection_representation()
2824
+ sage: S = R.schur_functor([3, 2, 1])
2825
+ sage: g = G.an_element(); g
2826
+ s1*s2*s3
2827
+ sage: v = S.an_element(); v
2828
+ 2*S[0] + 2*S[1] + 3*S[2]
2829
+ sage: v * g
2830
+ -(2*a+1)*S[0] - (a+2)*S[1] - (2*a-2)*S[2] + (2*a-2)*S[3]
2831
+ - (-2*a+4)*S[4] + (-2*a+4)*S[5] + 2*S[6] + 2*a*S[7]
2832
+ sage: g * v
2833
+ 3*S[0] + (-2*a+5)*S[2] + 3*a*S[4] - (5*a-2)*S[6] - 6*S[7]
2834
+ """
2835
+ @staticmethod
2836
+ def __classcall_private__(cls, V, shape):
2837
+ r"""
2838
+ Normalize input to ensure a unique representation.
2839
+
2840
+ EXAMPLES::
2841
+
2842
+ sage: from sage.modules.with_basis.representation import SchurFunctorRepresentation
2843
+ sage: G = groups.permutation.Cyclic(3)
2844
+ sage: V = G.regular_representation()
2845
+ sage: S1 = SchurFunctorRepresentation(V, Partition([2, 1, 1]))
2846
+ sage: S2 = SchurFunctorRepresentation(V, (2, 1, 1))
2847
+ sage: S1 is S2
2848
+ True
2849
+ """
2850
+ from sage.combinat.partition import _Partitions
2851
+ return super().__classcall__(cls, V, _Partitions(shape))
2852
+
2853
+ def __init__(self, V, shape):
2854
+ r"""
2855
+ Initialize ``self``.
2856
+
2857
+ INPUT:
2858
+
2859
+ - ``V`` -- a representation
2860
+ - ``shape`` -- a partition
2861
+
2862
+ EXAMPLES::
2863
+
2864
+ sage: G = groups.permutation.Dihedral(3)
2865
+ sage: V = G.regular_representation()
2866
+ sage: S = V.schur_functor([2, 1])
2867
+ sage: TestSuite(S).run()
2868
+
2869
+ sage: G = CoxeterGroup(['B', 3])
2870
+ sage: R = G.reflection_representation()
2871
+ sage: S = R.schur_functor([3, 2, 1])
2872
+ sage: TestSuite(S).run()
2873
+
2874
+ sage: G = groups.matrix.GL(3, 2)
2875
+ sage: N = G.natural_representation()
2876
+ sage: S = N.schur_functor([2, 1])
2877
+ sage: TestSuite(S).run()
2878
+ """
2879
+ from sage.combinat.symmetric_group_algebra import SymmetricGroupAlgebra
2880
+ from sage.groups.perm_gps.permgroup_named import SymmetricGroup
2881
+ from sage.categories.tensor import tensor
2882
+
2883
+ R = V.base_ring()
2884
+ self._shape = shape
2885
+ self._module = V
2886
+ d = sum(shape)
2887
+
2888
+ if not isinstance(V, CombinatorialFreeModule):
2889
+ keys = list(range(V.dimension()))
2890
+ V = CombinatorialFreeModule(R, keys)
2891
+ else:
2892
+ keys = list(V.basis().keys())
2893
+
2894
+ ambient = tensor([V]*d)
2895
+ cla = SymmetricGroupAlgebra(R, SymmetricGroup(d)).young_symmetrizer(shape)
2896
+ mc = cla.monomial_coefficients(copy=False)
2897
+ gens = [ambient.sum_of_terms((tuple([k[i-1] for i in p.tuple()]), coeff)
2898
+ for p, coeff in mc.items())
2899
+ for k in ambient.basis().keys()]
2900
+ support_order = ambient._compute_support_order(gens, None)
2901
+ from sage.sets.family import Family
2902
+ gens = Family(ambient.echelon_form(gens, order=support_order))
2903
+ cat = Modules(ambient.category().base_ring()).WithBasis().Subobjects()
2904
+ Subrepresentation.__init__(self, gens, support_order, ambient, unitriangular=False, category=cat, prefix='S')
2905
+
2906
+ def _repr_(self):
2907
+ r"""
2908
+ Return a string representation of ``self``.
2909
+
2910
+ EXAMPLES::
2911
+
2912
+ sage: G = groups.matrix.GL(4, 2)
2913
+ sage: N = G.natural_representation()
2914
+ sage: N.schur_functor([2, 1])
2915
+ Schur functor of shape [2, 1] image of Natural representation of
2916
+ General Linear Group of degree 4 over Finite Field of size 2
2917
+ """
2918
+ return "Schur functor of shape {} image of {}".format(self._shape, self._module)
2919
+
2920
+ def _latex_(self):
2921
+ r"""
2922
+ Return a latex representation of ``self``.
2923
+
2924
+ EXAMPLES::
2925
+
2926
+ sage: G = groups.matrix.GL(4, 2)
2927
+ sage: N = G.natural_representation()
2928
+ sage: latex(N.schur_functor([2, 1]))
2929
+ \mathbb{S}_{{\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}}
2930
+ \raisebox{-.6ex}{$\begin{array}[b]{*{2}c}\cline{1-2}
2931
+ \lr{\phantom{x}}&\lr{\phantom{x}}\\\cline{1-2}
2932
+ \lr{\phantom{x}}\\\cline{1-1}
2933
+ \end{array}$}
2934
+ }}(\Bold{F}_{2} ^{4})
2935
+ """
2936
+ from sage.misc.latex import latex
2937
+ return "\\mathbb{{S}}_{{{}}}({})".format(latex(self._shape), latex(self._module))
2938
+
2939
+ Element = Subrepresentation.Element