passagemath-combinat 10.6.42__cp314-cp314-musllinux_1_2_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.
Files changed (400) hide show
  1. passagemath_combinat/__init__.py +3 -0
  2. passagemath_combinat-10.6.42.dist-info/METADATA +160 -0
  3. passagemath_combinat-10.6.42.dist-info/RECORD +400 -0
  4. passagemath_combinat-10.6.42.dist-info/WHEEL +5 -0
  5. passagemath_combinat-10.6.42.dist-info/top_level.txt +3 -0
  6. passagemath_combinat.libs/libgmp-0e7fc84e.so.10.5.0 +0 -0
  7. passagemath_combinat.libs/libsymmetrica-81fe8739.so.3.0.0 +0 -0
  8. sage/algebras/affine_nil_temperley_lieb.py +263 -0
  9. sage/algebras/all.py +24 -0
  10. sage/algebras/all__sagemath_combinat.py +35 -0
  11. sage/algebras/askey_wilson.py +935 -0
  12. sage/algebras/associated_graded.py +345 -0
  13. sage/algebras/cellular_basis.py +350 -0
  14. sage/algebras/cluster_algebra.py +2766 -0
  15. sage/algebras/down_up_algebra.py +860 -0
  16. sage/algebras/free_algebra.py +1698 -0
  17. sage/algebras/free_algebra_element.py +345 -0
  18. sage/algebras/free_algebra_quotient.py +405 -0
  19. sage/algebras/free_algebra_quotient_element.py +295 -0
  20. sage/algebras/free_zinbiel_algebra.py +885 -0
  21. sage/algebras/hall_algebra.py +783 -0
  22. sage/algebras/hecke_algebras/all.py +4 -0
  23. sage/algebras/hecke_algebras/ariki_koike_algebra.py +1796 -0
  24. sage/algebras/hecke_algebras/ariki_koike_specht_modules.py +475 -0
  25. sage/algebras/hecke_algebras/cubic_hecke_algebra.py +3520 -0
  26. sage/algebras/hecke_algebras/cubic_hecke_base_ring.py +1473 -0
  27. sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py +1079 -0
  28. sage/algebras/iwahori_hecke_algebra.py +3095 -0
  29. sage/algebras/jordan_algebra.py +1773 -0
  30. sage/algebras/lie_conformal_algebras/abelian_lie_conformal_algebra.py +113 -0
  31. sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py +156 -0
  32. sage/algebras/lie_conformal_algebras/all.py +18 -0
  33. sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py +134 -0
  34. sage/algebras/lie_conformal_algebras/examples.py +43 -0
  35. sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py +131 -0
  36. sage/algebras/lie_conformal_algebras/finitely_freely_generated_lca.py +139 -0
  37. sage/algebras/lie_conformal_algebras/free_bosons_lie_conformal_algebra.py +174 -0
  38. sage/algebras/lie_conformal_algebras/free_fermions_lie_conformal_algebra.py +167 -0
  39. sage/algebras/lie_conformal_algebras/freely_generated_lie_conformal_algebra.py +107 -0
  40. sage/algebras/lie_conformal_algebras/graded_lie_conformal_algebra.py +135 -0
  41. sage/algebras/lie_conformal_algebras/lie_conformal_algebra.py +353 -0
  42. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py +236 -0
  43. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_basis.py +78 -0
  44. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py +328 -0
  45. sage/algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py +117 -0
  46. sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py +86 -0
  47. sage/algebras/lie_conformal_algebras/virasoro_lie_conformal_algebra.py +82 -0
  48. sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py +205 -0
  49. sage/algebras/nil_coxeter_algebra.py +191 -0
  50. sage/algebras/q_commuting_polynomials.py +673 -0
  51. sage/algebras/q_system.py +608 -0
  52. sage/algebras/quantum_clifford.py +959 -0
  53. sage/algebras/quantum_groups/ace_quantum_onsager.py +693 -0
  54. sage/algebras/quantum_groups/all.py +9 -0
  55. sage/algebras/quantum_groups/fock_space.py +2219 -0
  56. sage/algebras/quantum_groups/q_numbers.py +207 -0
  57. sage/algebras/quantum_groups/quantum_group_gap.py +2695 -0
  58. sage/algebras/quantum_groups/representations.py +591 -0
  59. sage/algebras/quantum_matrix_coordinate_algebra.py +1006 -0
  60. sage/algebras/quantum_oscillator.py +623 -0
  61. sage/algebras/quaternion_algebra.py +20 -0
  62. sage/algebras/quaternion_algebra_element.py +55 -0
  63. sage/algebras/rational_cherednik_algebra.py +525 -0
  64. sage/algebras/schur_algebra.py +670 -0
  65. sage/algebras/shuffle_algebra.py +1011 -0
  66. sage/algebras/splitting_algebra.py +779 -0
  67. sage/algebras/tensor_algebra.py +709 -0
  68. sage/algebras/yangian.py +1082 -0
  69. sage/algebras/yokonuma_hecke_algebra.py +1018 -0
  70. sage/all__sagemath_combinat.py +35 -0
  71. sage/combinat/SJT.py +255 -0
  72. sage/combinat/affine_permutation.py +2405 -0
  73. sage/combinat/algebraic_combinatorics.py +55 -0
  74. sage/combinat/all.py +53 -0
  75. sage/combinat/all__sagemath_combinat.py +195 -0
  76. sage/combinat/alternating_sign_matrix.py +2063 -0
  77. sage/combinat/baxter_permutations.py +346 -0
  78. sage/combinat/bijectionist.py +3220 -0
  79. sage/combinat/binary_recurrence_sequences.py +1180 -0
  80. sage/combinat/blob_algebra.py +685 -0
  81. sage/combinat/catalog_partitions.py +27 -0
  82. sage/combinat/chas/all.py +23 -0
  83. sage/combinat/chas/fsym.py +1180 -0
  84. sage/combinat/chas/wqsym.py +2601 -0
  85. sage/combinat/cluster_complex.py +326 -0
  86. sage/combinat/colored_permutations.py +2039 -0
  87. sage/combinat/colored_permutations_representations.py +964 -0
  88. sage/combinat/composition_signed.py +142 -0
  89. sage/combinat/composition_tableau.py +855 -0
  90. sage/combinat/constellation.py +1729 -0
  91. sage/combinat/core.py +751 -0
  92. sage/combinat/counting.py +12 -0
  93. sage/combinat/crystals/affine.py +742 -0
  94. sage/combinat/crystals/affine_factorization.py +518 -0
  95. sage/combinat/crystals/affinization.py +331 -0
  96. sage/combinat/crystals/alcove_path.py +2013 -0
  97. sage/combinat/crystals/all.py +22 -0
  98. sage/combinat/crystals/bkk_crystals.py +141 -0
  99. sage/combinat/crystals/catalog.py +115 -0
  100. sage/combinat/crystals/catalog_elementary_crystals.py +18 -0
  101. sage/combinat/crystals/catalog_infinity_crystals.py +33 -0
  102. sage/combinat/crystals/catalog_kirillov_reshetikhin.py +18 -0
  103. sage/combinat/crystals/crystals.py +257 -0
  104. sage/combinat/crystals/direct_sum.py +260 -0
  105. sage/combinat/crystals/elementary_crystals.py +1251 -0
  106. sage/combinat/crystals/fast_crystals.py +441 -0
  107. sage/combinat/crystals/fully_commutative_stable_grothendieck.py +1205 -0
  108. sage/combinat/crystals/generalized_young_walls.py +1076 -0
  109. sage/combinat/crystals/highest_weight_crystals.py +436 -0
  110. sage/combinat/crystals/induced_structure.py +695 -0
  111. sage/combinat/crystals/infinity_crystals.py +730 -0
  112. sage/combinat/crystals/kac_modules.py +863 -0
  113. sage/combinat/crystals/kirillov_reshetikhin.py +4196 -0
  114. sage/combinat/crystals/kyoto_path_model.py +497 -0
  115. sage/combinat/crystals/letters.cpython-314-x86_64-linux-musl.so +0 -0
  116. sage/combinat/crystals/letters.pxd +79 -0
  117. sage/combinat/crystals/letters.pyx +3056 -0
  118. sage/combinat/crystals/littelmann_path.py +1518 -0
  119. sage/combinat/crystals/monomial_crystals.py +1262 -0
  120. sage/combinat/crystals/multisegments.py +462 -0
  121. sage/combinat/crystals/mv_polytopes.py +467 -0
  122. sage/combinat/crystals/pbw_crystal.py +511 -0
  123. sage/combinat/crystals/pbw_datum.cpython-314-x86_64-linux-musl.so +0 -0
  124. sage/combinat/crystals/pbw_datum.pxd +4 -0
  125. sage/combinat/crystals/pbw_datum.pyx +487 -0
  126. sage/combinat/crystals/polyhedral_realization.py +372 -0
  127. sage/combinat/crystals/spins.cpython-314-x86_64-linux-musl.so +0 -0
  128. sage/combinat/crystals/spins.pxd +21 -0
  129. sage/combinat/crystals/spins.pyx +756 -0
  130. sage/combinat/crystals/star_crystal.py +290 -0
  131. sage/combinat/crystals/subcrystal.py +464 -0
  132. sage/combinat/crystals/tensor_product.py +1177 -0
  133. sage/combinat/crystals/tensor_product_element.cpython-314-x86_64-linux-musl.so +0 -0
  134. sage/combinat/crystals/tensor_product_element.pxd +35 -0
  135. sage/combinat/crystals/tensor_product_element.pyx +1870 -0
  136. sage/combinat/crystals/virtual_crystal.py +420 -0
  137. sage/combinat/cyclic_sieving_phenomenon.py +204 -0
  138. sage/combinat/debruijn_sequence.cpython-314-x86_64-linux-musl.so +0 -0
  139. sage/combinat/debruijn_sequence.pyx +355 -0
  140. sage/combinat/decorated_permutation.py +270 -0
  141. sage/combinat/degree_sequences.cpython-314-x86_64-linux-musl.so +0 -0
  142. sage/combinat/degree_sequences.pyx +588 -0
  143. sage/combinat/derangements.py +527 -0
  144. sage/combinat/descent_algebra.py +1008 -0
  145. sage/combinat/diagram.py +1551 -0
  146. sage/combinat/diagram_algebras.py +5886 -0
  147. sage/combinat/dyck_word.py +4349 -0
  148. sage/combinat/e_one_star.py +1623 -0
  149. sage/combinat/enumerated_sets.py +123 -0
  150. sage/combinat/expnums.cpython-314-x86_64-linux-musl.so +0 -0
  151. sage/combinat/expnums.pyx +148 -0
  152. sage/combinat/fast_vector_partitions.cpython-314-x86_64-linux-musl.so +0 -0
  153. sage/combinat/fast_vector_partitions.pyx +346 -0
  154. sage/combinat/fqsym.py +1977 -0
  155. sage/combinat/free_dendriform_algebra.py +954 -0
  156. sage/combinat/free_prelie_algebra.py +1141 -0
  157. sage/combinat/fully_commutative_elements.py +1077 -0
  158. sage/combinat/fully_packed_loop.py +1523 -0
  159. sage/combinat/gelfand_tsetlin_patterns.py +1409 -0
  160. sage/combinat/gray_codes.py +311 -0
  161. sage/combinat/grossman_larson_algebras.py +667 -0
  162. sage/combinat/growth.py +4352 -0
  163. sage/combinat/hall_polynomial.py +188 -0
  164. sage/combinat/hillman_grassl.py +866 -0
  165. sage/combinat/integer_matrices.py +329 -0
  166. sage/combinat/integer_vectors_mod_permgroup.py +1238 -0
  167. sage/combinat/k_tableau.py +4564 -0
  168. sage/combinat/kazhdan_lusztig.py +215 -0
  169. sage/combinat/key_polynomial.py +885 -0
  170. sage/combinat/knutson_tao_puzzles.py +2286 -0
  171. sage/combinat/lr_tableau.py +311 -0
  172. sage/combinat/matrices/all.py +24 -0
  173. sage/combinat/matrices/hadamard_matrix.py +3790 -0
  174. sage/combinat/matrices/latin.py +2912 -0
  175. sage/combinat/misc.py +401 -0
  176. sage/combinat/multiset_partition_into_sets_ordered.py +3541 -0
  177. sage/combinat/ncsf_qsym/all.py +21 -0
  178. sage/combinat/ncsf_qsym/combinatorics.py +317 -0
  179. sage/combinat/ncsf_qsym/generic_basis_code.py +1427 -0
  180. sage/combinat/ncsf_qsym/ncsf.py +5637 -0
  181. sage/combinat/ncsf_qsym/qsym.py +4053 -0
  182. sage/combinat/ncsf_qsym/tutorial.py +447 -0
  183. sage/combinat/ncsym/all.py +21 -0
  184. sage/combinat/ncsym/bases.py +855 -0
  185. sage/combinat/ncsym/dual.py +593 -0
  186. sage/combinat/ncsym/ncsym.py +2076 -0
  187. sage/combinat/necklace.py +551 -0
  188. sage/combinat/non_decreasing_parking_function.py +634 -0
  189. sage/combinat/nu_dyck_word.py +1474 -0
  190. sage/combinat/output.py +861 -0
  191. sage/combinat/parallelogram_polyomino.py +4326 -0
  192. sage/combinat/parking_functions.py +1602 -0
  193. sage/combinat/partition_algebra.py +1998 -0
  194. sage/combinat/partition_kleshchev.py +1982 -0
  195. sage/combinat/partition_shifting_algebras.py +584 -0
  196. sage/combinat/partition_tuple.py +3114 -0
  197. sage/combinat/path_tableaux/all.py +13 -0
  198. sage/combinat/path_tableaux/catalog.py +29 -0
  199. sage/combinat/path_tableaux/dyck_path.py +380 -0
  200. sage/combinat/path_tableaux/frieze.py +476 -0
  201. sage/combinat/path_tableaux/path_tableau.py +728 -0
  202. sage/combinat/path_tableaux/semistandard.py +510 -0
  203. sage/combinat/perfect_matching.py +779 -0
  204. sage/combinat/plane_partition.py +3300 -0
  205. sage/combinat/q_bernoulli.cpython-314-x86_64-linux-musl.so +0 -0
  206. sage/combinat/q_bernoulli.pyx +128 -0
  207. sage/combinat/quickref.py +81 -0
  208. sage/combinat/recognizable_series.py +2051 -0
  209. sage/combinat/regular_sequence.py +4316 -0
  210. sage/combinat/regular_sequence_bounded.py +543 -0
  211. sage/combinat/restricted_growth.py +81 -0
  212. sage/combinat/ribbon.py +20 -0
  213. sage/combinat/ribbon_shaped_tableau.py +489 -0
  214. sage/combinat/ribbon_tableau.py +1180 -0
  215. sage/combinat/rigged_configurations/all.py +46 -0
  216. sage/combinat/rigged_configurations/bij_abstract_class.py +548 -0
  217. sage/combinat/rigged_configurations/bij_infinity.py +370 -0
  218. sage/combinat/rigged_configurations/bij_type_A.py +163 -0
  219. sage/combinat/rigged_configurations/bij_type_A2_dual.py +338 -0
  220. sage/combinat/rigged_configurations/bij_type_A2_even.py +218 -0
  221. sage/combinat/rigged_configurations/bij_type_A2_odd.py +199 -0
  222. sage/combinat/rigged_configurations/bij_type_B.py +900 -0
  223. sage/combinat/rigged_configurations/bij_type_C.py +267 -0
  224. sage/combinat/rigged_configurations/bij_type_D.py +771 -0
  225. sage/combinat/rigged_configurations/bij_type_D_tri.py +392 -0
  226. sage/combinat/rigged_configurations/bij_type_D_twisted.py +576 -0
  227. sage/combinat/rigged_configurations/bij_type_E67.py +402 -0
  228. sage/combinat/rigged_configurations/bijection.py +143 -0
  229. sage/combinat/rigged_configurations/kleber_tree.py +1475 -0
  230. sage/combinat/rigged_configurations/kr_tableaux.py +1898 -0
  231. sage/combinat/rigged_configurations/rc_crystal.py +461 -0
  232. sage/combinat/rigged_configurations/rc_infinity.py +540 -0
  233. sage/combinat/rigged_configurations/rigged_configuration_element.py +2403 -0
  234. sage/combinat/rigged_configurations/rigged_configurations.py +1918 -0
  235. sage/combinat/rigged_configurations/rigged_partition.cpython-314-x86_64-linux-musl.so +0 -0
  236. sage/combinat/rigged_configurations/rigged_partition.pxd +15 -0
  237. sage/combinat/rigged_configurations/rigged_partition.pyx +680 -0
  238. sage/combinat/rigged_configurations/tensor_product_kr_tableaux.py +499 -0
  239. sage/combinat/rigged_configurations/tensor_product_kr_tableaux_element.py +428 -0
  240. sage/combinat/rsk.py +3438 -0
  241. sage/combinat/schubert_polynomial.py +508 -0
  242. sage/combinat/set_partition.py +3318 -0
  243. sage/combinat/set_partition_iterator.cpython-314-x86_64-linux-musl.so +0 -0
  244. sage/combinat/set_partition_iterator.pyx +136 -0
  245. sage/combinat/set_partition_ordered.py +1590 -0
  246. sage/combinat/sf/abreu_nigro.py +346 -0
  247. sage/combinat/sf/all.py +52 -0
  248. sage/combinat/sf/character.py +576 -0
  249. sage/combinat/sf/classical.py +319 -0
  250. sage/combinat/sf/dual.py +996 -0
  251. sage/combinat/sf/elementary.py +549 -0
  252. sage/combinat/sf/hall_littlewood.py +1028 -0
  253. sage/combinat/sf/hecke.py +336 -0
  254. sage/combinat/sf/homogeneous.py +464 -0
  255. sage/combinat/sf/jack.py +1428 -0
  256. sage/combinat/sf/k_dual.py +1458 -0
  257. sage/combinat/sf/kfpoly.py +447 -0
  258. sage/combinat/sf/llt.py +789 -0
  259. sage/combinat/sf/macdonald.py +2019 -0
  260. sage/combinat/sf/monomial.py +525 -0
  261. sage/combinat/sf/multiplicative.py +113 -0
  262. sage/combinat/sf/new_kschur.py +1786 -0
  263. sage/combinat/sf/ns_macdonald.py +964 -0
  264. sage/combinat/sf/orthogonal.py +246 -0
  265. sage/combinat/sf/orthotriang.py +355 -0
  266. sage/combinat/sf/powersum.py +963 -0
  267. sage/combinat/sf/schur.py +880 -0
  268. sage/combinat/sf/sf.py +1653 -0
  269. sage/combinat/sf/sfa.py +7053 -0
  270. sage/combinat/sf/symplectic.py +253 -0
  271. sage/combinat/sf/witt.py +721 -0
  272. sage/combinat/shifted_primed_tableau.py +2735 -0
  273. sage/combinat/shuffle.py +830 -0
  274. sage/combinat/sidon_sets.py +146 -0
  275. sage/combinat/similarity_class_type.py +1721 -0
  276. sage/combinat/sine_gordon.py +618 -0
  277. sage/combinat/six_vertex_model.py +784 -0
  278. sage/combinat/skew_partition.py +2053 -0
  279. sage/combinat/skew_tableau.py +2989 -0
  280. sage/combinat/sloane_functions.py +8935 -0
  281. sage/combinat/specht_module.py +1403 -0
  282. sage/combinat/species/all.py +48 -0
  283. sage/combinat/species/characteristic_species.py +321 -0
  284. sage/combinat/species/composition_species.py +273 -0
  285. sage/combinat/species/cycle_species.py +284 -0
  286. sage/combinat/species/empty_species.py +155 -0
  287. sage/combinat/species/functorial_composition_species.py +148 -0
  288. sage/combinat/species/generating_series.py +673 -0
  289. sage/combinat/species/library.py +148 -0
  290. sage/combinat/species/linear_order_species.py +169 -0
  291. sage/combinat/species/misc.py +83 -0
  292. sage/combinat/species/partition_species.py +290 -0
  293. sage/combinat/species/permutation_species.py +268 -0
  294. sage/combinat/species/product_species.py +423 -0
  295. sage/combinat/species/recursive_species.py +476 -0
  296. sage/combinat/species/set_species.py +192 -0
  297. sage/combinat/species/species.py +820 -0
  298. sage/combinat/species/structure.py +539 -0
  299. sage/combinat/species/subset_species.py +243 -0
  300. sage/combinat/species/sum_species.py +225 -0
  301. sage/combinat/subword.py +564 -0
  302. sage/combinat/subword_complex.py +2122 -0
  303. sage/combinat/subword_complex_c.cpython-314-x86_64-linux-musl.so +0 -0
  304. sage/combinat/subword_complex_c.pyx +119 -0
  305. sage/combinat/super_tableau.py +821 -0
  306. sage/combinat/superpartition.py +1154 -0
  307. sage/combinat/symmetric_group_algebra.py +3774 -0
  308. sage/combinat/symmetric_group_representations.py +1830 -0
  309. sage/combinat/t_sequences.py +877 -0
  310. sage/combinat/tableau.py +9506 -0
  311. sage/combinat/tableau_residues.py +860 -0
  312. sage/combinat/tableau_tuple.py +5353 -0
  313. sage/combinat/tiling.py +2432 -0
  314. sage/combinat/triangles_FHM.py +777 -0
  315. sage/combinat/tutorial.py +1857 -0
  316. sage/combinat/vector_partition.py +337 -0
  317. sage/combinat/words/abstract_word.py +1722 -0
  318. sage/combinat/words/all.py +59 -0
  319. sage/combinat/words/alphabet.py +268 -0
  320. sage/combinat/words/finite_word.py +7201 -0
  321. sage/combinat/words/infinite_word.py +113 -0
  322. sage/combinat/words/lyndon_word.py +652 -0
  323. sage/combinat/words/morphic.py +351 -0
  324. sage/combinat/words/morphism.py +3878 -0
  325. sage/combinat/words/paths.py +2932 -0
  326. sage/combinat/words/shuffle_product.py +278 -0
  327. sage/combinat/words/suffix_trees.py +1873 -0
  328. sage/combinat/words/word.py +769 -0
  329. sage/combinat/words/word_char.cpython-314-x86_64-linux-musl.so +0 -0
  330. sage/combinat/words/word_char.pyx +847 -0
  331. sage/combinat/words/word_datatypes.cpython-314-x86_64-linux-musl.so +0 -0
  332. sage/combinat/words/word_datatypes.pxd +4 -0
  333. sage/combinat/words/word_datatypes.pyx +1067 -0
  334. sage/combinat/words/word_generators.py +2026 -0
  335. sage/combinat/words/word_infinite_datatypes.py +1218 -0
  336. sage/combinat/words/word_options.py +99 -0
  337. sage/combinat/words/words.py +2396 -0
  338. sage/data_structures/all__sagemath_combinat.py +1 -0
  339. sage/databases/all__sagemath_combinat.py +13 -0
  340. sage/databases/findstat.py +4897 -0
  341. sage/databases/oeis.py +2058 -0
  342. sage/databases/sloane.py +393 -0
  343. sage/dynamics/all__sagemath_combinat.py +14 -0
  344. sage/dynamics/cellular_automata/all.py +7 -0
  345. sage/dynamics/cellular_automata/catalog.py +34 -0
  346. sage/dynamics/cellular_automata/elementary.py +612 -0
  347. sage/dynamics/cellular_automata/glca.py +477 -0
  348. sage/dynamics/cellular_automata/solitons.py +1463 -0
  349. sage/dynamics/finite_dynamical_system.py +1249 -0
  350. sage/dynamics/finite_dynamical_system_catalog.py +382 -0
  351. sage/games/all.py +7 -0
  352. sage/games/hexad.py +704 -0
  353. sage/games/quantumino.py +591 -0
  354. sage/games/sudoku.py +889 -0
  355. sage/games/sudoku_backtrack.cpython-314-x86_64-linux-musl.so +0 -0
  356. sage/games/sudoku_backtrack.pyx +189 -0
  357. sage/groups/all__sagemath_combinat.py +1 -0
  358. sage/groups/indexed_free_group.py +489 -0
  359. sage/libs/all__sagemath_combinat.py +6 -0
  360. sage/libs/lrcalc/__init__.py +1 -0
  361. sage/libs/lrcalc/lrcalc.py +525 -0
  362. sage/libs/symmetrica/__init__.py +7 -0
  363. sage/libs/symmetrica/all.py +101 -0
  364. sage/libs/symmetrica/kostka.pxi +168 -0
  365. sage/libs/symmetrica/part.pxi +193 -0
  366. sage/libs/symmetrica/plet.pxi +42 -0
  367. sage/libs/symmetrica/sab.pxi +196 -0
  368. sage/libs/symmetrica/sb.pxi +332 -0
  369. sage/libs/symmetrica/sc.pxi +192 -0
  370. sage/libs/symmetrica/schur.pxi +956 -0
  371. sage/libs/symmetrica/symmetrica.cpython-314-x86_64-linux-musl.so +0 -0
  372. sage/libs/symmetrica/symmetrica.pxi +1172 -0
  373. sage/libs/symmetrica/symmetrica.pyx +39 -0
  374. sage/monoids/all.py +13 -0
  375. sage/monoids/automatic_semigroup.py +1054 -0
  376. sage/monoids/free_abelian_monoid.py +315 -0
  377. sage/monoids/free_abelian_monoid_element.cpython-314-x86_64-linux-musl.so +0 -0
  378. sage/monoids/free_abelian_monoid_element.pxd +16 -0
  379. sage/monoids/free_abelian_monoid_element.pyx +397 -0
  380. sage/monoids/free_monoid.py +335 -0
  381. sage/monoids/free_monoid_element.py +431 -0
  382. sage/monoids/hecke_monoid.py +65 -0
  383. sage/monoids/string_monoid.py +817 -0
  384. sage/monoids/string_monoid_element.py +547 -0
  385. sage/monoids/string_ops.py +143 -0
  386. sage/monoids/trace_monoid.py +972 -0
  387. sage/rings/all__sagemath_combinat.py +2 -0
  388. sage/sat/all.py +4 -0
  389. sage/sat/boolean_polynomials.py +405 -0
  390. sage/sat/converters/__init__.py +6 -0
  391. sage/sat/converters/anf2cnf.py +14 -0
  392. sage/sat/converters/polybori.py +611 -0
  393. sage/sat/solvers/__init__.py +5 -0
  394. sage/sat/solvers/cryptominisat.py +287 -0
  395. sage/sat/solvers/dimacs.py +783 -0
  396. sage/sat/solvers/picosat.py +228 -0
  397. sage/sat/solvers/sat_lp.py +156 -0
  398. sage/sat/solvers/satsolver.cpython-314-x86_64-linux-musl.so +0 -0
  399. sage/sat/solvers/satsolver.pxd +3 -0
  400. sage/sat/solvers/satsolver.pyx +405 -0
@@ -0,0 +1,2076 @@
1
+ # sage_setup: distribution = sagemath-combinat
2
+ # sage.doctest: needs sage.combinat sage.modules
3
+ """
4
+ Symmetric functions in noncommuting variables
5
+
6
+ AUTHORS:
7
+
8
+ - Travis Scrimshaw (08-04-2013): initial version
9
+ """
10
+ # ****************************************************************************
11
+ # Copyright (C) 2013 Travis Scrimshaw <tscrim at ucdavis.edu>
12
+ #
13
+ # Distributed under the terms of the GNU General Public License (GPL)
14
+ # https://www.gnu.org/licenses/
15
+ # ****************************************************************************
16
+ from itertools import repeat
17
+ from sage.misc.cachefunc import cached_method
18
+ from sage.misc.misc_c import prod
19
+ from sage.structure.parent import Parent
20
+ from sage.structure.unique_representation import UniqueRepresentation
21
+ from sage.categories.graded_hopf_algebras import GradedHopfAlgebras
22
+ from sage.categories.rings import Rings
23
+ from sage.categories.fields import Fields
24
+
25
+ from sage.arith.misc import factorial
26
+ from sage.combinat.free_module import CombinatorialFreeModule
27
+ from sage.combinat.ncsym.bases import NCSymBases, MultiplicativeNCSymBases, NCSymBasis_abstract
28
+ from sage.combinat.set_partition import SetPartitions
29
+ from sage.combinat.set_partition_ordered import OrderedSetPartitions
30
+ from sage.combinat.posets.posets import Poset
31
+ from sage.combinat.sf.sf import SymmetricFunctions
32
+ from sage.matrix.matrix_space import MatrixSpace
33
+ from sage.sets.set import Set
34
+ from sage.rings.integer_ring import ZZ
35
+ from functools import reduce
36
+
37
+
38
+ def matchings(A, B):
39
+ """
40
+ Iterate through all matchings of the sets `A` and `B`.
41
+
42
+ EXAMPLES::
43
+
44
+ sage: from sage.combinat.ncsym.ncsym import matchings
45
+ sage: list(matchings([1, 2, 3], [-1, -2]))
46
+ [[[1], [2], [3], [-1], [-2]],
47
+ [[1], [2], [3, -1], [-2]],
48
+ [[1], [2], [3, -2], [-1]],
49
+ [[1], [2, -1], [3], [-2]],
50
+ [[1], [2, -1], [3, -2]],
51
+ [[1], [2, -2], [3], [-1]],
52
+ [[1], [2, -2], [3, -1]],
53
+ [[1, -1], [2], [3], [-2]],
54
+ [[1, -1], [2], [3, -2]],
55
+ [[1, -1], [2, -2], [3]],
56
+ [[1, -2], [2], [3], [-1]],
57
+ [[1, -2], [2], [3, -1]],
58
+ [[1, -2], [2, -1], [3]]]
59
+ """
60
+ lst_A = list(A)
61
+ lst_B = list(B)
62
+ # Handle corner cases
63
+ if not lst_A:
64
+ if not lst_B:
65
+ yield []
66
+ else:
67
+ yield [[b] for b in lst_B]
68
+ return
69
+ if not lst_B:
70
+ yield [[a] for a in lst_A]
71
+ return
72
+
73
+ rem_A = lst_A[:]
74
+ a = rem_A.pop(0)
75
+ for m in matchings(rem_A, lst_B):
76
+ yield [[a]] + m
77
+ for i in range(len(lst_B)):
78
+ rem_B = lst_B[:]
79
+ b = rem_B.pop(i)
80
+ for m in matchings(rem_A, rem_B):
81
+ yield [[a, b]] + m
82
+
83
+
84
+ def nesting(la, nu):
85
+ r"""
86
+ Return the nesting number of ``la`` inside of ``nu``.
87
+
88
+ If we consider a set partition `A` as a set of arcs `i - j` where `i`
89
+ and `j` are in the same part of `A`. Define
90
+
91
+ .. MATH::
92
+
93
+ \operatorname{nst}_{\lambda}^{\nu} = \#\{ i < j < k < l \mid
94
+ i - l \in \nu, j - k \in \lambda \},
95
+
96
+ and this corresponds to the number of arcs of `\lambda` strictly
97
+ contained inside of `\nu`.
98
+
99
+ EXAMPLES::
100
+
101
+ sage: from sage.combinat.ncsym.ncsym import nesting
102
+ sage: nu = SetPartition([[1,4], [2], [3]])
103
+ sage: mu = SetPartition([[1,4], [2,3]])
104
+ sage: nesting(set(mu).difference(nu), nu)
105
+ 1
106
+
107
+ sage: A = SetPartition([[1], [2,5], [3,4]])
108
+ sage: B = SetPartition([[1,3,4], [2,5]])
109
+ sage: nesting(A, B)
110
+ 1
111
+ sage: nesting(B, A)
112
+ 1
113
+
114
+ ::
115
+
116
+ sage: lst = list(SetPartitions(4))
117
+ sage: d = {}
118
+ sage: for i, nu in enumerate(lst):
119
+ ....: for mu in nu.coarsenings():
120
+ ....: if set(nu.arcs()).issubset(mu.arcs()):
121
+ ....: d[i, lst.index(mu)] = nesting(set(mu).difference(nu), nu)
122
+ sage: matrix(d)
123
+ [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
124
+ [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
125
+ [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
126
+ [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
127
+ [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
128
+ [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
129
+ [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
130
+ [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
131
+ [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
132
+ [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
133
+ [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
134
+ [0 0 0 0 0 0 0 0 1 0 0 0 0 0 0]
135
+ [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
136
+ [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
137
+ [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
138
+ """
139
+ arcs = []
140
+ for p in nu:
141
+ p = sorted(p)
142
+ arcs += [(p[i], p[i+1]) for i in range(len(p)-1)]
143
+ nst = 0
144
+ for p in la:
145
+ p = sorted(p)
146
+ for a in arcs:
147
+ if p[-1] < a[0]:
148
+ continue
149
+ for i in range(len(p)-1):
150
+ if a[1] <= p[i+1]:
151
+ break
152
+ if a[0] < p[i]:
153
+ nst += 1
154
+ return nst
155
+
156
+
157
+ class SymmetricFunctionsNonCommutingVariables(UniqueRepresentation, Parent):
158
+ r"""
159
+ Symmetric functions in non-commutative variables.
160
+
161
+ The ring of symmetric functions in non-commutative variables,
162
+ which is not to be confused with the :class:`non-commutative symmetric
163
+ functions<NonCommutativeSymmetricFunctions>`, is the ring of all
164
+ bounded-degree noncommutative power series in countably many
165
+ indeterminates (i.e., elements in
166
+ `R \langle \langle x_1, x_2, x_3, \ldots \rangle \rangle` of bounded
167
+ degree) which are invariant with respect to the action of the
168
+ symmetric group `S_{\infty}` on the indices of the indeterminates.
169
+ It can be regarded as a direct limit over all `n \to \infty` of rings
170
+ of `S_n`-invariant polynomials in `n` non-commuting variables
171
+ (that is, `S_n`-invariant elements of `R\langle x_1, x_2, \ldots, x_n \rangle`).
172
+
173
+ This ring is implemented as a Hopf algebra whose basis elements are
174
+ indexed by set partitions.
175
+
176
+ Let `A = \{A_1, A_2, \ldots, A_r\}` be a set partition of the integers
177
+ `[k] := \{ 1, 2, \ldots, k \}`. This partition `A` determines an
178
+ equivalence relation `\sim_A` on `[k]`, which has `c \sim_A d` if and
179
+ only if `c` and `d` are in the same part `A_j` of `A`.
180
+ The monomial basis element `\mathbf{m}_A` indexed by `A` is the sum of
181
+ monomials `x_{i_1} x_{i_2} \cdots x_{i_k}` such that `i_c = i_d` if
182
+ and only if `c \sim_A d`.
183
+
184
+ The `k`-th graded component of the ring of symmetric functions in
185
+ non-commutative variables has its dimension equal to the number of
186
+ set partitions of `[k]`. (If we work, instead, with finitely many --
187
+ say, `n` -- variables, then its dimension is equal to the number of
188
+ set partitions of `[k]` where the number of parts is at most `n`.)
189
+
190
+ .. NOTE::
191
+
192
+ All set partitions are considered standard (i.e., set partitions
193
+ of `[n]` for some `n`) unless otherwise stated.
194
+
195
+ REFERENCES:
196
+
197
+ .. [BZ05] \N. Bergeron, M. Zabrocki. *The Hopf algebra of symmetric
198
+ functions and quasisymmetric functions in non-commutative variables
199
+ are free and cofree*. (2005). :arxiv:`math/0509265v3`.
200
+
201
+ .. [BHRZ06] \N. Bergeron, C. Hohlweg, M. Rosas, M. Zabrocki.
202
+ *Grothendieck bialgebras, partition lattices, and symmetric
203
+ functions in noncommutative variables*. Electronic Journal of
204
+ Combinatorics. **13** (2006).
205
+
206
+ .. [RS06] \M. Rosas, B. Sagan. *Symmetric functions in noncommuting
207
+ variables*. Trans. Amer. Math. Soc. **358** (2006). no. 1, 215-232.
208
+ :arxiv:`math/0208168`.
209
+
210
+ .. [BRRZ08] \N. Bergeron, C. Reutenauer, M. Rosas, M. Zabrocki.
211
+ *Invariants and coinvariants of the symmetric group in noncommuting
212
+ variables*. Canad. J. Math. **60** (2008). 266-296.
213
+ :arxiv:`math/0502082`
214
+
215
+ .. [BT13] \N. Bergeron, N. Thiem. *A supercharacter table decomposition
216
+ via power-sum symmetric functions*. Int. J. Algebra Comput. **23**,
217
+ 763 (2013). :doi:`10.1142/S0218196713400171`. :arxiv:`1112.4901`.
218
+
219
+ EXAMPLES:
220
+
221
+ We begin by first creating the ring of `NCSym` and the bases that are
222
+ analogues of the usual symmetric functions::
223
+
224
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
225
+ sage: m = NCSym.m()
226
+ sage: e = NCSym.e()
227
+ sage: h = NCSym.h()
228
+ sage: p = NCSym.p()
229
+ sage: m
230
+ Symmetric functions in non-commuting variables over the Rational Field in the monomial basis
231
+
232
+ The basis is indexed by set partitions, so we create a few elements and
233
+ convert them between these bases::
234
+
235
+ sage: elt = m(SetPartition([[1,3],[2]])) - 2*m(SetPartition([[1],[2]])); elt
236
+ -2*m{{1}, {2}} + m{{1, 3}, {2}}
237
+ sage: e(elt)
238
+ 1/2*e{{1}, {2, 3}} - 2*e{{1, 2}} + 1/2*e{{1, 2}, {3}} - 1/2*e{{1, 2, 3}} - 1/2*e{{1, 3}, {2}}
239
+ sage: h(elt)
240
+ -4*h{{1}, {2}} - 2*h{{1}, {2}, {3}} + 1/2*h{{1}, {2, 3}} + 2*h{{1, 2}}
241
+ + 1/2*h{{1, 2}, {3}} - 1/2*h{{1, 2, 3}} + 3/2*h{{1, 3}, {2}}
242
+ sage: p(elt)
243
+ -2*p{{1}, {2}} + 2*p{{1, 2}} - p{{1, 2, 3}} + p{{1, 3}, {2}}
244
+ sage: m(p(elt))
245
+ -2*m{{1}, {2}} + m{{1, 3}, {2}}
246
+
247
+ sage: elt = p(SetPartition([[1,3],[2]])) - 4*p(SetPartition([[1],[2]])) + 2; elt
248
+ 2*p{} - 4*p{{1}, {2}} + p{{1, 3}, {2}}
249
+ sage: e(elt)
250
+ 2*e{} - 4*e{{1}, {2}} + e{{1}, {2}, {3}} - e{{1, 3}, {2}}
251
+ sage: m(elt)
252
+ 2*m{} - 4*m{{1}, {2}} - 4*m{{1, 2}} + m{{1, 2, 3}} + m{{1, 3}, {2}}
253
+ sage: h(elt)
254
+ 2*h{} - 4*h{{1}, {2}} - h{{1}, {2}, {3}} + h{{1, 3}, {2}}
255
+ sage: p(m(elt))
256
+ 2*p{} - 4*p{{1}, {2}} + p{{1, 3}, {2}}
257
+
258
+ There is also a shorthand for creating elements. We note that we must use
259
+ ``p[[]]`` to create the empty set partition due to python's syntax. ::
260
+
261
+ sage: eltm = m[[1,3],[2]] - 3*m[[1],[2]]; eltm
262
+ -3*m{{1}, {2}} + m{{1, 3}, {2}}
263
+ sage: elte = e[[1,3],[2]]; elte
264
+ e{{1, 3}, {2}}
265
+ sage: elth = h[[1,3],[2,4]]; elth
266
+ h{{1, 3}, {2, 4}}
267
+ sage: eltp = p[[1,3],[2,4]] + 2*p[[1]] - 4*p[[]]; eltp
268
+ -4*p{} + 2*p{{1}} + p{{1, 3}, {2, 4}}
269
+
270
+ There is also a natural projection to the usual symmetric functions by
271
+ letting the variables commute. This projection map preserves the product
272
+ and coproduct structure. We check that Theorem 2.1 of [RS06]_ holds::
273
+
274
+ sage: Sym = SymmetricFunctions(QQ)
275
+ sage: Sm = Sym.m()
276
+ sage: Se = Sym.e()
277
+ sage: Sh = Sym.h()
278
+ sage: Sp = Sym.p()
279
+ sage: eltm.to_symmetric_function()
280
+ -6*m[1, 1] + m[2, 1]
281
+ sage: Sm(p(eltm).to_symmetric_function())
282
+ -6*m[1, 1] + m[2, 1]
283
+ sage: elte.to_symmetric_function()
284
+ 2*e[2, 1]
285
+ sage: Se(h(elte).to_symmetric_function())
286
+ 2*e[2, 1]
287
+ sage: elth.to_symmetric_function()
288
+ 4*h[2, 2]
289
+ sage: Sh(m(elth).to_symmetric_function())
290
+ 4*h[2, 2]
291
+ sage: eltp.to_symmetric_function()
292
+ -4*p[] + 2*p[1] + p[2, 2]
293
+ sage: Sp(e(eltp).to_symmetric_function())
294
+ -4*p[] + 2*p[1] + p[2, 2]
295
+ """
296
+
297
+ def __init__(self, R):
298
+ """
299
+ Initialize ``self``.
300
+
301
+ EXAMPLES::
302
+
303
+ sage: NCSym1 = SymmetricFunctionsNonCommutingVariables(FiniteField(23))
304
+ sage: NCSym2 = SymmetricFunctionsNonCommutingVariables(Integers(23))
305
+ sage: TestSuite(SymmetricFunctionsNonCommutingVariables(QQ)).run()
306
+ """
307
+ # change the line below to assert R in Rings() once MRO issues from #15536, #15475 are resolved
308
+ assert R in Fields() or R in Rings() # side effect of this statement assures MRO exists for R
309
+ self._base = R # Won't be needed once CategoryObject won't override base_ring
310
+ category = GradedHopfAlgebras(R).Cocommutative()
311
+ Parent.__init__(self, category=category.WithRealizations())
312
+
313
+ def _repr_(self):
314
+ r"""
315
+ EXAMPLES::
316
+
317
+ sage: SymmetricFunctionsNonCommutingVariables(ZZ)
318
+ Symmetric functions in non-commuting variables over the Integer Ring
319
+ """
320
+ return "Symmetric functions in non-commuting variables over the %s" % self.base_ring()
321
+
322
+ def a_realization(self):
323
+ r"""
324
+ Return the realization of the powersum basis of ``self``.
325
+
326
+ OUTPUT: the powersum basis of symmetric functions in non-commuting variables
327
+
328
+ EXAMPLES::
329
+
330
+ sage: SymmetricFunctionsNonCommutingVariables(QQ).a_realization()
331
+ Symmetric functions in non-commuting variables over the Rational Field in the powersum basis
332
+ """
333
+ return self.powersum()
334
+
335
+ _shorthands = tuple(['chi', 'cp', 'm', 'e', 'h', 'p', 'rho', 'x'])
336
+
337
+ def dual(self):
338
+ r"""
339
+ Return the dual Hopf algebra of the symmetric functions in
340
+ non-commuting variables.
341
+
342
+ EXAMPLES::
343
+
344
+ sage: SymmetricFunctionsNonCommutingVariables(QQ).dual()
345
+ Dual symmetric functions in non-commuting variables over the Rational Field
346
+ """
347
+ from sage.combinat.ncsym.dual import SymmetricFunctionsNonCommutingVariablesDual
348
+ return SymmetricFunctionsNonCommutingVariablesDual(self.base_ring())
349
+
350
+ class monomial(NCSymBasis_abstract):
351
+ r"""
352
+ The Hopf algebra of symmetric functions in non-commuting variables
353
+ in the monomial basis.
354
+
355
+ EXAMPLES::
356
+
357
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
358
+ sage: m = NCSym.m()
359
+ sage: m[[1,3],[2]]*m[[1,2]]
360
+ m{{1, 3}, {2}, {4, 5}} + m{{1, 3}, {2, 4, 5}} + m{{1, 3, 4, 5}, {2}}
361
+ sage: m[[1,3],[2]].coproduct()
362
+ m{} # m{{1, 3}, {2}} + m{{1}} # m{{1, 2}} + m{{1, 2}} # m{{1}} + m{{1,
363
+ 3}, {2}} # m{}
364
+ """
365
+
366
+ def __init__(self, NCSym):
367
+ """
368
+ EXAMPLES::
369
+
370
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
371
+ sage: TestSuite(NCSym.m()).run()
372
+ """
373
+ R = NCSym.base_ring()
374
+ category = GradedHopfAlgebras(R).Cocommutative()
375
+ category &= NCSymBases(NCSym)
376
+
377
+ CombinatorialFreeModule.__init__(self, R, SetPartitions(),
378
+ prefix='m', bracket=False,
379
+ category=category)
380
+
381
+ @cached_method
382
+ def _m_to_p_on_basis(self, A):
383
+ r"""
384
+ Return `\mathbf{m}_A` in terms of the powersum basis.
385
+
386
+ INPUT:
387
+
388
+ - ``A`` -- set partition
389
+
390
+ OUTPUT: an element of the powersum basis
391
+
392
+ TESTS::
393
+
394
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
395
+ sage: m = NCSym.m()
396
+ sage: all(m(m._m_to_p_on_basis(A)) == m[A] for i in range(5)
397
+ ....: for A in SetPartitions(i))
398
+ True
399
+ """
400
+ def lt(s, t):
401
+ if s == t:
402
+ return False
403
+ for p in s:
404
+ if len([z for z in t if z.intersection(p)]) != 1:
405
+ return False
406
+ return True
407
+
408
+ p = self.realization_of().p()
409
+ P = Poset((A.coarsenings(), lt))
410
+ R = self.base_ring()
411
+ return p._from_dict({B: R(P.moebius_function(A, B)) for B in P})
412
+
413
+ @cached_method
414
+ def _m_to_cp_on_basis(self, A):
415
+ r"""
416
+ Return `\mathbf{m}_A` in terms of the `\mathbf{cp}` basis.
417
+
418
+ INPUT:
419
+
420
+ - ``A`` -- set partition
421
+
422
+ OUTPUT: an element of the `\mathbf{cp}` basis
423
+
424
+ TESTS::
425
+
426
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
427
+ sage: m = NCSym.m()
428
+ sage: all(m(m._m_to_cp_on_basis(A)) == m[A] for i in range(5)
429
+ ....: for A in SetPartitions(i))
430
+ True
431
+ """
432
+ cp = self.realization_of().cp()
433
+ arcs = set(A.arcs())
434
+ R = self.base_ring()
435
+ return cp._from_dict({B: R((-1)**len(set(B.arcs()).difference(A.arcs())))
436
+ for B in A.coarsenings() if arcs.issubset(B.arcs())},
437
+ remove_zeros=False)
438
+
439
+ def from_symmetric_function(self, f):
440
+ r"""
441
+ Return the image of the symmetric function ``f`` in ``self``.
442
+
443
+ This is performed by converting to the monomial basis and
444
+ extending the method :meth:`sum_of_partitions` linearly. This is a
445
+ linear map from the symmetric functions to the symmetric functions
446
+ in non-commuting variables that does not preserve the product or
447
+ coproduct structure of the Hopf algebra.
448
+
449
+ .. SEEALSO:: :meth:`~Element.to_symmetric_function`
450
+
451
+ INPUT:
452
+
453
+ - ``f`` -- an element of the symmetric functions
454
+
455
+ OUTPUT: an element of the `\mathbf{m}` basis
456
+
457
+ EXAMPLES::
458
+
459
+ sage: m = SymmetricFunctionsNonCommutingVariables(QQ).m()
460
+ sage: mon = SymmetricFunctions(QQ).m()
461
+ sage: elt = m.from_symmetric_function(mon[2,1,1]); elt
462
+ 1/12*m{{1}, {2}, {3, 4}} + 1/12*m{{1}, {2, 3}, {4}} + 1/12*m{{1}, {2, 4}, {3}}
463
+ + 1/12*m{{1, 2}, {3}, {4}} + 1/12*m{{1, 3}, {2}, {4}} + 1/12*m{{1, 4}, {2}, {3}}
464
+ sage: elt.to_symmetric_function()
465
+ m[2, 1, 1]
466
+ sage: e = SymmetricFunctionsNonCommutingVariables(QQ).e()
467
+ sage: elm = SymmetricFunctions(QQ).e()
468
+ sage: e(m.from_symmetric_function(elm[4]))
469
+ 1/24*e{{1, 2, 3, 4}}
470
+ sage: h = SymmetricFunctionsNonCommutingVariables(QQ).h()
471
+ sage: hom = SymmetricFunctions(QQ).h()
472
+ sage: h(m.from_symmetric_function(hom[4]))
473
+ 1/24*h{{1, 2, 3, 4}}
474
+ sage: p = SymmetricFunctionsNonCommutingVariables(QQ).p()
475
+ sage: pow = SymmetricFunctions(QQ).p()
476
+ sage: p(m.from_symmetric_function(pow[4]))
477
+ p{{1, 2, 3, 4}}
478
+ sage: p(m.from_symmetric_function(pow[2,1]))
479
+ 1/3*p{{1}, {2, 3}} + 1/3*p{{1, 2}, {3}} + 1/3*p{{1, 3}, {2}}
480
+ sage: p([[1,2]])*p([[1]])
481
+ p{{1, 2}, {3}}
482
+
483
+ Check that `\chi \circ \widetilde{\chi}` is the identity on `Sym`::
484
+
485
+ sage: all(m.from_symmetric_function(pow(la)).to_symmetric_function() == pow(la)
486
+ ....: for la in Partitions(4))
487
+ True
488
+ """
489
+ m = SymmetricFunctions(self.base_ring()).m()
490
+ return self.sum([c * self.sum_of_partitions(i) for i,c in m(f)])
491
+
492
+ def dual_basis(self):
493
+ r"""
494
+ Return the dual basis to the monomial basis.
495
+
496
+ OUTPUT: the `\mathbf{w}` basis of the dual Hopf algebra
497
+
498
+ EXAMPLES::
499
+
500
+ sage: m = SymmetricFunctionsNonCommutingVariables(QQ).m()
501
+ sage: m.dual_basis()
502
+ Dual symmetric functions in non-commuting variables over the Rational Field in the w basis
503
+ """
504
+ return self.realization_of().dual().w()
505
+
506
+ def duality_pairing(self, x, y):
507
+ r"""
508
+ Compute the pairing between an element of ``self`` and an element
509
+ of the dual.
510
+
511
+ INPUT:
512
+
513
+ - ``x`` -- an element of symmetric functions in non-commuting
514
+ variables
515
+ - ``y`` -- an element of the dual of symmetric functions in
516
+ non-commuting variables
517
+
518
+ OUTPUT: an element of the base ring of ``self``
519
+
520
+ EXAMPLES::
521
+
522
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
523
+ sage: m = NCSym.m()
524
+ sage: w = m.dual_basis()
525
+ sage: matrix([[m(A).duality_pairing(w(B)) for A in SetPartitions(3)] for B in SetPartitions(3)])
526
+ [1 0 0 0 0]
527
+ [0 1 0 0 0]
528
+ [0 0 1 0 0]
529
+ [0 0 0 1 0]
530
+ [0 0 0 0 1]
531
+ sage: (m[[1,2],[3]] + 3*m[[1,3],[2]]).duality_pairing(2*w[[1,3],[2]] + w[[1,2,3]] + 2*w[[1,2],[3]])
532
+ 8
533
+ """
534
+ x = self(x)
535
+ y = self.dual_basis()(y)
536
+ return sum(coeff * y[I] for (I, coeff) in x)
537
+
538
+ def product_on_basis(self, A, B):
539
+ r"""
540
+ The product on monomial basis elements.
541
+
542
+ The product of the basis elements indexed by two set partitions `A`
543
+ and `B` is the sum of the basis elements indexed by set partitions
544
+ `C` such that `C \wedge ([n] | [k]) = A | B` where `n = |A|`
545
+ and `k = |B|`. Here `A \wedge B` is the infimum of `A` and `B`
546
+ and `A | B` is the
547
+ :meth:`SetPartition.pipe` operation.
548
+ Equivalently we can describe all `C` as matchings between the
549
+ parts of `A` and `B` where if `a \in A` is matched
550
+ with `b \in B`, we take `a \cup b` instead of `a` and `b` in `C`.
551
+
552
+ INPUT:
553
+
554
+ - ``A``, ``B`` -- set partitions
555
+
556
+ OUTPUT: an element of the `\mathbf{m}` basis
557
+
558
+ EXAMPLES::
559
+
560
+ sage: m = SymmetricFunctionsNonCommutingVariables(QQ).monomial()
561
+ sage: A = SetPartition([[1], [2,3]])
562
+ sage: B = SetPartition([[1], [3], [2,4]])
563
+ sage: m.product_on_basis(A, B)
564
+ m{{1}, {2, 3}, {4}, {5, 7}, {6}} + m{{1}, {2, 3, 4}, {5, 7}, {6}}
565
+ + m{{1}, {2, 3, 5, 7}, {4}, {6}} + m{{1}, {2, 3, 6}, {4}, {5, 7}}
566
+ + m{{1, 4}, {2, 3}, {5, 7}, {6}} + m{{1, 4}, {2, 3, 5, 7}, {6}}
567
+ + m{{1, 4}, {2, 3, 6}, {5, 7}} + m{{1, 5, 7}, {2, 3}, {4}, {6}}
568
+ + m{{1, 5, 7}, {2, 3, 4}, {6}} + m{{1, 5, 7}, {2, 3, 6}, {4}}
569
+ + m{{1, 6}, {2, 3}, {4}, {5, 7}} + m{{1, 6}, {2, 3, 4}, {5, 7}}
570
+ + m{{1, 6}, {2, 3, 5, 7}, {4}}
571
+ sage: B = SetPartition([[1], [2]])
572
+ sage: m.product_on_basis(A, B)
573
+ m{{1}, {2, 3}, {4}, {5}} + m{{1}, {2, 3, 4}, {5}}
574
+ + m{{1}, {2, 3, 5}, {4}} + m{{1, 4}, {2, 3}, {5}} + m{{1, 4}, {2, 3, 5}}
575
+ + m{{1, 5}, {2, 3}, {4}} + m{{1, 5}, {2, 3, 4}}
576
+ sage: m.product_on_basis(A, SetPartition([]))
577
+ m{{1}, {2, 3}}
578
+
579
+ TESTS:
580
+
581
+ We check that we get all of the correct set partitions::
582
+
583
+ sage: m = SymmetricFunctionsNonCommutingVariables(QQ).monomial()
584
+ sage: A = SetPartition([[1], [2,3]])
585
+ sage: B = SetPartition([[1], [2]])
586
+ sage: S = SetPartition([[1,2,3], [4,5]])
587
+ sage: AB = SetPartition([[1], [2,3], [4], [5]])
588
+ sage: L = sorted(filter(lambda x: S.inf(x) == AB, SetPartitions(5)), key=str)
589
+ sage: list(map(list, L)) == list(map(list, sorted(m.product_on_basis(A, B).support(), key=str)))
590
+ True
591
+ """
592
+ if not A:
593
+ return self.monomial(B)
594
+ if not B:
595
+ return self.monomial(A)
596
+
597
+ P = SetPartitions()
598
+ n = A.size()
599
+ B = [Set([y+n for y in b]) for b in B] # Shift B by n
600
+ unions = lambda m: [reduce(lambda a,b: a.union(b), x) for x in m]
601
+ one = self.base_ring().one()
602
+ return self._from_dict({P(unions(m)): one for m in matchings(A, B)},
603
+ remove_zeros=False)
604
+
605
+ def coproduct_on_basis(self, A):
606
+ r"""
607
+ Return the coproduct of a monomial basis element.
608
+
609
+ INPUT:
610
+
611
+ - ``A`` -- set partition
612
+
613
+ OUTPUT:
614
+
615
+ - The coproduct applied to the monomial symmetric function in
616
+ non-commuting variables indexed by ``A`` expressed in the
617
+ monomial basis.
618
+
619
+ EXAMPLES::
620
+
621
+ sage: m = SymmetricFunctionsNonCommutingVariables(QQ).monomial()
622
+ sage: m[[1, 3], [2]].coproduct()
623
+ m{} # m{{1, 3}, {2}} + m{{1}} # m{{1, 2}} + m{{1, 2}} # m{{1}} + m{{1, 3}, {2}} # m{}
624
+ sage: m.coproduct_on_basis(SetPartition([]))
625
+ m{} # m{}
626
+ sage: m.coproduct_on_basis(SetPartition([[1,2,3]]))
627
+ m{} # m{{1, 2, 3}} + m{{1, 2, 3}} # m{}
628
+ sage: m[[1,5],[2,4],[3,7],[6]].coproduct()
629
+ m{} # m{{1, 5}, {2, 4}, {3, 7}, {6}} + m{{1}} # m{{1, 5}, {2, 4}, {3, 6}}
630
+ + 2*m{{1, 2}} # m{{1, 3}, {2, 5}, {4}} + m{{1, 2}} # m{{1, 4}, {2, 3}, {5}}
631
+ + 2*m{{1, 2}, {3}} # m{{1, 3}, {2, 4}} + m{{1, 3}, {2}} # m{{1, 4}, {2, 3}}
632
+ + 2*m{{1, 3}, {2, 4}} # m{{1, 2}, {3}} + 2*m{{1, 3}, {2, 5}, {4}} # m{{1, 2}}
633
+ + m{{1, 4}, {2, 3}} # m{{1, 3}, {2}} + m{{1, 4}, {2, 3}, {5}} # m{{1, 2}}
634
+ + m{{1, 5}, {2, 4}, {3, 6}} # m{{1}} + m{{1, 5}, {2, 4}, {3, 7}, {6}} # m{}
635
+ """
636
+ P = SetPartitions()
637
+ # Handle corner cases
638
+ if not A:
639
+ return self.tensor_square().monomial(( P([]), P([]) ))
640
+ if len(A) == 1:
641
+ return self.tensor_square().sum_of_monomials([(P([]), A), (A, P([]))])
642
+
643
+ ell_set = list(range(1, len(A) + 1)) # +1 for indexing
644
+ L = [[[], ell_set]] + list(SetPartitions(ell_set, 2))
645
+
646
+ def to_basis(S):
647
+ if not S:
648
+ return P([])
649
+ sub_parts = [list(A[i-1]) for i in S] # -1 for indexing
650
+ mins = [min(p) for p in sub_parts]
651
+ over_max = max([max(p) for p in sub_parts]) + 1
652
+ ret = [[] for _ in repeat(None, len(S))]
653
+ cur = 1
654
+ while min(mins) != over_max:
655
+ m = min(mins)
656
+ i = mins.index(m)
657
+ ret[i].append(cur)
658
+ cur += 1
659
+ sub_parts[i].pop(sub_parts[i].index(m))
660
+ if sub_parts[i]:
661
+ mins[i] = min(sub_parts[i])
662
+ else:
663
+ mins[i] = over_max
664
+ return P(ret)
665
+ L1 = [(to_basis(S), to_basis(C)) for S,C in L]
666
+ L2 = [(M, N) for N,M in L1]
667
+ return self.tensor_square().sum_of_monomials(L1 + L2)
668
+
669
+ def internal_coproduct_on_basis(self, A):
670
+ r"""
671
+ Return the internal coproduct of a monomial basis element.
672
+
673
+ The internal coproduct is defined by
674
+
675
+ .. MATH::
676
+
677
+ \Delta^{\odot}(\mathbf{m}_A) = \sum_{B \wedge C = A}
678
+ \mathbf{m}_B \otimes \mathbf{m}_C
679
+
680
+ where we sum over all pairs of set partitions `B` and `C`
681
+ whose infimum is `A`.
682
+
683
+ INPUT:
684
+
685
+ - ``A`` -- set partition
686
+
687
+ OUTPUT: an element of the tensor square of the `\mathbf{m}` basis
688
+
689
+ EXAMPLES::
690
+
691
+ sage: m = SymmetricFunctionsNonCommutingVariables(QQ).monomial()
692
+ sage: m.internal_coproduct_on_basis(SetPartition([[1,3],[2]]))
693
+ m{{1, 2, 3}} # m{{1, 3}, {2}} + m{{1, 3}, {2}} # m{{1, 2, 3}} + m{{1, 3}, {2}} # m{{1, 3}, {2}}
694
+ """
695
+ P = SetPartitions()
696
+ SP = SetPartitions(A.size())
697
+ ret = [[A,A]]
698
+ for i, B in enumerate(SP):
699
+ for C in SP[i+1:]:
700
+ if B.inf(C) == A:
701
+ B_std = P(list(B.standardization()))
702
+ C_std = P(list(C.standardization()))
703
+ ret.append([B_std, C_std])
704
+ ret.append([C_std, B_std])
705
+ return self.tensor_square().sum_of_monomials((B, C) for B,C in ret)
706
+
707
+ def sum_of_partitions(self, la):
708
+ r"""
709
+ Return the sum over all set partitions whose shape is ``la``
710
+ with a fixed coefficient `C` defined below.
711
+
712
+ Fix a partition `\lambda`, we define
713
+ `\lambda! := \prod_i \lambda_i!` and `\lambda^! := \prod_i m_i!`.
714
+ Recall that `|\lambda| = \sum_i \lambda_i` and `m_i` is the
715
+ number of parts of length `i` of `\lambda`. Thus we defined the
716
+ coefficient as
717
+
718
+ .. MATH::
719
+
720
+ C := \frac{\lambda! \lambda^!}{|\lambda|!}.
721
+
722
+ Hence we can define a lift `\widetilde{\chi}` from `Sym`
723
+ to `NCSym` by
724
+
725
+ .. MATH::
726
+
727
+ m_{\lambda} \mapsto C \sum_A \mathbf{m}_A
728
+
729
+ where the sum is over all set partitions whose shape
730
+ is `\lambda`.
731
+
732
+ INPUT:
733
+
734
+ - ``la`` -- integer partition
735
+
736
+ OUTPUT: an element of the `\mathbf{m}` basis
737
+
738
+ EXAMPLES::
739
+
740
+ sage: m = SymmetricFunctionsNonCommutingVariables(QQ).m()
741
+ sage: m.sum_of_partitions(Partition([2,1,1]))
742
+ 1/12*m{{1}, {2}, {3, 4}} + 1/12*m{{1}, {2, 3}, {4}} + 1/12*m{{1}, {2, 4}, {3}}
743
+ + 1/12*m{{1, 2}, {3}, {4}} + 1/12*m{{1, 3}, {2}, {4}} + 1/12*m{{1, 4}, {2}, {3}}
744
+
745
+ TESTS:
746
+
747
+ Check that `\chi \circ \widetilde{\chi}` is the identity on `Sym`::
748
+
749
+ sage: m = SymmetricFunctionsNonCommutingVariables(QQ).m()
750
+ sage: mon = SymmetricFunctions(QQ).monomial()
751
+ sage: all(m.from_symmetric_function(mon[la]).to_symmetric_function() == mon[la]
752
+ ....: for i in range(6) for la in Partitions(i))
753
+ True
754
+ """
755
+ from sage.combinat.partition import Partition
756
+ la = Partition(la) # Make sure it is a partition
757
+ R = self.base_ring()
758
+ P = SetPartitions()
759
+ c = R( prod(factorial(i) for i in la) / ZZ(factorial(la.size())) )
760
+ return self._from_dict({P(m): c for m in SetPartitions(sum(la), la)},
761
+ remove_zeros=False)
762
+
763
+ class Element(CombinatorialFreeModule.Element):
764
+ """
765
+ An element in the monomial basis of `NCSym`.
766
+ """
767
+
768
+ def expand(self, n, alphabet='x'):
769
+ r"""
770
+ Expand ``self`` written in the monomial basis in `n`
771
+ non-commuting variables.
772
+
773
+ INPUT:
774
+
775
+ - ``n`` -- integer
776
+ - ``alphabet`` -- string (default: ``'x'``)
777
+
778
+ OUTPUT:
779
+
780
+ - The symmetric function of ``self`` expressed in the ``n``
781
+ non-commuting variables described by ``alphabet``.
782
+
783
+ EXAMPLES::
784
+
785
+ sage: m = SymmetricFunctionsNonCommutingVariables(QQ).monomial()
786
+ sage: m[[1,3],[2]].expand(4)
787
+ x0*x1*x0 + x0*x2*x0 + x0*x3*x0 + x1*x0*x1 + x1*x2*x1 + x1*x3*x1
788
+ + x2*x0*x2 + x2*x1*x2 + x2*x3*x2 + x3*x0*x3 + x3*x1*x3 + x3*x2*x3
789
+
790
+ One can use a different set of variables by using the
791
+ optional argument ``alphabet``::
792
+
793
+ sage: m[[1],[2,3]].expand(3,alphabet='y')
794
+ y0*y1^2 + y0*y2^2 + y1*y0^2 + y1*y2^2 + y2*y0^2 + y2*y1^2
795
+ """
796
+ from sage.algebras.free_algebra import FreeAlgebra
797
+ from sage.combinat.permutation import Permutations
798
+ m = self.parent()
799
+ F = FreeAlgebra(m.base_ring(), n, alphabet)
800
+
801
+ x = F.gens()
802
+
803
+ def on_basis(A):
804
+ basic_term = [0] * A.size()
805
+ for index, part in enumerate(A):
806
+ for i in part:
807
+ basic_term[i-1] = index # -1 for indexing
808
+ return sum( prod(x[p[i]-1] for i in basic_term) # -1 for indexing
809
+ for p in Permutations(n, len(A)) )
810
+ return m._apply_module_morphism(self, on_basis, codomain=F)
811
+
812
+ def to_symmetric_function(self):
813
+ r"""
814
+ The projection of ``self`` to the symmetric functions.
815
+
816
+ Take a symmetric function in non-commuting variables
817
+ expressed in the `\mathbf{m}` basis, and return the projection of
818
+ expressed in the monomial basis of symmetric functions.
819
+
820
+ The map `\chi \colon NCSym \to Sym` is defined by
821
+
822
+ .. MATH::
823
+
824
+ \mathbf{m}_A \mapsto
825
+ m_{\lambda(A)} \prod_i n_i(\lambda(A))!
826
+
827
+ where `\lambda(A)` is the partition associated with `A` by
828
+ taking the sizes of the parts and `n_i(\mu)` is the
829
+ multiplicity of `i` in `\mu`.
830
+
831
+ OUTPUT: an element of the symmetric functions in the monomial basis
832
+
833
+ EXAMPLES::
834
+
835
+ sage: m = SymmetricFunctionsNonCommutingVariables(QQ).monomial()
836
+ sage: m[[1,3],[2]].to_symmetric_function()
837
+ m[2, 1]
838
+ sage: m[[1],[3],[2]].to_symmetric_function()
839
+ 6*m[1, 1, 1]
840
+ """
841
+ m = SymmetricFunctions(self.parent().base_ring()).monomial()
842
+ c = lambda la: prod(factorial(i) for i in la.to_exp())
843
+ return m.sum_of_terms((i.shape(), coeff*c(i.shape()))
844
+ for (i, coeff) in self)
845
+
846
+ m = monomial
847
+
848
+ class elementary(NCSymBasis_abstract):
849
+ r"""
850
+ The Hopf algebra of symmetric functions in non-commuting variables
851
+ in the elementary basis.
852
+
853
+ EXAMPLES::
854
+
855
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
856
+ sage: e = NCSym.e()
857
+ """
858
+
859
+ def __init__(self, NCSym):
860
+ """
861
+ EXAMPLES::
862
+
863
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
864
+ sage: TestSuite(NCSym.e()).run()
865
+ """
866
+ CombinatorialFreeModule.__init__(self, NCSym.base_ring(), SetPartitions(),
867
+ prefix='e', bracket=False,
868
+ category=MultiplicativeNCSymBases(NCSym))
869
+ ## Register coercions
870
+ # monomials
871
+ m = NCSym.m()
872
+ self.module_morphism(self._e_to_m_on_basis, codomain=m).register_as_coercion()
873
+ # powersum
874
+ # NOTE: Keep this ahead of creating the homogeneous basis to
875
+ # get the coercion path m -> p -> e
876
+ p = NCSym.p()
877
+ self.module_morphism(self._e_to_p_on_basis, codomain=p,
878
+ triangular='upper').register_as_coercion()
879
+ p.module_morphism(p._p_to_e_on_basis, codomain=self,
880
+ triangular='upper').register_as_coercion()
881
+ # homogeneous
882
+ h = NCSym.h()
883
+ self.module_morphism(self._e_to_h_on_basis, codomain=h,
884
+ triangular='upper').register_as_coercion()
885
+ h.module_morphism(h._h_to_e_on_basis, codomain=self,
886
+ triangular='upper').register_as_coercion()
887
+
888
+ @cached_method
889
+ def _e_to_m_on_basis(self, A):
890
+ r"""
891
+ Return `\mathbf{e}_A` in terms of the monomial basis.
892
+
893
+ INPUT:
894
+
895
+ - ``A`` -- set partition
896
+
897
+ OUTPUT: an element of the `\mathbf{m}` basis
898
+
899
+ TESTS::
900
+
901
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
902
+ sage: e = NCSym.e()
903
+ sage: all(e(e._e_to_m_on_basis(A)) == e[A] for i in range(5)
904
+ ....: for A in SetPartitions(i))
905
+ True
906
+ """
907
+ m = self.realization_of().m()
908
+ n = A.size()
909
+ P = SetPartitions(n)
910
+ min_elt = P([[i] for i in range(1, n+1)])
911
+ one = self.base_ring().one()
912
+ return m._from_dict({B: one for B in P if A.inf(B) == min_elt},
913
+ remove_zeros=False)
914
+
915
+ @cached_method
916
+ def _e_to_h_on_basis(self, A):
917
+ r"""
918
+ Return `\mathbf{e}_A` in terms of the homogeneous basis.
919
+
920
+ INPUT:
921
+
922
+ - ``A`` -- set partition
923
+
924
+ OUTPUT: an element of the `\mathbf{h}` basis
925
+
926
+ TESTS::
927
+
928
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
929
+ sage: e = NCSym.e()
930
+ sage: all(e(e._e_to_h_on_basis(A)) == e[A] for i in range(5)
931
+ ....: for A in SetPartitions(i))
932
+ True
933
+ """
934
+ h = self.realization_of().h()
935
+ sign = lambda B: (-1)**(B.size() - len(B))
936
+ coeff = lambda B: sign(B) * prod(factorial(sum( 1 for part in B if part.issubset(big) )) for big in A)
937
+ R = self.base_ring()
938
+ return h._from_dict({B: R(coeff(B)) for B in A.refinements()},
939
+ remove_zeros=False)
940
+
941
+ @cached_method
942
+ def _e_to_p_on_basis(self, A):
943
+ r"""
944
+ Return `\mathbf{e}_A` in terms of the powersum basis.
945
+
946
+ INPUT:
947
+
948
+ - ``A`` -- set partition
949
+
950
+ OUTPUT: an element of the `\mathbf{p}` basis
951
+
952
+ TESTS::
953
+
954
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
955
+ sage: e = NCSym.e()
956
+ sage: all(e(e._e_to_p_on_basis(A)) == e[A] for i in range(5)
957
+ ....: for A in SetPartitions(i))
958
+ True
959
+ """
960
+ p = self.realization_of().p()
961
+ coeff = lambda B: prod([(-1)**(i-1) * factorial(i-1) for i in B.shape()])
962
+ R = self.base_ring()
963
+ return p._from_dict({B: R(coeff(B)) for B in A.refinements()},
964
+ remove_zeros=False)
965
+
966
+ class Element(CombinatorialFreeModule.Element):
967
+ """
968
+ An element in the elementary basis of `NCSym`.
969
+ """
970
+
971
+ def omega(self):
972
+ r"""
973
+ Return the involution `\omega` applied to ``self``.
974
+
975
+ The involution `\omega` on `NCSym` is defined by
976
+ `\omega(\mathbf{e}_A) = \mathbf{h}_A`.
977
+
978
+ OUTPUT: an element in the basis ``self``
979
+
980
+ EXAMPLES::
981
+
982
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
983
+ sage: e = NCSym.e()
984
+ sage: h = NCSym.h()
985
+ sage: elt = e[[1,3],[2]].omega(); elt
986
+ 2*e{{1}, {2}, {3}} - e{{1, 3}, {2}}
987
+ sage: elt.omega()
988
+ e{{1, 3}, {2}}
989
+ sage: h(elt)
990
+ h{{1, 3}, {2}}
991
+ """
992
+ P = self.parent()
993
+ h = P.realization_of().h()
994
+ return P(h.sum_of_terms(self))
995
+
996
+ def to_symmetric_function(self):
997
+ r"""
998
+ The projection of ``self`` to the symmetric functions.
999
+
1000
+ Take a symmetric function in non-commuting variables
1001
+ expressed in the `\mathbf{e}` basis, and return the projection of
1002
+ expressed in the elementary basis of symmetric functions.
1003
+
1004
+ The map `\chi \colon NCSym \to Sym` is given by
1005
+
1006
+ .. MATH::
1007
+
1008
+ \mathbf{e}_A \mapsto
1009
+ e_{\lambda(A)} \prod_i \lambda(A)_i!
1010
+
1011
+ where `\lambda(A)` is the partition associated with `A` by
1012
+ taking the sizes of the parts.
1013
+
1014
+ OUTPUT: an element of the symmetric functions in the elementary basis
1015
+
1016
+ EXAMPLES::
1017
+
1018
+ sage: e = SymmetricFunctionsNonCommutingVariables(QQ).e()
1019
+ sage: e[[1,3],[2]].to_symmetric_function()
1020
+ 2*e[2, 1]
1021
+ sage: e[[1],[3],[2]].to_symmetric_function()
1022
+ e[1, 1, 1]
1023
+ """
1024
+ e = SymmetricFunctions(self.parent().base_ring()).e()
1025
+ c = lambda la: prod(factorial(i) for i in la)
1026
+ return e.sum_of_terms((i.shape(), coeff*c(i.shape()))
1027
+ for (i, coeff) in self)
1028
+
1029
+ e = elementary
1030
+
1031
+ class homogeneous(NCSymBasis_abstract):
1032
+ r"""
1033
+ The Hopf algebra of symmetric functions in non-commuting variables
1034
+ in the homogeneous basis.
1035
+
1036
+ EXAMPLES::
1037
+
1038
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
1039
+ sage: h = NCSym.h()
1040
+ sage: h[[1,3],[2,4]]*h[[1,2,3]]
1041
+ h{{1, 3}, {2, 4}, {5, 6, 7}}
1042
+ sage: h[[1,2]].coproduct()
1043
+ h{} # h{{1, 2}} + 2*h{{1}} # h{{1}} + h{{1, 2}} # h{}
1044
+ """
1045
+
1046
+ def __init__(self, NCSym):
1047
+ """
1048
+ EXAMPLES::
1049
+
1050
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
1051
+ sage: TestSuite(NCSym.h()).run()
1052
+ """
1053
+ CombinatorialFreeModule.__init__(self, NCSym.base_ring(), SetPartitions(),
1054
+ prefix='h', bracket=False,
1055
+ category=MultiplicativeNCSymBases(NCSym))
1056
+ # Register coercions
1057
+ m = NCSym.m()
1058
+ self.module_morphism(self._h_to_m_on_basis, codomain=m).register_as_coercion()
1059
+ p = NCSym.p()
1060
+ self.module_morphism(self._h_to_p_on_basis, codomain=p).register_as_coercion()
1061
+ p.module_morphism(p._p_to_h_on_basis, codomain=self).register_as_coercion()
1062
+
1063
+ @cached_method
1064
+ def _h_to_m_on_basis(self, A):
1065
+ r"""
1066
+ Return `\mathbf{h}_A` in terms of the monomial basis.
1067
+
1068
+ INPUT:
1069
+
1070
+ - ``A`` -- set partition
1071
+
1072
+ OUTPUT: an element of the `\mathbf{m}` basis
1073
+
1074
+ TESTS::
1075
+
1076
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
1077
+ sage: h = NCSym.h()
1078
+ sage: all(h(h._h_to_m_on_basis(A)) == h[A] for i in range(5)
1079
+ ....: for A in SetPartitions(i))
1080
+ True
1081
+ """
1082
+ P = SetPartitions()
1083
+ m = self.realization_of().m()
1084
+ coeff = lambda B: prod(factorial(i) for i in B.shape())
1085
+ R = self.base_ring()
1086
+ return m._from_dict({P(B): R( coeff(A.inf(B)) )
1087
+ for B in SetPartitions(A.size())}, remove_zeros=False)
1088
+
1089
+ @cached_method
1090
+ def _h_to_e_on_basis(self, A):
1091
+ r"""
1092
+ Return `\mathbf{h}_A` in terms of the elementary basis.
1093
+
1094
+ INPUT:
1095
+
1096
+ - ``A`` -- set partition
1097
+
1098
+ OUTPUT: an element of the `\mathbf{e}` basis
1099
+
1100
+ TESTS::
1101
+
1102
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
1103
+ sage: h = NCSym.h()
1104
+ sage: all(h(h._h_to_e_on_basis(A)) == h[A] for i in range(5)
1105
+ ....: for A in SetPartitions(i))
1106
+ True
1107
+ """
1108
+ e = self.realization_of().e()
1109
+ sign = lambda B: (-1)**(B.size() - len(B))
1110
+ coeff = lambda B: (sign(B) * prod(factorial(sum( 1 for part in B if part.issubset(big) ))
1111
+ for big in A))
1112
+ R = self.base_ring()
1113
+ return e._from_dict({B: R(coeff(B)) for B in A.refinements()},
1114
+ remove_zeros=False)
1115
+
1116
+ @cached_method
1117
+ def _h_to_p_on_basis(self, A):
1118
+ r"""
1119
+ Return `\mathbf{h}_A` in terms of the powersum basis.
1120
+
1121
+ INPUT:
1122
+
1123
+ - ``A`` -- set partition
1124
+
1125
+ OUTPUT: an element of the `\mathbf{p}` basis
1126
+
1127
+ TESTS::
1128
+
1129
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
1130
+ sage: h = NCSym.h()
1131
+ sage: all(h(h._h_to_p_on_basis(A)) == h[A] for i in range(5)
1132
+ ....: for A in SetPartitions(i))
1133
+ True
1134
+ """
1135
+ p = self.realization_of().p()
1136
+ coeff = lambda B: abs( prod([(-1)**(i-1) * factorial(i-1) for i in B.shape()]) )
1137
+ R = self.base_ring()
1138
+ return p._from_dict({B: R(coeff(B)) for B in A.refinements()},
1139
+ remove_zeros=False)
1140
+
1141
+ class Element(CombinatorialFreeModule.Element):
1142
+ """
1143
+ An element in the homogeneous basis of `NCSym`.
1144
+ """
1145
+
1146
+ def omega(self):
1147
+ r"""
1148
+ Return the involution `\omega` applied to ``self``.
1149
+
1150
+ The involution `\omega` on `NCSym` is defined by
1151
+ `\omega(\mathbf{h}_A) = \mathbf{e}_A`.
1152
+
1153
+ OUTPUT: an element in the basis ``self``
1154
+
1155
+ EXAMPLES::
1156
+
1157
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
1158
+ sage: h = NCSym.h()
1159
+ sage: e = NCSym.e()
1160
+ sage: elt = h[[1,3],[2]].omega(); elt
1161
+ 2*h{{1}, {2}, {3}} - h{{1, 3}, {2}}
1162
+ sage: elt.omega()
1163
+ h{{1, 3}, {2}}
1164
+ sage: e(elt)
1165
+ e{{1, 3}, {2}}
1166
+ """
1167
+ P = self.parent()
1168
+ e = self.parent().realization_of().e()
1169
+ return P(e.sum_of_terms(self))
1170
+
1171
+ def to_symmetric_function(self):
1172
+ r"""
1173
+ The projection of ``self`` to the symmetric functions.
1174
+
1175
+ Take a symmetric function in non-commuting variables
1176
+ expressed in the `\mathbf{h}` basis, and return the projection of
1177
+ expressed in the complete basis of symmetric functions.
1178
+
1179
+ The map `\chi \colon NCSym \to Sym` is given by
1180
+
1181
+ .. MATH::
1182
+
1183
+ \mathbf{h}_A \mapsto
1184
+ h_{\lambda(A)} \prod_i \lambda(A)_i!
1185
+
1186
+ where `\lambda(A)` is the partition associated with `A` by
1187
+ taking the sizes of the parts.
1188
+
1189
+ OUTPUT: an element of the symmetric functions in the complete basis
1190
+
1191
+ EXAMPLES::
1192
+
1193
+ sage: h = SymmetricFunctionsNonCommutingVariables(QQ).h()
1194
+ sage: h[[1,3],[2]].to_symmetric_function()
1195
+ 2*h[2, 1]
1196
+ sage: h[[1],[3],[2]].to_symmetric_function()
1197
+ h[1, 1, 1]
1198
+ """
1199
+ h = SymmetricFunctions(self.parent().base_ring()).h()
1200
+ c = lambda la: prod(factorial(i) for i in la)
1201
+ return h.sum_of_terms((i.shape(), coeff*c(i.shape()))
1202
+ for (i, coeff) in self)
1203
+
1204
+ h = homogeneous
1205
+
1206
+ class powersum(NCSymBasis_abstract):
1207
+ r"""
1208
+ The Hopf algebra of symmetric functions in non-commuting variables
1209
+ in the powersum basis.
1210
+
1211
+ The powersum basis is given by
1212
+
1213
+ .. MATH::
1214
+
1215
+ \mathbf{p}_A = \sum_{A \leq B} \mathbf{m}_B,
1216
+
1217
+ where we sum over all coarsenings of the set partition `A`. If we
1218
+ allow our variables to commute, then `\mathbf{p}_A` goes to the
1219
+ usual powersum symmetric function `p_{\lambda}` whose (integer)
1220
+ partition `\lambda` is the shape of `A`.
1221
+
1222
+ EXAMPLES::
1223
+
1224
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
1225
+ sage: p = NCSym.p()
1226
+
1227
+ sage: x = p.an_element()**2; x
1228
+ 4*p{} + 8*p{{1}} + 4*p{{1}, {2}} + 6*p{{1}, {2, 3}}
1229
+ + 12*p{{1, 2}} + 6*p{{1, 2}, {3}} + 9*p{{1, 2}, {3, 4}}
1230
+ sage: x.to_symmetric_function()
1231
+ 4*p[] + 8*p[1] + 4*p[1, 1] + 12*p[2] + 12*p[2, 1] + 9*p[2, 2]
1232
+ """
1233
+
1234
+ def __init__(self, NCSym):
1235
+ """
1236
+ EXAMPLES::
1237
+
1238
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
1239
+ sage: TestSuite(NCSym.p()).run()
1240
+ """
1241
+ CombinatorialFreeModule.__init__(self, NCSym.base_ring(), SetPartitions(),
1242
+ prefix='p', bracket=False,
1243
+ category=MultiplicativeNCSymBases(NCSym))
1244
+ # Register coercions
1245
+ m = NCSym.m()
1246
+ self.module_morphism(self._p_to_m_on_basis, codomain=m,
1247
+ unitriangular='lower').register_as_coercion()
1248
+ m.module_morphism(m._m_to_p_on_basis, codomain=self,
1249
+ unitriangular='lower').register_as_coercion()
1250
+ x = NCSym.x()
1251
+ self.module_morphism(self._p_to_x_on_basis, codomain=x,
1252
+ unitriangular='upper').register_as_coercion()
1253
+ x.module_morphism(x._x_to_p_on_basis, codomain=self,
1254
+ unitriangular='upper').register_as_coercion()
1255
+
1256
+ @cached_method
1257
+ def _p_to_m_on_basis(self, A):
1258
+ r"""
1259
+ Return `\mathbf{p}_A` in terms of the monomial basis.
1260
+
1261
+ INPUT:
1262
+
1263
+ - ``A`` -- set partition
1264
+
1265
+ OUTPUT: an element of the `\mathbf{m}` basis
1266
+
1267
+ TESTS::
1268
+
1269
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
1270
+ sage: p = NCSym.p()
1271
+ sage: all(p(p._p_to_m_on_basis(A)) == p[A] for i in range(5)
1272
+ ....: for A in SetPartitions(i))
1273
+ True
1274
+ """
1275
+ m = self.realization_of().m()
1276
+ one = self.base_ring().one()
1277
+ return m._from_dict({B: one for B in A.coarsenings()}, remove_zeros=False)
1278
+
1279
+ @cached_method
1280
+ def _p_to_e_on_basis(self, A):
1281
+ r"""
1282
+ Return `\mathbf{p}_A` in terms of the elementary basis.
1283
+
1284
+ INPUT:
1285
+
1286
+ - ``A`` -- set partition
1287
+
1288
+ OUTPUT: an element of the `\mathbf{e}` basis
1289
+
1290
+ TESTS::
1291
+
1292
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
1293
+ sage: p = NCSym.p()
1294
+ sage: all(p(p._p_to_e_on_basis(A)) == p[A] for i in range(5)
1295
+ ....: for A in SetPartitions(i))
1296
+ True
1297
+ """
1298
+ e = self.realization_of().e()
1299
+ P_refine = Poset((A.refinements(), A.parent().lt))
1300
+ c = prod((-1)**(i-1) * factorial(i-1) for i in A.shape())
1301
+ R = self.base_ring()
1302
+ return e._from_dict({B: R(P_refine.moebius_function(B, A) / ZZ(c))
1303
+ for B in P_refine}, remove_zeros=False)
1304
+
1305
+ @cached_method
1306
+ def _p_to_h_on_basis(self, A):
1307
+ r"""
1308
+ Return `\mathbf{p}_A` in terms of the homogeneous basis.
1309
+
1310
+ INPUT:
1311
+
1312
+ - ``A`` -- set partition
1313
+
1314
+ OUTPUT: an element of the `\mathbf{h}` basis
1315
+
1316
+ TESTS::
1317
+
1318
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
1319
+ sage: p = NCSym.p()
1320
+ sage: all(p(p._p_to_h_on_basis(A)) == p[A] for i in range(5)
1321
+ ....: for A in SetPartitions(i))
1322
+ True
1323
+ """
1324
+ h = self.realization_of().h()
1325
+ P_refine = Poset((A.refinements(), A.parent().lt))
1326
+ c = abs(prod((-1)**(i-1) * factorial(i-1) for i in A.shape()))
1327
+ R = self.base_ring()
1328
+ return h._from_dict({B: R(P_refine.moebius_function(B, A) / ZZ(c))
1329
+ for B in P_refine}, remove_zeros=False)
1330
+
1331
+ @cached_method
1332
+ def _p_to_x_on_basis(self, A):
1333
+ r"""
1334
+ Return `\mathbf{p}_A` in terms of the `\mathbf{x}` basis.
1335
+
1336
+ INPUT:
1337
+
1338
+ - ``A`` -- set partition
1339
+
1340
+ OUTPUT: an element of the `\mathbf{x}` basis
1341
+
1342
+ TESTS::
1343
+
1344
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
1345
+ sage: p = NCSym.p()
1346
+ sage: all(p(p._p_to_x_on_basis(A)) == p[A] for i in range(5)
1347
+ ....: for A in SetPartitions(i))
1348
+ True
1349
+ """
1350
+ x = self.realization_of().x()
1351
+ one = self.base_ring().one()
1352
+ return x._from_dict({B: one for B in A.refinements()}, remove_zeros=False)
1353
+
1354
+ # Note that this is the same as the monomial coproduct_on_basis
1355
+ def coproduct_on_basis(self, A):
1356
+ r"""
1357
+ Return the coproduct of a monomial basis element.
1358
+
1359
+ INPUT:
1360
+
1361
+ - ``A`` -- set partition
1362
+
1363
+ OUTPUT:
1364
+
1365
+ - The coproduct applied to the monomial symmetric function in
1366
+ non-commuting variables indexed by ``A`` expressed in the
1367
+ monomial basis.
1368
+
1369
+ EXAMPLES::
1370
+
1371
+ sage: p = SymmetricFunctionsNonCommutingVariables(QQ).powersum()
1372
+ sage: p[[1, 3], [2]].coproduct()
1373
+ p{} # p{{1, 3}, {2}} + p{{1}} # p{{1, 2}} + p{{1, 2}} # p{{1}} + p{{1, 3}, {2}} # p{}
1374
+ sage: p.coproduct_on_basis(SetPartition([[1]]))
1375
+ p{} # p{{1}} + p{{1}} # p{}
1376
+ sage: p.coproduct_on_basis(SetPartition([]))
1377
+ p{} # p{}
1378
+ """
1379
+ P = SetPartitions()
1380
+ # Handle corner cases
1381
+ if not A:
1382
+ return self.tensor_square().monomial(( P([]), P([]) ))
1383
+ if len(A) == 1:
1384
+ return self.tensor_square().sum_of_monomials([(P([]), A), (A, P([]))])
1385
+
1386
+ ell_set = list(range(1, len(A) + 1)) # +1 for indexing
1387
+ L = [[[], ell_set]] + list(SetPartitions(ell_set, 2))
1388
+
1389
+ def to_basis(S):
1390
+ if not S:
1391
+ return P([])
1392
+ sub_parts = [list(A[i-1]) for i in S] # -1 for indexing
1393
+ mins = [min(p) for p in sub_parts]
1394
+ over_max = max([max(p) for p in sub_parts]) + 1
1395
+ ret = [[] for _ in repeat(None, len(S))]
1396
+ cur = 1
1397
+ while min(mins) != over_max:
1398
+ m = min(mins)
1399
+ i = mins.index(m)
1400
+ ret[i].append(cur)
1401
+ cur += 1
1402
+ sub_parts[i].pop(sub_parts[i].index(m))
1403
+ if sub_parts[i]:
1404
+ mins[i] = min(sub_parts[i])
1405
+ else:
1406
+ mins[i] = over_max
1407
+ return P(ret)
1408
+ L1 = [(to_basis(S), to_basis(C)) for S,C in L]
1409
+ L2 = [(M, N) for N,M in L1]
1410
+ return self.tensor_square().sum_of_monomials(L1 + L2)
1411
+
1412
+ def internal_coproduct_on_basis(self, A):
1413
+ r"""
1414
+ Return the internal coproduct of a powersum basis element.
1415
+
1416
+ The internal coproduct is defined by
1417
+
1418
+ .. MATH::
1419
+
1420
+ \Delta^{\odot}(\mathbf{p}_A) = \mathbf{p}_A \otimes
1421
+ \mathbf{p}_A
1422
+
1423
+ INPUT:
1424
+
1425
+ - ``A`` -- set partition
1426
+
1427
+ OUTPUT: an element of the tensor square of ``self``
1428
+
1429
+ EXAMPLES::
1430
+
1431
+ sage: p = SymmetricFunctionsNonCommutingVariables(QQ).powersum()
1432
+ sage: p.internal_coproduct_on_basis(SetPartition([[1,3],[2]]))
1433
+ p{{1, 3}, {2}} # p{{1, 3}, {2}}
1434
+ """
1435
+ return self.tensor_square().monomial((A, A))
1436
+
1437
+ def antipode_on_basis(self, A):
1438
+ r"""
1439
+ Return the result of the antipode applied to a powersum basis element.
1440
+
1441
+ Let `A` be a set partition. The antipode given in [LM2011]_ is
1442
+
1443
+ .. MATH::
1444
+
1445
+ S(\mathbf{p}_A) = \sum_{\gamma} (-1)^{\ell(\gamma)}
1446
+ \mathbf{p}_{\gamma[A]}
1447
+
1448
+ where we sum over all ordered set partitions (i.e. set
1449
+ compositions) of `[\ell(A)]` and
1450
+
1451
+ .. MATH::
1452
+
1453
+ \gamma[A] = A_{\gamma_1}^{\downarrow} | \cdots |
1454
+ A_{\gamma_{\ell(A)}}^{\downarrow}
1455
+
1456
+ is the action of `\gamma` on `A` defined in
1457
+ :meth:`SetPartition.ordered_set_partition_action()`.
1458
+
1459
+ INPUT:
1460
+
1461
+ - ``A`` -- set partition
1462
+
1463
+ OUTPUT: an element in the basis ``self``
1464
+
1465
+ EXAMPLES::
1466
+
1467
+ sage: p = SymmetricFunctionsNonCommutingVariables(QQ).powersum()
1468
+ sage: p.antipode_on_basis(SetPartition([[1], [2,3]]))
1469
+ p{{1, 2}, {3}}
1470
+ sage: p.antipode_on_basis(SetPartition([]))
1471
+ p{}
1472
+ sage: F = p[[1,3],[5],[2,4]].coproduct()
1473
+ sage: F.apply_multilinear_morphism(lambda x,y: x.antipode()*y)
1474
+ 0
1475
+ """
1476
+ P = SetPartitions()
1477
+
1478
+ def action(gamma):
1479
+ cur = 1
1480
+ ret = []
1481
+ for S in gamma:
1482
+ sub_parts = [list(A[i - 1]) for i in S] # -1 for indexing
1483
+ mins = [min(p) for p in sub_parts]
1484
+ over_max = max([max(p) for p in sub_parts]) + 1
1485
+ temp = [[] for _ in repeat(None, len(S))]
1486
+ while min(mins) != over_max:
1487
+ m = min(mins)
1488
+ i = mins.index(m)
1489
+ temp[i].append(cur)
1490
+ cur += 1
1491
+ sub_parts[i].pop(sub_parts[i].index(m))
1492
+ if sub_parts[i]:
1493
+ mins[i] = min(sub_parts[i])
1494
+ else:
1495
+ mins[i] = over_max
1496
+ ret += temp
1497
+ return P(ret)
1498
+ return self.sum_of_terms( (A.ordered_set_partition_action(gamma), (-1)**len(gamma))
1499
+ for gamma in OrderedSetPartitions(len(A)) )
1500
+
1501
+ def primitive(self, A, i=1):
1502
+ r"""
1503
+ Return the primitive associated to ``A`` in ``self``.
1504
+
1505
+ Fix some `i \in S`. Let `A` be an atomic set partition of `S`,
1506
+ then the primitive `p(A)` given in [LM2011]_ is
1507
+
1508
+ .. MATH::
1509
+
1510
+ p(A) = \sum_{\gamma} (-1)^{\ell(\gamma)-1}
1511
+ \mathbf{p}_{\gamma[A]}
1512
+
1513
+ where we sum over all ordered set partitions of `[\ell(A)]` such
1514
+ that `i \in \gamma_1` and `\gamma[A]` is the action of `\gamma`
1515
+ on `A` defined in
1516
+ :meth:`SetPartition.ordered_set_partition_action()`.
1517
+ If `A` is not atomic, then `p(A) = 0`.
1518
+
1519
+ .. SEEALSO:: :meth:`SetPartition.is_atomic`
1520
+
1521
+ INPUT:
1522
+
1523
+ - ``A`` -- set partition
1524
+ - ``i`` -- (default: 1) index in the base set for ``A`` specifying
1525
+ which set of primitives this belongs to
1526
+
1527
+ OUTPUT: an element in the basis ``self``
1528
+
1529
+ EXAMPLES::
1530
+
1531
+ sage: p = SymmetricFunctionsNonCommutingVariables(QQ).powersum()
1532
+ sage: elt = p.primitive(SetPartition([[1,3], [2]])); elt
1533
+ -p{{1, 2}, {3}} + p{{1, 3}, {2}}
1534
+ sage: elt.coproduct()
1535
+ -p{} # p{{1, 2}, {3}} + p{} # p{{1, 3}, {2}} - p{{1, 2}, {3}} # p{} + p{{1, 3}, {2}} # p{}
1536
+ sage: p.primitive(SetPartition([[1], [2,3]]))
1537
+ 0
1538
+ sage: p.primitive(SetPartition([]))
1539
+ p{}
1540
+ """
1541
+ if not A:
1542
+ return self.one()
1543
+ A = SetPartitions()(A) # Make sure it's a set partition
1544
+ if not A.is_atomic():
1545
+ return self.zero()
1546
+ return self.sum_of_terms( (A.ordered_set_partition_action(gamma), (-1)**(len(gamma)-1))
1547
+ for gamma in OrderedSetPartitions(len(A)) if i in gamma[0] )
1548
+
1549
+ class Element(CombinatorialFreeModule.Element):
1550
+ """
1551
+ An element in the powersum basis of `NCSym`.
1552
+ """
1553
+
1554
+ def to_symmetric_function(self):
1555
+ r"""
1556
+ The projection of ``self`` to the symmetric functions.
1557
+
1558
+ Take a symmetric function in non-commuting variables
1559
+ expressed in the `\mathbf{p}` basis, and return the projection of
1560
+ expressed in the powersum basis of symmetric functions.
1561
+
1562
+ The map `\chi \colon NCSym \to Sym` is given by
1563
+
1564
+ .. MATH::
1565
+
1566
+ \mathbf{p}_A \mapsto p_{\lambda(A)}
1567
+
1568
+ where `\lambda(A)` is the partition associated with `A` by
1569
+ taking the sizes of the parts.
1570
+
1571
+ OUTPUT: an element of symmetric functions in the power sum basis
1572
+
1573
+ EXAMPLES::
1574
+
1575
+ sage: p = SymmetricFunctionsNonCommutingVariables(QQ).p()
1576
+ sage: p[[1,3],[2]].to_symmetric_function()
1577
+ p[2, 1]
1578
+ sage: p[[1],[3],[2]].to_symmetric_function()
1579
+ p[1, 1, 1]
1580
+ """
1581
+ p = SymmetricFunctions(self.parent().base_ring()).p()
1582
+ return p.sum_of_terms((i.shape(), coeff) for (i, coeff) in self)
1583
+
1584
+ p = powersum
1585
+
1586
+ class coarse_powersum(NCSymBasis_abstract):
1587
+ r"""
1588
+ The Hopf algebra of symmetric functions in non-commuting variables
1589
+ in the `\mathbf{cp}` basis.
1590
+
1591
+ This basis was defined in [BZ05]_ as
1592
+
1593
+ .. MATH::
1594
+
1595
+ \mathbf{cp}_A = \sum_{A \leq_* B} \mathbf{m}_B,
1596
+
1597
+ where we sum over all strict coarsenings of the set partition `A`.
1598
+ An alternative description of this basis was given in [BT13]_ as
1599
+
1600
+ .. MATH::
1601
+
1602
+ \mathbf{cp}_A = \sum_{A \subseteq B} \mathbf{m}_B,
1603
+
1604
+ where we sum over all set partitions whose arcs are a subset of
1605
+ the arcs of the set partition `A`.
1606
+
1607
+ .. NOTE::
1608
+
1609
+ In [BZ05]_, this basis was denoted by `\mathbf{q}`. In [BT13]_,
1610
+ this basis was called the powersum basis and denoted by `p`.
1611
+ However it is a coarser basis than the usual powersum basis in
1612
+ the sense that it does not yield the usual powersum basis
1613
+ of the symmetric function under the natural map of letting
1614
+ the variables commute.
1615
+
1616
+ EXAMPLES::
1617
+
1618
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
1619
+ sage: cp = NCSym.cp()
1620
+ sage: cp[[1,3],[2,4]]*cp[[1,2,3]]
1621
+ cp{{1, 3}, {2, 4}, {5, 6, 7}}
1622
+ sage: cp[[1,2],[3]].internal_coproduct()
1623
+ cp{{1, 2}, {3}} # cp{{1, 2}, {3}}
1624
+ sage: ps = SymmetricFunctions(NCSym.base_ring()).p()
1625
+ sage: ps(cp[[1,3],[2]].to_symmetric_function())
1626
+ p[2, 1] - p[3]
1627
+ sage: ps(cp[[1,2],[3]].to_symmetric_function())
1628
+ p[2, 1]
1629
+ """
1630
+
1631
+ def __init__(self, NCSym):
1632
+ """
1633
+ EXAMPLES::
1634
+
1635
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
1636
+ sage: TestSuite(NCSym.cp()).run()
1637
+ """
1638
+ CombinatorialFreeModule.__init__(self, NCSym.base_ring(), SetPartitions(),
1639
+ prefix='cp', bracket=False,
1640
+ category=MultiplicativeNCSymBases(NCSym))
1641
+ # Register coercions
1642
+ m = NCSym.m()
1643
+ self.module_morphism(self._cp_to_m_on_basis, codomain=m,
1644
+ unitriangular='lower').register_as_coercion()
1645
+ m.module_morphism(m._m_to_cp_on_basis, codomain=self,
1646
+ unitriangular='lower').register_as_coercion()
1647
+
1648
+ @cached_method
1649
+ def _cp_to_m_on_basis(self, A):
1650
+ r"""
1651
+ Return `\mathbf{cp}_A` in terms of the monomial basis.
1652
+
1653
+ INPUT:
1654
+
1655
+ - ``A`` -- set partition
1656
+
1657
+ OUTPUT: an element of the `\mathbf{m}` basis
1658
+
1659
+ TESTS::
1660
+
1661
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
1662
+ sage: cp = NCSym.cp()
1663
+ sage: all(cp(cp._cp_to_m_on_basis(A)) == cp[A] for i in range(5)
1664
+ ....: for A in SetPartitions(i))
1665
+ True
1666
+ """
1667
+ m = self.realization_of().m()
1668
+ one = self.base_ring().one()
1669
+ return m._from_dict({B: one for B in A.strict_coarsenings()},
1670
+ remove_zeros=False)
1671
+
1672
+ cp = coarse_powersum
1673
+
1674
+ class x_basis(NCSymBasis_abstract):
1675
+ r"""
1676
+ The Hopf algebra of symmetric functions in non-commuting variables
1677
+ in the `\mathbf{x}` basis.
1678
+
1679
+ This basis is defined in [BHRZ06]_ by the formula:
1680
+
1681
+ .. MATH::
1682
+
1683
+ \mathbf{x}_A = \sum_{B \leq A} \mu(B, A) \mathbf{p}_B
1684
+
1685
+ and has the following properties:
1686
+
1687
+ .. MATH::
1688
+
1689
+ \mathbf{x}_A \mathbf{x}_B = \mathbf{x}_{A|B}, \quad \quad
1690
+ \Delta^{\odot}(\mathbf{x}_C) = \sum_{A \vee B = C} \mathbf{x}_A
1691
+ \otimes \mathbf{x}_B.
1692
+
1693
+ EXAMPLES::
1694
+
1695
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
1696
+ sage: x = NCSym.x()
1697
+ sage: x[[1,3],[2,4]]*x[[1,2,3]]
1698
+ x{{1, 3}, {2, 4}, {5, 6, 7}}
1699
+ sage: x[[1,2],[3]].internal_coproduct()
1700
+ x{{1}, {2}, {3}} # x{{1, 2}, {3}} + x{{1, 2}, {3}} # x{{1}, {2}, {3}} +
1701
+ x{{1, 2}, {3}} # x{{1, 2}, {3}}
1702
+ """
1703
+
1704
+ def __init__(self, NCSym):
1705
+ """
1706
+ EXAMPLES::
1707
+
1708
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
1709
+ sage: TestSuite(NCSym.x()).run()
1710
+ """
1711
+ CombinatorialFreeModule.__init__(self, NCSym.base_ring(), SetPartitions(),
1712
+ prefix='x', bracket=False,
1713
+ category=MultiplicativeNCSymBases(NCSym))
1714
+
1715
+ @cached_method
1716
+ def _x_to_p_on_basis(self, A):
1717
+ r"""
1718
+ Return `\mathbf{x}_A` in terms of the powersum basis.
1719
+
1720
+ INPUT:
1721
+
1722
+ - ``A`` -- set partition
1723
+
1724
+ OUTPUT: an element of the `\mathbf{p}` basis
1725
+
1726
+ TESTS::
1727
+
1728
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
1729
+ sage: x = NCSym.x()
1730
+ sage: all(x(x._x_to_p_on_basis(A)) == x[A] for i in range(5)
1731
+ ....: for A in SetPartitions(i))
1732
+ True
1733
+ """
1734
+ def lt(s, t):
1735
+ if s == t:
1736
+ return False
1737
+ for p in s:
1738
+ if len([z for z in t if z.intersection(p)]) != 1:
1739
+ return False
1740
+ return True
1741
+
1742
+ p = self.realization_of().p()
1743
+ P_refine = Poset((A.refinements(), lt))
1744
+ R = self.base_ring()
1745
+ return p._from_dict({B: R(P_refine.moebius_function(B, A))
1746
+ for B in P_refine})
1747
+
1748
+ x = x_basis
1749
+
1750
+ class deformed_coarse_powersum(NCSymBasis_abstract):
1751
+ r"""
1752
+ The Hopf algebra of symmetric functions in non-commuting variables
1753
+ in the `\rho` basis.
1754
+
1755
+ This basis was defined in [BT13]_ as a `q`-deformation of the
1756
+ `\mathbf{cp}` basis:
1757
+
1758
+ .. MATH::
1759
+
1760
+ \rho_A = \sum_{A \subseteq B}
1761
+ \frac{1}{q^{\operatorname{nst}_{B-A}^A}} \mathbf{m}_B,
1762
+
1763
+ where we sum over all set partitions whose arcs are a subset of
1764
+ the arcs of the set partition `A`.
1765
+
1766
+ INPUT:
1767
+
1768
+ - ``q`` -- (default: ``2``) the parameter `q`
1769
+
1770
+ EXAMPLES::
1771
+
1772
+ sage: R = QQ['q'].fraction_field()
1773
+ sage: q = R.gen()
1774
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(R)
1775
+ sage: rho = NCSym.rho(q)
1776
+
1777
+ We construct Example 3.1 in [BT13]_::
1778
+
1779
+ sage: rnode = lambda A: sorted([a[1] for a in A.arcs()], reverse=True)
1780
+ sage: dimv = lambda A: sorted([a[1]-a[0] for a in A.arcs()], reverse=True)
1781
+ sage: lst = list(SetPartitions(4))
1782
+ sage: S = sorted(lst, key=lambda A: (dimv(A), rnode(A)))
1783
+ sage: m = NCSym.m()
1784
+ sage: matrix([[m(rho[A])[B] for B in S] for A in S])
1785
+ [ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]
1786
+ [ 0 1 0 0 1 1 0 1 0 0 1 0 0 0 0]
1787
+ [ 0 0 1 0 1 0 1 1 0 0 0 0 0 0 1]
1788
+ [ 0 0 0 1 0 1 1 1 0 0 0 1 0 0 0]
1789
+ [ 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0]
1790
+ [ 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0]
1791
+ [ 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0]
1792
+ [ 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0]
1793
+ [ 0 0 0 0 0 0 0 0 1 0 0 1 1 0 0]
1794
+ [ 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0]
1795
+ [ 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0]
1796
+ [ 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0]
1797
+ [ 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0]
1798
+ [ 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1/q]
1799
+ [ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1]
1800
+ """
1801
+
1802
+ def __init__(self, NCSym, q=2):
1803
+ """
1804
+ EXAMPLES::
1805
+
1806
+ sage: R = QQ['q'].fraction_field()
1807
+ sage: q = R.gen()
1808
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(R)
1809
+ sage: TestSuite(NCSym.rho(q)).run()
1810
+ """
1811
+ R = NCSym.base_ring()
1812
+ self._q = R(q)
1813
+ CombinatorialFreeModule.__init__(self, R, SetPartitions(),
1814
+ prefix='rho', bracket=False,
1815
+ category=MultiplicativeNCSymBases(NCSym))
1816
+ # Register coercions
1817
+ m = NCSym.m()
1818
+ self.module_morphism(self._rho_to_m_on_basis, codomain=m).register_as_coercion()
1819
+ m.module_morphism(self._m_to_rho_on_basis, codomain=self).register_as_coercion()
1820
+
1821
+ def q(self):
1822
+ """
1823
+ Return the deformation parameter `q` of ``self``.
1824
+
1825
+ EXAMPLES::
1826
+
1827
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
1828
+ sage: rho = NCSym.rho(5)
1829
+ sage: rho.q()
1830
+ 5
1831
+
1832
+ sage: R = QQ['q'].fraction_field()
1833
+ sage: q = R.gen()
1834
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(R)
1835
+ sage: rho = NCSym.rho(q)
1836
+ sage: rho.q() == q
1837
+ True
1838
+ """
1839
+ return self._q
1840
+
1841
+ @cached_method
1842
+ def _rho_to_m_on_basis(self, A):
1843
+ r"""
1844
+ Return `\rho_A` in terms of the monomial basis.
1845
+
1846
+ INPUT:
1847
+
1848
+ - ``A`` -- set partition
1849
+
1850
+ OUTPUT: an element of the `\mathbf{m}` basis
1851
+
1852
+ TESTS::
1853
+
1854
+ sage: R = QQ['q'].fraction_field()
1855
+ sage: q = R.gen()
1856
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(R)
1857
+ sage: rho = NCSym.rho(q)
1858
+ sage: all(rho(rho._rho_to_m_on_basis(A)) == rho[A] for i in range(5)
1859
+ ....: for A in SetPartitions(i))
1860
+ True
1861
+ """
1862
+ m = self.realization_of().m()
1863
+ arcs = set(A.arcs())
1864
+ return m._from_dict({B: self._q**-nesting(set(B).difference(A), A)
1865
+ for B in A.coarsenings() if arcs.issubset(B.arcs())},
1866
+ remove_zeros=False)
1867
+
1868
+ @cached_method
1869
+ def _m_to_rho_on_basis(self, A):
1870
+ r"""
1871
+ Return `\mathbf{m}_A` in terms of the `\rho` basis.
1872
+
1873
+ INPUT:
1874
+
1875
+ - ``A`` -- set partition
1876
+
1877
+ OUTPUT: an element of the `\rho` basis
1878
+
1879
+ TESTS::
1880
+
1881
+ sage: R = QQ['q'].fraction_field()
1882
+ sage: q = R.gen()
1883
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(R)
1884
+ sage: rho = NCSym.rho(q)
1885
+ sage: m = NCSym.m()
1886
+ sage: all(m(rho._m_to_rho_on_basis(A)) == m[A] for i in range(5)
1887
+ ....: for A in SetPartitions(i))
1888
+ True
1889
+ """
1890
+ coeff = lambda A,B: ((-1)**len(set(B.arcs()).difference(A.arcs()))
1891
+ / self._q**nesting(set(B).difference(A), B))
1892
+ arcs = set(A.arcs())
1893
+ return self._from_dict({B: coeff(A,B) for B in A.coarsenings()
1894
+ if arcs.issubset(B.arcs())},
1895
+ remove_zeros=False)
1896
+
1897
+ rho = deformed_coarse_powersum
1898
+
1899
+ class supercharacter(NCSymBasis_abstract):
1900
+ r"""
1901
+ The Hopf algebra of symmetric functions in non-commuting variables
1902
+ in the supercharacter `\chi` basis.
1903
+
1904
+ This basis was defined in [BT13]_ as a `q`-deformation of the
1905
+ supercharacter basis.
1906
+
1907
+ .. MATH::
1908
+
1909
+ \chi_A = \sum_B \chi_A(B) \mathbf{m}_B,
1910
+
1911
+ where we sum over all set partitions `A` and `\chi_A(B)` is the
1912
+ evaluation of the supercharacter `\chi_A` on the superclass `\mu_B`.
1913
+
1914
+ .. NOTE::
1915
+
1916
+ The supercharacters considered in [BT13]_ are coarser than
1917
+ those considered by Aguiar et. al.
1918
+
1919
+ INPUT:
1920
+
1921
+ - ``q`` -- (default: ``2``) the parameter `q`
1922
+
1923
+ EXAMPLES::
1924
+
1925
+ sage: R = QQ['q'].fraction_field()
1926
+ sage: q = R.gen()
1927
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(R)
1928
+ sage: chi = NCSym.chi(q)
1929
+ sage: chi[[1,3],[2]]*chi[[1,2]]
1930
+ chi{{1, 3}, {2}, {4, 5}}
1931
+ sage: chi[[1,3],[2]].coproduct()
1932
+ chi{} # chi{{1, 3}, {2}} + (2*q-2)*chi{{1}} # chi{{1}, {2}} +
1933
+ (3*q-2)*chi{{1}} # chi{{1, 2}} + (2*q-2)*chi{{1}, {2}} # chi{{1}} +
1934
+ (3*q-2)*chi{{1, 2}} # chi{{1}} + chi{{1, 3}, {2}} # chi{}
1935
+ sage: chi2 = NCSym.chi()
1936
+ sage: chi(chi2[[1,2],[3]])
1937
+ ((-q+2)/q)*chi{{1}, {2}, {3}} + 2/q*chi{{1, 2}, {3}}
1938
+ sage: chi2
1939
+ Symmetric functions in non-commuting variables over the Fraction Field
1940
+ of Univariate Polynomial Ring in q over Rational Field in the
1941
+ supercharacter basis with parameter q=2
1942
+ """
1943
+
1944
+ def __init__(self, NCSym, q=2):
1945
+ """
1946
+ EXAMPLES::
1947
+
1948
+ sage: R = QQ['q'].fraction_field()
1949
+ sage: q = R.gen()
1950
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(R)
1951
+ sage: TestSuite(NCSym.chi(q)).run()
1952
+ """
1953
+ R = NCSym.base_ring()
1954
+ self._q = R(q)
1955
+ CombinatorialFreeModule.__init__(self, R, SetPartitions(),
1956
+ prefix='chi', bracket=False,
1957
+ category=MultiplicativeNCSymBases(NCSym))
1958
+ # Register coercions
1959
+ m = NCSym.m()
1960
+ self.module_morphism(self._chi_to_m_on_basis, codomain=m).register_as_coercion()
1961
+ m.module_morphism(self._m_to_chi_on_basis, codomain=self).register_as_coercion()
1962
+
1963
+ def q(self):
1964
+ """
1965
+ Return the deformation parameter `q` of ``self``.
1966
+
1967
+ EXAMPLES::
1968
+
1969
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(QQ)
1970
+ sage: chi = NCSym.chi(5)
1971
+ sage: chi.q()
1972
+ 5
1973
+
1974
+ sage: R = QQ['q'].fraction_field()
1975
+ sage: q = R.gen()
1976
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(R)
1977
+ sage: chi = NCSym.chi(q)
1978
+ sage: chi.q() == q
1979
+ True
1980
+ """
1981
+ return self._q
1982
+
1983
+ @cached_method
1984
+ def _chi_to_m_on_basis(self, A):
1985
+ r"""
1986
+ Return `\chi_A` in terms of the monomial basis.
1987
+
1988
+ INPUT:
1989
+
1990
+ - ``A`` -- set partition
1991
+
1992
+ OUTPUT: an element of the `\mathbf{m}` basis
1993
+
1994
+ TESTS::
1995
+
1996
+ sage: R = QQ['q'].fraction_field()
1997
+ sage: q = R.gen()
1998
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(R)
1999
+ sage: chi = NCSym.chi(q)
2000
+ sage: all(chi(chi._chi_to_m_on_basis(A)) == chi[A] for i in range(5)
2001
+ ....: for A in SetPartitions(i))
2002
+ True
2003
+ """
2004
+ m = self.realization_of().m()
2005
+ q = self._q
2006
+ arcs = set(A.arcs())
2007
+ ret = {}
2008
+ for B in SetPartitions(A.size()):
2009
+ Barcs = B.arcs()
2010
+ if any((a[0] == b[0] and b[1] < a[1])
2011
+ or (b[0] > a[0] and a[1] == b[1])
2012
+ for a in arcs for b in Barcs):
2013
+ continue
2014
+ ret[B] = ((-1)**len(arcs.intersection(Barcs))
2015
+ * (q - 1)**(len(arcs) - len(arcs.intersection(Barcs)))
2016
+ * q**(sum(a[1] - a[0] for a in arcs) - len(arcs))
2017
+ / q**nesting(B, A))
2018
+ return m._from_dict(ret, remove_zeros=False)
2019
+
2020
+ @cached_method
2021
+ def _graded_inverse_matrix(self, n):
2022
+ r"""
2023
+ Return the inverse of the transition matrix of the ``n``-th
2024
+ graded part from the `\chi` basis to the monomial basis.
2025
+
2026
+ EXAMPLES::
2027
+
2028
+ sage: R = QQ['q'].fraction_field(); q = R.gen()
2029
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(R)
2030
+ sage: chi = NCSym.chi(q); m = NCSym.m()
2031
+ sage: lst = list(SetPartitions(2))
2032
+ sage: m = matrix([[m(chi[A])[B] for A in lst] for B in lst]); m
2033
+ [ -1 1]
2034
+ [q - 1 1]
2035
+ sage: chi._graded_inverse_matrix(2)
2036
+ [ -1/q 1/q]
2037
+ [(q - 1)/q 1/q]
2038
+ sage: chi._graded_inverse_matrix(2) * m
2039
+ [1 0]
2040
+ [0 1]
2041
+ """
2042
+ lst = SetPartitions(n)
2043
+ MS = MatrixSpace(self.base_ring(), lst.cardinality())
2044
+ m = self.realization_of().m()
2045
+ m = MS([[m(self[A])[B] for A in lst] for B in lst])
2046
+ return ~m
2047
+
2048
+ @cached_method
2049
+ def _m_to_chi_on_basis(self, A):
2050
+ r"""
2051
+ Return `\mathbf{m}_A` in terms of the `\chi` basis.
2052
+
2053
+ INPUT:
2054
+
2055
+ - ``A`` -- set partition
2056
+
2057
+ OUTPUT: an element of the `\chi` basis
2058
+
2059
+ TESTS::
2060
+
2061
+ sage: R = QQ['q'].fraction_field()
2062
+ sage: q = R.gen()
2063
+ sage: NCSym = SymmetricFunctionsNonCommutingVariables(R)
2064
+ sage: chi = NCSym.chi(q)
2065
+ sage: m = NCSym.m()
2066
+ sage: all(m(chi._m_to_chi_on_basis(A)) == m[A] for i in range(5)
2067
+ ....: for A in SetPartitions(i))
2068
+ True
2069
+ """
2070
+ n = A.size()
2071
+ lst = list(SetPartitions(n))
2072
+ m = self._graded_inverse_matrix(n)
2073
+ i = lst.index(A)
2074
+ return self._from_dict({B: m[j,i] for j,B in enumerate(lst)})
2075
+
2076
+ chi = supercharacter