passagemath-combinat 10.6.42__cp314-cp314t-win_amd64.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 (401) hide show
  1. passagemath_combinat/__init__.py +3 -0
  2. passagemath_combinat-10.6.42.dist-info/DELVEWHEEL +2 -0
  3. passagemath_combinat-10.6.42.dist-info/METADATA +160 -0
  4. passagemath_combinat-10.6.42.dist-info/RECORD +401 -0
  5. passagemath_combinat-10.6.42.dist-info/WHEEL +5 -0
  6. passagemath_combinat-10.6.42.dist-info/top_level.txt +3 -0
  7. passagemath_combinat.libs/libgmp-10-3a5f019e2510aeaad918cab2b57a689d.dll +0 -0
  8. passagemath_combinat.libs/libsymmetrica-3-7dcf900932804d0df5fd0919b4668720.dll +0 -0
  9. sage/algebras/affine_nil_temperley_lieb.py +263 -0
  10. sage/algebras/all.py +24 -0
  11. sage/algebras/all__sagemath_combinat.py +35 -0
  12. sage/algebras/askey_wilson.py +935 -0
  13. sage/algebras/associated_graded.py +345 -0
  14. sage/algebras/cellular_basis.py +350 -0
  15. sage/algebras/cluster_algebra.py +2766 -0
  16. sage/algebras/down_up_algebra.py +860 -0
  17. sage/algebras/free_algebra.py +1698 -0
  18. sage/algebras/free_algebra_element.py +345 -0
  19. sage/algebras/free_algebra_quotient.py +405 -0
  20. sage/algebras/free_algebra_quotient_element.py +295 -0
  21. sage/algebras/free_zinbiel_algebra.py +885 -0
  22. sage/algebras/hall_algebra.py +783 -0
  23. sage/algebras/hecke_algebras/all.py +4 -0
  24. sage/algebras/hecke_algebras/ariki_koike_algebra.py +1796 -0
  25. sage/algebras/hecke_algebras/ariki_koike_specht_modules.py +475 -0
  26. sage/algebras/hecke_algebras/cubic_hecke_algebra.py +3520 -0
  27. sage/algebras/hecke_algebras/cubic_hecke_base_ring.py +1473 -0
  28. sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py +1079 -0
  29. sage/algebras/iwahori_hecke_algebra.py +3095 -0
  30. sage/algebras/jordan_algebra.py +1773 -0
  31. sage/algebras/lie_conformal_algebras/abelian_lie_conformal_algebra.py +113 -0
  32. sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py +156 -0
  33. sage/algebras/lie_conformal_algebras/all.py +18 -0
  34. sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py +134 -0
  35. sage/algebras/lie_conformal_algebras/examples.py +43 -0
  36. sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py +131 -0
  37. sage/algebras/lie_conformal_algebras/finitely_freely_generated_lca.py +139 -0
  38. sage/algebras/lie_conformal_algebras/free_bosons_lie_conformal_algebra.py +174 -0
  39. sage/algebras/lie_conformal_algebras/free_fermions_lie_conformal_algebra.py +167 -0
  40. sage/algebras/lie_conformal_algebras/freely_generated_lie_conformal_algebra.py +107 -0
  41. sage/algebras/lie_conformal_algebras/graded_lie_conformal_algebra.py +135 -0
  42. sage/algebras/lie_conformal_algebras/lie_conformal_algebra.py +353 -0
  43. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py +236 -0
  44. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_basis.py +78 -0
  45. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py +328 -0
  46. sage/algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py +117 -0
  47. sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py +86 -0
  48. sage/algebras/lie_conformal_algebras/virasoro_lie_conformal_algebra.py +82 -0
  49. sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py +205 -0
  50. sage/algebras/nil_coxeter_algebra.py +191 -0
  51. sage/algebras/q_commuting_polynomials.py +673 -0
  52. sage/algebras/q_system.py +608 -0
  53. sage/algebras/quantum_clifford.py +959 -0
  54. sage/algebras/quantum_groups/ace_quantum_onsager.py +693 -0
  55. sage/algebras/quantum_groups/all.py +9 -0
  56. sage/algebras/quantum_groups/fock_space.py +2219 -0
  57. sage/algebras/quantum_groups/q_numbers.py +207 -0
  58. sage/algebras/quantum_groups/quantum_group_gap.py +2695 -0
  59. sage/algebras/quantum_groups/representations.py +591 -0
  60. sage/algebras/quantum_matrix_coordinate_algebra.py +1006 -0
  61. sage/algebras/quantum_oscillator.py +623 -0
  62. sage/algebras/quaternion_algebra.py +20 -0
  63. sage/algebras/quaternion_algebra_element.py +55 -0
  64. sage/algebras/rational_cherednik_algebra.py +525 -0
  65. sage/algebras/schur_algebra.py +670 -0
  66. sage/algebras/shuffle_algebra.py +1011 -0
  67. sage/algebras/splitting_algebra.py +779 -0
  68. sage/algebras/tensor_algebra.py +709 -0
  69. sage/algebras/yangian.py +1082 -0
  70. sage/algebras/yokonuma_hecke_algebra.py +1018 -0
  71. sage/all__sagemath_combinat.py +44 -0
  72. sage/combinat/SJT.py +255 -0
  73. sage/combinat/affine_permutation.py +2405 -0
  74. sage/combinat/algebraic_combinatorics.py +55 -0
  75. sage/combinat/all.py +53 -0
  76. sage/combinat/all__sagemath_combinat.py +195 -0
  77. sage/combinat/alternating_sign_matrix.py +2063 -0
  78. sage/combinat/baxter_permutations.py +346 -0
  79. sage/combinat/bijectionist.py +3220 -0
  80. sage/combinat/binary_recurrence_sequences.py +1180 -0
  81. sage/combinat/blob_algebra.py +685 -0
  82. sage/combinat/catalog_partitions.py +27 -0
  83. sage/combinat/chas/all.py +23 -0
  84. sage/combinat/chas/fsym.py +1180 -0
  85. sage/combinat/chas/wqsym.py +2601 -0
  86. sage/combinat/cluster_complex.py +326 -0
  87. sage/combinat/colored_permutations.py +2039 -0
  88. sage/combinat/colored_permutations_representations.py +964 -0
  89. sage/combinat/composition_signed.py +142 -0
  90. sage/combinat/composition_tableau.py +855 -0
  91. sage/combinat/constellation.py +1729 -0
  92. sage/combinat/core.py +751 -0
  93. sage/combinat/counting.py +12 -0
  94. sage/combinat/crystals/affine.py +742 -0
  95. sage/combinat/crystals/affine_factorization.py +518 -0
  96. sage/combinat/crystals/affinization.py +331 -0
  97. sage/combinat/crystals/alcove_path.py +2013 -0
  98. sage/combinat/crystals/all.py +22 -0
  99. sage/combinat/crystals/bkk_crystals.py +141 -0
  100. sage/combinat/crystals/catalog.py +115 -0
  101. sage/combinat/crystals/catalog_elementary_crystals.py +18 -0
  102. sage/combinat/crystals/catalog_infinity_crystals.py +33 -0
  103. sage/combinat/crystals/catalog_kirillov_reshetikhin.py +18 -0
  104. sage/combinat/crystals/crystals.py +257 -0
  105. sage/combinat/crystals/direct_sum.py +260 -0
  106. sage/combinat/crystals/elementary_crystals.py +1251 -0
  107. sage/combinat/crystals/fast_crystals.py +441 -0
  108. sage/combinat/crystals/fully_commutative_stable_grothendieck.py +1205 -0
  109. sage/combinat/crystals/generalized_young_walls.py +1076 -0
  110. sage/combinat/crystals/highest_weight_crystals.py +436 -0
  111. sage/combinat/crystals/induced_structure.py +695 -0
  112. sage/combinat/crystals/infinity_crystals.py +730 -0
  113. sage/combinat/crystals/kac_modules.py +863 -0
  114. sage/combinat/crystals/kirillov_reshetikhin.py +4196 -0
  115. sage/combinat/crystals/kyoto_path_model.py +497 -0
  116. sage/combinat/crystals/letters.cp314t-win_amd64.pyd +0 -0
  117. sage/combinat/crystals/letters.pxd +79 -0
  118. sage/combinat/crystals/letters.pyx +3056 -0
  119. sage/combinat/crystals/littelmann_path.py +1518 -0
  120. sage/combinat/crystals/monomial_crystals.py +1262 -0
  121. sage/combinat/crystals/multisegments.py +462 -0
  122. sage/combinat/crystals/mv_polytopes.py +467 -0
  123. sage/combinat/crystals/pbw_crystal.py +511 -0
  124. sage/combinat/crystals/pbw_datum.cp314t-win_amd64.pyd +0 -0
  125. sage/combinat/crystals/pbw_datum.pxd +4 -0
  126. sage/combinat/crystals/pbw_datum.pyx +487 -0
  127. sage/combinat/crystals/polyhedral_realization.py +372 -0
  128. sage/combinat/crystals/spins.cp314t-win_amd64.pyd +0 -0
  129. sage/combinat/crystals/spins.pxd +21 -0
  130. sage/combinat/crystals/spins.pyx +756 -0
  131. sage/combinat/crystals/star_crystal.py +290 -0
  132. sage/combinat/crystals/subcrystal.py +464 -0
  133. sage/combinat/crystals/tensor_product.py +1177 -0
  134. sage/combinat/crystals/tensor_product_element.cp314t-win_amd64.pyd +0 -0
  135. sage/combinat/crystals/tensor_product_element.pxd +35 -0
  136. sage/combinat/crystals/tensor_product_element.pyx +1870 -0
  137. sage/combinat/crystals/virtual_crystal.py +420 -0
  138. sage/combinat/cyclic_sieving_phenomenon.py +204 -0
  139. sage/combinat/debruijn_sequence.cp314t-win_amd64.pyd +0 -0
  140. sage/combinat/debruijn_sequence.pyx +355 -0
  141. sage/combinat/decorated_permutation.py +270 -0
  142. sage/combinat/degree_sequences.cp314t-win_amd64.pyd +0 -0
  143. sage/combinat/degree_sequences.pyx +588 -0
  144. sage/combinat/derangements.py +527 -0
  145. sage/combinat/descent_algebra.py +1008 -0
  146. sage/combinat/diagram.py +1551 -0
  147. sage/combinat/diagram_algebras.py +5886 -0
  148. sage/combinat/dyck_word.py +4349 -0
  149. sage/combinat/e_one_star.py +1623 -0
  150. sage/combinat/enumerated_sets.py +123 -0
  151. sage/combinat/expnums.cp314t-win_amd64.pyd +0 -0
  152. sage/combinat/expnums.pyx +148 -0
  153. sage/combinat/fast_vector_partitions.cp314t-win_amd64.pyd +0 -0
  154. sage/combinat/fast_vector_partitions.pyx +346 -0
  155. sage/combinat/fqsym.py +1977 -0
  156. sage/combinat/free_dendriform_algebra.py +954 -0
  157. sage/combinat/free_prelie_algebra.py +1141 -0
  158. sage/combinat/fully_commutative_elements.py +1077 -0
  159. sage/combinat/fully_packed_loop.py +1523 -0
  160. sage/combinat/gelfand_tsetlin_patterns.py +1409 -0
  161. sage/combinat/gray_codes.py +311 -0
  162. sage/combinat/grossman_larson_algebras.py +667 -0
  163. sage/combinat/growth.py +4352 -0
  164. sage/combinat/hall_polynomial.py +188 -0
  165. sage/combinat/hillman_grassl.py +866 -0
  166. sage/combinat/integer_matrices.py +329 -0
  167. sage/combinat/integer_vectors_mod_permgroup.py +1238 -0
  168. sage/combinat/k_tableau.py +4564 -0
  169. sage/combinat/kazhdan_lusztig.py +215 -0
  170. sage/combinat/key_polynomial.py +885 -0
  171. sage/combinat/knutson_tao_puzzles.py +2286 -0
  172. sage/combinat/lr_tableau.py +311 -0
  173. sage/combinat/matrices/all.py +24 -0
  174. sage/combinat/matrices/hadamard_matrix.py +3790 -0
  175. sage/combinat/matrices/latin.py +2912 -0
  176. sage/combinat/misc.py +401 -0
  177. sage/combinat/multiset_partition_into_sets_ordered.py +3541 -0
  178. sage/combinat/ncsf_qsym/all.py +21 -0
  179. sage/combinat/ncsf_qsym/combinatorics.py +317 -0
  180. sage/combinat/ncsf_qsym/generic_basis_code.py +1427 -0
  181. sage/combinat/ncsf_qsym/ncsf.py +5637 -0
  182. sage/combinat/ncsf_qsym/qsym.py +4053 -0
  183. sage/combinat/ncsf_qsym/tutorial.py +447 -0
  184. sage/combinat/ncsym/all.py +21 -0
  185. sage/combinat/ncsym/bases.py +855 -0
  186. sage/combinat/ncsym/dual.py +593 -0
  187. sage/combinat/ncsym/ncsym.py +2076 -0
  188. sage/combinat/necklace.py +551 -0
  189. sage/combinat/non_decreasing_parking_function.py +634 -0
  190. sage/combinat/nu_dyck_word.py +1474 -0
  191. sage/combinat/output.py +861 -0
  192. sage/combinat/parallelogram_polyomino.py +4326 -0
  193. sage/combinat/parking_functions.py +1602 -0
  194. sage/combinat/partition_algebra.py +1998 -0
  195. sage/combinat/partition_kleshchev.py +1982 -0
  196. sage/combinat/partition_shifting_algebras.py +584 -0
  197. sage/combinat/partition_tuple.py +3114 -0
  198. sage/combinat/path_tableaux/all.py +13 -0
  199. sage/combinat/path_tableaux/catalog.py +29 -0
  200. sage/combinat/path_tableaux/dyck_path.py +380 -0
  201. sage/combinat/path_tableaux/frieze.py +476 -0
  202. sage/combinat/path_tableaux/path_tableau.py +728 -0
  203. sage/combinat/path_tableaux/semistandard.py +510 -0
  204. sage/combinat/perfect_matching.py +779 -0
  205. sage/combinat/plane_partition.py +3300 -0
  206. sage/combinat/q_bernoulli.cp314t-win_amd64.pyd +0 -0
  207. sage/combinat/q_bernoulli.pyx +128 -0
  208. sage/combinat/quickref.py +81 -0
  209. sage/combinat/recognizable_series.py +2051 -0
  210. sage/combinat/regular_sequence.py +4316 -0
  211. sage/combinat/regular_sequence_bounded.py +543 -0
  212. sage/combinat/restricted_growth.py +81 -0
  213. sage/combinat/ribbon.py +20 -0
  214. sage/combinat/ribbon_shaped_tableau.py +489 -0
  215. sage/combinat/ribbon_tableau.py +1180 -0
  216. sage/combinat/rigged_configurations/all.py +46 -0
  217. sage/combinat/rigged_configurations/bij_abstract_class.py +548 -0
  218. sage/combinat/rigged_configurations/bij_infinity.py +370 -0
  219. sage/combinat/rigged_configurations/bij_type_A.py +163 -0
  220. sage/combinat/rigged_configurations/bij_type_A2_dual.py +338 -0
  221. sage/combinat/rigged_configurations/bij_type_A2_even.py +218 -0
  222. sage/combinat/rigged_configurations/bij_type_A2_odd.py +199 -0
  223. sage/combinat/rigged_configurations/bij_type_B.py +900 -0
  224. sage/combinat/rigged_configurations/bij_type_C.py +267 -0
  225. sage/combinat/rigged_configurations/bij_type_D.py +771 -0
  226. sage/combinat/rigged_configurations/bij_type_D_tri.py +392 -0
  227. sage/combinat/rigged_configurations/bij_type_D_twisted.py +576 -0
  228. sage/combinat/rigged_configurations/bij_type_E67.py +402 -0
  229. sage/combinat/rigged_configurations/bijection.py +143 -0
  230. sage/combinat/rigged_configurations/kleber_tree.py +1475 -0
  231. sage/combinat/rigged_configurations/kr_tableaux.py +1898 -0
  232. sage/combinat/rigged_configurations/rc_crystal.py +461 -0
  233. sage/combinat/rigged_configurations/rc_infinity.py +540 -0
  234. sage/combinat/rigged_configurations/rigged_configuration_element.py +2403 -0
  235. sage/combinat/rigged_configurations/rigged_configurations.py +1918 -0
  236. sage/combinat/rigged_configurations/rigged_partition.cp314t-win_amd64.pyd +0 -0
  237. sage/combinat/rigged_configurations/rigged_partition.pxd +15 -0
  238. sage/combinat/rigged_configurations/rigged_partition.pyx +680 -0
  239. sage/combinat/rigged_configurations/tensor_product_kr_tableaux.py +499 -0
  240. sage/combinat/rigged_configurations/tensor_product_kr_tableaux_element.py +428 -0
  241. sage/combinat/rsk.py +3438 -0
  242. sage/combinat/schubert_polynomial.py +508 -0
  243. sage/combinat/set_partition.py +3318 -0
  244. sage/combinat/set_partition_iterator.cp314t-win_amd64.pyd +0 -0
  245. sage/combinat/set_partition_iterator.pyx +136 -0
  246. sage/combinat/set_partition_ordered.py +1590 -0
  247. sage/combinat/sf/abreu_nigro.py +346 -0
  248. sage/combinat/sf/all.py +52 -0
  249. sage/combinat/sf/character.py +576 -0
  250. sage/combinat/sf/classical.py +319 -0
  251. sage/combinat/sf/dual.py +996 -0
  252. sage/combinat/sf/elementary.py +549 -0
  253. sage/combinat/sf/hall_littlewood.py +1028 -0
  254. sage/combinat/sf/hecke.py +336 -0
  255. sage/combinat/sf/homogeneous.py +464 -0
  256. sage/combinat/sf/jack.py +1428 -0
  257. sage/combinat/sf/k_dual.py +1458 -0
  258. sage/combinat/sf/kfpoly.py +447 -0
  259. sage/combinat/sf/llt.py +789 -0
  260. sage/combinat/sf/macdonald.py +2019 -0
  261. sage/combinat/sf/monomial.py +525 -0
  262. sage/combinat/sf/multiplicative.py +113 -0
  263. sage/combinat/sf/new_kschur.py +1786 -0
  264. sage/combinat/sf/ns_macdonald.py +964 -0
  265. sage/combinat/sf/orthogonal.py +246 -0
  266. sage/combinat/sf/orthotriang.py +355 -0
  267. sage/combinat/sf/powersum.py +963 -0
  268. sage/combinat/sf/schur.py +880 -0
  269. sage/combinat/sf/sf.py +1653 -0
  270. sage/combinat/sf/sfa.py +7053 -0
  271. sage/combinat/sf/symplectic.py +253 -0
  272. sage/combinat/sf/witt.py +721 -0
  273. sage/combinat/shifted_primed_tableau.py +2735 -0
  274. sage/combinat/shuffle.py +830 -0
  275. sage/combinat/sidon_sets.py +146 -0
  276. sage/combinat/similarity_class_type.py +1721 -0
  277. sage/combinat/sine_gordon.py +618 -0
  278. sage/combinat/six_vertex_model.py +784 -0
  279. sage/combinat/skew_partition.py +2053 -0
  280. sage/combinat/skew_tableau.py +2989 -0
  281. sage/combinat/sloane_functions.py +8935 -0
  282. sage/combinat/specht_module.py +1403 -0
  283. sage/combinat/species/all.py +48 -0
  284. sage/combinat/species/characteristic_species.py +321 -0
  285. sage/combinat/species/composition_species.py +273 -0
  286. sage/combinat/species/cycle_species.py +284 -0
  287. sage/combinat/species/empty_species.py +155 -0
  288. sage/combinat/species/functorial_composition_species.py +148 -0
  289. sage/combinat/species/generating_series.py +673 -0
  290. sage/combinat/species/library.py +148 -0
  291. sage/combinat/species/linear_order_species.py +169 -0
  292. sage/combinat/species/misc.py +83 -0
  293. sage/combinat/species/partition_species.py +290 -0
  294. sage/combinat/species/permutation_species.py +268 -0
  295. sage/combinat/species/product_species.py +423 -0
  296. sage/combinat/species/recursive_species.py +476 -0
  297. sage/combinat/species/set_species.py +192 -0
  298. sage/combinat/species/species.py +820 -0
  299. sage/combinat/species/structure.py +539 -0
  300. sage/combinat/species/subset_species.py +243 -0
  301. sage/combinat/species/sum_species.py +225 -0
  302. sage/combinat/subword.py +564 -0
  303. sage/combinat/subword_complex.py +2122 -0
  304. sage/combinat/subword_complex_c.cp314t-win_amd64.pyd +0 -0
  305. sage/combinat/subword_complex_c.pyx +119 -0
  306. sage/combinat/super_tableau.py +821 -0
  307. sage/combinat/superpartition.py +1154 -0
  308. sage/combinat/symmetric_group_algebra.py +3774 -0
  309. sage/combinat/symmetric_group_representations.py +1830 -0
  310. sage/combinat/t_sequences.py +877 -0
  311. sage/combinat/tableau.py +9506 -0
  312. sage/combinat/tableau_residues.py +860 -0
  313. sage/combinat/tableau_tuple.py +5353 -0
  314. sage/combinat/tiling.py +2432 -0
  315. sage/combinat/triangles_FHM.py +777 -0
  316. sage/combinat/tutorial.py +1857 -0
  317. sage/combinat/vector_partition.py +337 -0
  318. sage/combinat/words/abstract_word.py +1722 -0
  319. sage/combinat/words/all.py +59 -0
  320. sage/combinat/words/alphabet.py +268 -0
  321. sage/combinat/words/finite_word.py +7201 -0
  322. sage/combinat/words/infinite_word.py +113 -0
  323. sage/combinat/words/lyndon_word.py +652 -0
  324. sage/combinat/words/morphic.py +351 -0
  325. sage/combinat/words/morphism.py +3878 -0
  326. sage/combinat/words/paths.py +2932 -0
  327. sage/combinat/words/shuffle_product.py +278 -0
  328. sage/combinat/words/suffix_trees.py +1873 -0
  329. sage/combinat/words/word.py +769 -0
  330. sage/combinat/words/word_char.cp314t-win_amd64.pyd +0 -0
  331. sage/combinat/words/word_char.pyx +847 -0
  332. sage/combinat/words/word_datatypes.cp314t-win_amd64.pyd +0 -0
  333. sage/combinat/words/word_datatypes.pxd +4 -0
  334. sage/combinat/words/word_datatypes.pyx +1067 -0
  335. sage/combinat/words/word_generators.py +2026 -0
  336. sage/combinat/words/word_infinite_datatypes.py +1218 -0
  337. sage/combinat/words/word_options.py +99 -0
  338. sage/combinat/words/words.py +2396 -0
  339. sage/data_structures/all__sagemath_combinat.py +1 -0
  340. sage/databases/all__sagemath_combinat.py +13 -0
  341. sage/databases/findstat.py +4897 -0
  342. sage/databases/oeis.py +2058 -0
  343. sage/databases/sloane.py +393 -0
  344. sage/dynamics/all__sagemath_combinat.py +14 -0
  345. sage/dynamics/cellular_automata/all.py +7 -0
  346. sage/dynamics/cellular_automata/catalog.py +34 -0
  347. sage/dynamics/cellular_automata/elementary.py +612 -0
  348. sage/dynamics/cellular_automata/glca.py +477 -0
  349. sage/dynamics/cellular_automata/solitons.py +1463 -0
  350. sage/dynamics/finite_dynamical_system.py +1249 -0
  351. sage/dynamics/finite_dynamical_system_catalog.py +382 -0
  352. sage/games/all.py +7 -0
  353. sage/games/hexad.py +704 -0
  354. sage/games/quantumino.py +591 -0
  355. sage/games/sudoku.py +889 -0
  356. sage/games/sudoku_backtrack.cp314t-win_amd64.pyd +0 -0
  357. sage/games/sudoku_backtrack.pyx +189 -0
  358. sage/groups/all__sagemath_combinat.py +1 -0
  359. sage/groups/indexed_free_group.py +489 -0
  360. sage/libs/all__sagemath_combinat.py +6 -0
  361. sage/libs/lrcalc/__init__.py +1 -0
  362. sage/libs/lrcalc/lrcalc.py +525 -0
  363. sage/libs/symmetrica/__init__.py +7 -0
  364. sage/libs/symmetrica/all.py +101 -0
  365. sage/libs/symmetrica/kostka.pxi +168 -0
  366. sage/libs/symmetrica/part.pxi +193 -0
  367. sage/libs/symmetrica/plet.pxi +42 -0
  368. sage/libs/symmetrica/sab.pxi +196 -0
  369. sage/libs/symmetrica/sb.pxi +332 -0
  370. sage/libs/symmetrica/sc.pxi +192 -0
  371. sage/libs/symmetrica/schur.pxi +956 -0
  372. sage/libs/symmetrica/symmetrica.cp314t-win_amd64.pyd +0 -0
  373. sage/libs/symmetrica/symmetrica.pxi +1172 -0
  374. sage/libs/symmetrica/symmetrica.pyx +39 -0
  375. sage/monoids/all.py +13 -0
  376. sage/monoids/automatic_semigroup.py +1054 -0
  377. sage/monoids/free_abelian_monoid.py +315 -0
  378. sage/monoids/free_abelian_monoid_element.cp314t-win_amd64.pyd +0 -0
  379. sage/monoids/free_abelian_monoid_element.pxd +16 -0
  380. sage/monoids/free_abelian_monoid_element.pyx +397 -0
  381. sage/monoids/free_monoid.py +335 -0
  382. sage/monoids/free_monoid_element.py +431 -0
  383. sage/monoids/hecke_monoid.py +65 -0
  384. sage/monoids/string_monoid.py +817 -0
  385. sage/monoids/string_monoid_element.py +547 -0
  386. sage/monoids/string_ops.py +143 -0
  387. sage/monoids/trace_monoid.py +972 -0
  388. sage/rings/all__sagemath_combinat.py +2 -0
  389. sage/sat/all.py +4 -0
  390. sage/sat/boolean_polynomials.py +405 -0
  391. sage/sat/converters/__init__.py +6 -0
  392. sage/sat/converters/anf2cnf.py +14 -0
  393. sage/sat/converters/polybori.py +611 -0
  394. sage/sat/solvers/__init__.py +5 -0
  395. sage/sat/solvers/cryptominisat.py +287 -0
  396. sage/sat/solvers/dimacs.py +783 -0
  397. sage/sat/solvers/picosat.py +228 -0
  398. sage/sat/solvers/sat_lp.py +156 -0
  399. sage/sat/solvers/satsolver.cp314t-win_amd64.pyd +0 -0
  400. sage/sat/solvers/satsolver.pxd +3 -0
  401. sage/sat/solvers/satsolver.pyx +405 -0
@@ -0,0 +1,1172 @@
1
+ # sage_setup: distribution = sagemath-combinat
2
+ # sage.doctest: needs sage.combinat sage.modules
3
+
4
+ # We put all definitions together, whether they appear in def.h or
5
+ # macro.h
6
+ cdef extern from 'symmetrica/def.h':
7
+ pass
8
+
9
+ cdef extern from 'symmetrica/macro.h':
10
+ ctypedef int INT
11
+ ctypedef INT OBJECTKIND
12
+
13
+ cdef struct vector:
14
+ pass
15
+ cdef struct bruch:
16
+ pass
17
+ cdef struct graph:
18
+ pass
19
+ cdef struct list:
20
+ pass
21
+ cdef struct matrix:
22
+ pass
23
+ cdef struct monom:
24
+ pass
25
+ cdef struct number:
26
+ pass
27
+ cdef struct partition:
28
+ pass
29
+ cdef struct permutation:
30
+ pass
31
+ cdef struct reihe:
32
+ pass
33
+ cdef struct skewpartition:
34
+ pass
35
+ cdef struct symchar:
36
+ pass
37
+ cdef struct tableaux:
38
+ pass
39
+
40
+ cdef enum:
41
+ INFREELIST = -1
42
+ EMPTY = 0
43
+ INTEGER = 1
44
+ VECTOR = 2
45
+ PARTITION = 3
46
+ FRACTION = 4
47
+ BRUCH = 4
48
+ PERMUTATION = 6
49
+ SKEWPARTITION = 7
50
+ TABLEAUX = 8
51
+ POLYNOM = 9
52
+ SCHUR = 10
53
+ MATRIX = 11
54
+ AUG_PART = 12
55
+ HOM_SYM = 13
56
+ HOMSYM = 13
57
+ SCHUBERT = 14
58
+ INTEGERVECTOR = 15
59
+ INTEGER_VECTOR = 15
60
+ INT_VECTOR = 15
61
+ INTVECTOR = 15
62
+ KOSTKA = 16
63
+ INTINT = 17
64
+ SYMCHAR = 18
65
+ WORD =19
66
+ LIST =20 # 210688 */
67
+ MONOM =21 #230688*/
68
+ LONGINT =22 # 170888 */
69
+ GEN_CHAR =23 # 280888 nur fuer test-zwecke */
70
+ BINTREE =24 # 291288 */
71
+ GRAPH =25 # 210889 */
72
+ COMP =26 # 300889 */
73
+ COMPOSITION =26 # 300889 */
74
+ KRANZTYPUS =27 # 280390 */
75
+ POW_SYM =28
76
+ POWSYM =28
77
+ MONOMIAL =29 # 090992 */
78
+ BTREE =30
79
+ KRANZ =31
80
+ GRAL =32 # 200691 */
81
+ GROUPALGEBRA =32 # 170693 */
82
+ ELM_SYM =33 # 090992 */
83
+ ELMSYM =33 # 090992 */
84
+ FINITEFIELD = 35 # 250193 */
85
+ FF = 35 # 250193 */
86
+ REIHE = 36 # 090393 */
87
+ CHARPARTITION = 37 # 130593 */ # internal use */
88
+ CHAR_AUG_PART = 38 # 170593 */ # internal use */
89
+ INTEGERMATRIX =40 # AK 141293 */
90
+ CYCLOTOMIC = 41 # MD */
91
+ MONOPOLY = 42 # MD */
92
+ SQ_RADICAL = 43 # MD */
93
+ BITVECTOR = 44
94
+ LAURENT =45
95
+ SUBSET =47 # AK 220997 */
96
+ FASTPOLYNOM =211093
97
+ EXPONENTPARTITION =240298
98
+ SKEWTABLEAUX =20398
99
+ PARTTABLEAUX =10398
100
+ BARPERM =230695
101
+ PERMVECTOR =180998
102
+ PERM_VECTOR =180998
103
+ PERMUTATIONVECTOR =180998
104
+ PERMUTATION_VECTOR =180998
105
+ INTEGERBRUCH =220998
106
+ INTEGER_BRUCH =220998
107
+ INTEGERFRACTION =220998
108
+ INTEGER_FRACTION =220998
109
+ HASHTABLE =120199
110
+
111
+
112
+ cdef struct loc:
113
+ INT w2, w1, w0
114
+ loc *nloc
115
+
116
+ cdef struct longint:
117
+ loc *floc
118
+ signed char signum #-1,0,+1
119
+ INT laenge
120
+
121
+ ctypedef union OBJECTSELF:
122
+ INT ob_INT
123
+ INT *ob_INTpointer
124
+ char *ob_charpointer
125
+ bruch *ob_bruch
126
+ graph *ob_graph
127
+ list *ob_list
128
+ longint *ob_longint
129
+ matrix *ob_matrix
130
+ monom *ob_monom
131
+ number *ob_number
132
+ partition *ob_partition
133
+ permutation *ob_permutation
134
+ reihe *ob_reihe
135
+ skewpartition *ob_skewpartition
136
+ symchar *ob_symchar
137
+ tableaux *ob_tableaux
138
+ vector *ob_vector
139
+
140
+ cdef struct obj:
141
+ OBJECTKIND ob_kind
142
+ OBJECTSELF ob_self
143
+
144
+ cdef struct ganzdaten:
145
+ INT basis, basislaenge, auspos, auslaenge, auszz
146
+
147
+ cdef struct zahldaten:
148
+ char ziffer[13]
149
+ INT mehr
150
+ INT ziffernzhal
151
+ loc *fdez
152
+
153
+ ctypedef obj *OP
154
+
155
+ cdef struct vector:
156
+ OP v_length
157
+ OP v_self
158
+
159
+ cdef struct REIHE_variablen:
160
+ INT index
161
+ INT potenz
162
+ REIHE_variablen *weiter
163
+
164
+ cdef struct REIHE_mon:
165
+ OP coeff
166
+ REIHE_variablen *zeiger
167
+ REIHE_mon *ref
168
+
169
+ cdef struct REIHE_poly:
170
+ INT grad
171
+ REIHE_mon *uten
172
+ REIHE_poly *rechts
173
+
174
+ cdef struct reihe:
175
+ INT exist
176
+ INT reihenart
177
+ INT z
178
+ reihe *x
179
+ reihe *y
180
+ reihe *p
181
+ INT (*eingabefkt)()
182
+ char ope
183
+ REIHE_poly *infozeig
184
+
185
+ ctypedef reihe* REIHE_ZEIGER
186
+
187
+ cdef struct list:
188
+ OP l_self
189
+ OP l_next
190
+
191
+ cdef struct partition:
192
+ OBJECTKIND pa_kind
193
+ OP pa_self
194
+
195
+ cdef struct permutation:
196
+ OBJECTKIND p_kind
197
+ OP p_self
198
+
199
+ cdef struct monom:
200
+ OP mo_self
201
+ OP mo_koeff
202
+
203
+ cdef struct bruch:
204
+ OP b_oben
205
+ OP b_uten
206
+ INT b_info
207
+
208
+ cdef struct matrix:
209
+ OP m_length
210
+ OP m_height
211
+ OP m_self
212
+
213
+ cdef struct skewpartition:
214
+ OP spa_gross
215
+ OP spa_klein
216
+
217
+ cdef struct tableaux:
218
+ OP t_umriss
219
+ OP t_self
220
+
221
+ cdef struct symchar:
222
+ OP sy_werte
223
+ OP sy_parlist
224
+ OP sy_dimension
225
+
226
+ cdef struct graph:
227
+ OBJECTKIND gr_kind
228
+ OP gr_self
229
+
230
+ cdef struct CYCLO_DATA:
231
+ OP index, deg, poly, autos
232
+
233
+ cdef struct FIELD_DATA:
234
+ OP index, deg, poly
235
+
236
+ ctypedef union data:
237
+ CYCLO_DATA *c_data
238
+ FIELD_DATA *f_data
239
+ OP o_data
240
+
241
+ cdef struct number:
242
+ OP n_self
243
+ data n_data
244
+
245
+
246
+ #MACROS
247
+ #S_PA_I(OP a, INT i)
248
+ OBJECTKIND s_o_k(OP a)
249
+ void* c_o_k(OP a, OBJECTKIND k)
250
+ OBJECTSELF S_O_S(OP a)
251
+
252
+ void* add(OP a, OP b, OP c)
253
+ void* mult(OP a, OP b, OP c)
254
+ void* sub(OP a, OP b, OP c)
255
+
256
+
257
+ #Integers
258
+ void* m_i_i(INT n, OP a)
259
+ void* M_I_I(INT n, OP a)
260
+ INT S_I_I(OP a)
261
+ t_int_longint(OP a, OP b)
262
+ void* m_i_longint(INT n, OP a)
263
+
264
+
265
+ #Fractions
266
+ OP S_B_O(OP a)
267
+ OP S_B_U(OP a)
268
+ OP m_ou_b(OP o, OP u, OP d)
269
+
270
+ #Vectors
271
+ void* M_IL_V(INT length, OP a)
272
+ void* m_il_v(INT n, OP a )
273
+ void* m_i_i(INT n, OP a)
274
+
275
+ INT s_v_li(OP a)
276
+ OP s_v_i(OP a, INT i)
277
+
278
+ #Partitions
279
+ OP s_pa_l(OP a)
280
+ INT s_pa_li(OP a)
281
+ INT s_pa_ii(OP a, INT i)
282
+ OP s_pa_i(OP a, INT i)
283
+ OP S_PA_S(OP a)
284
+ OP S_PA_I(OP a, INT )
285
+ void* b_ks_pa(INT kind, OP b, OP a)
286
+
287
+
288
+ #Skew Partitions
289
+ INT b_gk_spa(OP gross, OP klein, OP result)
290
+ INT m_gk_spa(OP gross, OP klein, OP result)
291
+ OP s_spa_g(OP spa)
292
+ OP s_spa_k(OP spa)
293
+
294
+ #Permutations
295
+ OP s_p_i(OP a, INT i)
296
+ INT s_p_li(OP a)
297
+ INT s_p_ii(OP a, INT i)
298
+ void* m_il_p(INT n, OP a)
299
+
300
+
301
+ #Barred Permutations
302
+
303
+
304
+ #Lists
305
+ OP s_l_s(OP a)
306
+ OP S_L_S(OP a)
307
+ OP s_l_n(OP a)
308
+ INT lastp_list(OP l)
309
+ INT empty_listp(OP l)
310
+
311
+ #Matrices
312
+ INT S_M_HI(OP a)
313
+ INT S_M_LI(OP a)
314
+ OP S_M_IJ(OP a, INT i, INT j)
315
+ void* m_ilih_m(INT l, INT h, OP a)
316
+
317
+ #Schur polynomials
318
+ OP s_s_s(OP a)
319
+ OP s_s_k(OP a)
320
+ OP s_s_n(OP a)
321
+ void* m_skn_s(OP part, OP koeff, OP next, OP result)
322
+ void* b_skn_s(OP part, OP koeff, OP next, OP result)
323
+
324
+ #Schubert polynomials
325
+ OP s_sch_s(OP a)
326
+ OP s_sch_k(OP a)
327
+ OP s_sch_n(OP a)
328
+ void* m_skn_sch(OP perm, OP koeff, OP next, OP result)
329
+ void* b_skn_sch(OP perm, OP koeff, OP next, OP result)
330
+
331
+ #Polynomials
332
+ OP s_po_n(OP a)
333
+ OP s_po_sl(OP a)
334
+ OP s_po_k(OP a)
335
+ OP s_po_s(OP a)
336
+ void* m_skn_po(OP s, OP k, OP next, OP polynom)
337
+
338
+ #Tableaux
339
+ OP S_T_S(OP t)
340
+
341
+ #########
342
+
343
+ INT insert(OP a, OP b, INT (*eq)(), INT (*comp)())
344
+
345
+
346
+ INT nullp_sqrad(OP a)
347
+ OP S_PO_K(OP a)
348
+ OP S_PO_S(OP a)
349
+ OP S_L_N(OP a)
350
+ OP S_N_S(OP a)
351
+ INT einsp(OP A)
352
+
353
+ #Empty Object
354
+ int EMPTYP(OP obj)
355
+
356
+ #Functions
357
+ INT anfang()
358
+ INT ende()
359
+ OP callocobject()
360
+ INT sscan(INT, OP a)
361
+ INT scan(INT, OP a)
362
+ INT freeall(OP a)
363
+ INT freeself(OP a)
364
+ INT sprint(char* t, OP a)
365
+ INT sprint_integer(char* t, OP A)
366
+ INT println(OP a)
367
+
368
+ #factorial
369
+ INT fakul(OP a, OP b)
370
+
371
+ ##########################################
372
+ cdef object matrix_constructor
373
+ cdef object Integer
374
+ cdef object Tableau, SkewTableau
375
+ cdef object SkewPartition
376
+ cdef object Partition
377
+ cdef object Permutation, Permutations
378
+ cdef object builtinlist
379
+ cdef object sqrt
380
+ cdef object Rational
381
+ cdef object QQ
382
+ cdef object ZZ
383
+ cdef object SymmetricFunctions
384
+ cdef object PolynomialRing
385
+ cdef object SchubertPolynomialRing, SchubertPolynomial_class
386
+ cdef object two, fifteen, thirty, zero, sage_maxint
387
+
388
+ cdef int maxint = 2147483647
389
+
390
+ cdef void late_import() noexcept:
391
+ global matrix_constructor, \
392
+ Integer, \
393
+ Tableau, \
394
+ SkewTableau, \
395
+ SkewPartition, \
396
+ Partition, \
397
+ Permutation, Permutations,\
398
+ prod, \
399
+ PolynomialRing, \
400
+ Rational, \
401
+ QQ, \
402
+ ZZ, \
403
+ SymmetricFunctions, \
404
+ sqrt, \
405
+ builtinlist, \
406
+ MPolynomialRing_base, MPolynomial,\
407
+ SchubertPolynomialRing, SchubertPolynomial_class,\
408
+ two, fifteen, thirty, zero, sage_maxint
409
+
410
+ if Integer is not None:
411
+ return
412
+
413
+ import sage.rings.integer
414
+ Integer = sage.rings.integer.Integer
415
+
416
+ import sage.combinat.tableau
417
+ Tableau = sage.combinat.tableau.Tableau
418
+
419
+ import sage.combinat.skew_tableau
420
+ SkewTableau = sage.combinat.skew_tableau.SkewTableau
421
+
422
+ import sage.combinat.skew_partition
423
+ SkewPartition = sage.combinat.skew_partition.SkewPartition
424
+
425
+ import sage.combinat.partition
426
+ Partition = sage.combinat.partition.Partition
427
+
428
+ import sage.combinat.permutation
429
+ Permutation = sage.combinat.permutation.Permutation
430
+ Permutations = sage.combinat.permutation.Permutations
431
+
432
+ from sage.misc.functional import sqrt
433
+ from sage.misc.misc_c import prod
434
+ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
435
+ from sage.rings.rational_field import QQ
436
+ from sage.rings.rational import Rational
437
+ from sage.rings.integer_ring import ZZ
438
+
439
+ import builtins
440
+ builtinlist = builtins.list
441
+
442
+ import sage.rings.polynomial.multi_polynomial_ring
443
+ MPolynomialRing_base = sage.rings.polynomial.multi_polynomial_ring.MPolynomialRing_base
444
+ import sage.rings.polynomial.multi_polynomial
445
+ MPolynomial = sage.rings.polynomial.multi_polynomial.MPolynomial
446
+
447
+ two = Integer(2)
448
+ fifteen = Integer(15)
449
+ thirty = Integer(30)
450
+ zero = Integer(0)
451
+ sage_maxint = Integer(maxint)
452
+
453
+ #Symmetric Functions
454
+ import sage.combinat.sf.sf
455
+ SymmetricFunctions = sage.combinat.sf.sf.SymmetricFunctions
456
+
457
+ import sage.matrix.constructor
458
+ matrix_constructor = sage.matrix.constructor.matrix
459
+
460
+ import sage.combinat.schubert_polynomial
461
+ SchubertPolynomialRing = sage.combinat.schubert_polynomial.SchubertPolynomialRing
462
+ SchubertPolynomial_class = sage.combinat.schubert_polynomial.SchubertPolynomial_class
463
+
464
+
465
+ ##########################################
466
+ cdef object _py(OP a):
467
+ cdef OBJECTKIND objk
468
+ objk = s_o_k(a)
469
+ if objk == INTEGER:
470
+ return _py_int(a)
471
+ elif objk == LONGINT:
472
+ return _py_longint(a)
473
+ elif objk == PARTITION:
474
+ return _py_partition(a)
475
+ elif objk == PERMUTATION:
476
+ return _py_permutation(a)
477
+ elif objk == SKEWPARTITION:
478
+ return _py_skew_partition(a)
479
+ elif objk == FRACTION:
480
+ return _py_fraction(a)
481
+ elif objk == SQ_RADICAL:
482
+ return _py_sq_radical(a)
483
+ elif objk == MATRIX or objk == KRANZTYPUS:
484
+ return _py_matrix(a)
485
+ elif objk == SCHUR:
486
+ return _py_schur(a)
487
+ elif objk == HOMSYM:
488
+ return _py_homsym(a)
489
+ elif objk == POWSYM:
490
+ return _py_powsym(a)
491
+ elif objk == ELMSYM:
492
+ return _py_elmsym(a)
493
+ elif objk == MONOMIAL:
494
+ return _py_monomial(a)
495
+ elif objk == LIST:
496
+ return _py_list(a)
497
+ elif objk == VECTOR:
498
+ return _py_vector(a)
499
+ elif objk == TABLEAUX:
500
+ return _py_tableau(a)
501
+ elif objk == EMPTY:
502
+ return None
503
+ elif objk == POLYNOM:
504
+ return _py_polynom(a)
505
+ elif objk == SCHUBERT:
506
+ return _py_schubert(a)
507
+ else:
508
+ #println(a)
509
+ raise NotImplementedError(str(objk))
510
+
511
+ cdef int _op(object a, OP result) except -1:
512
+ late_import()
513
+ if isinstance(a, Integer):
514
+ _op_integer(a, result)
515
+ elif isinstance(a, Partition):
516
+ _op_partition(a, result)
517
+ elif isinstance(a, Rational):
518
+ _op_fraction(a, result)
519
+ else:
520
+ raise TypeError("cannot convert a (= %s) to OP" % a)
521
+
522
+
523
+ def test_integer(object x):
524
+ """
525
+ Test functionality for converting between Sage's integers
526
+ and symmetrica's integers.
527
+
528
+ EXAMPLES::
529
+
530
+ sage: import sage.libs.symmetrica.all
531
+ sage: from sage.libs.symmetrica.symmetrica import test_integer
532
+ sage: test_integer(1)
533
+ 1
534
+ sage: test_integer(-1)
535
+ -1
536
+ sage: test_integer(2^33)
537
+ 8589934592
538
+ sage: test_integer(-2^33)
539
+ -8589934592
540
+ sage: test_integer(2^100)
541
+ 1267650600228229401496703205376
542
+ sage: test_integer(-2^100)
543
+ -1267650600228229401496703205376
544
+ sage: for i in range(100):
545
+ ....: if test_integer(2^i) != 2^i:
546
+ ....: print("Failure at {}".format(i))
547
+ """
548
+ cdef OP a = callocobject()
549
+ _op_integer(x, a)
550
+ res = _py(a)
551
+ freeall(a)
552
+ return res
553
+
554
+ ##########
555
+ #Integers#
556
+ ##########
557
+
558
+ cdef int _op_integer(object x, OP a) except -1:
559
+ try:
560
+ _op_int(x, a)
561
+ except OverflowError:
562
+ _op_longint(x, a)
563
+ return 0
564
+
565
+
566
+ cdef int _op_int(object x, OP a) except -1:
567
+ M_I_I(x, a)
568
+ return 0
569
+
570
+ cdef object _py_int(OP a):
571
+ late_import()
572
+ return Integer(S_I_I(a))
573
+
574
+
575
+ cdef int _op_longint(object x, OP a) except -1:
576
+ late_import()
577
+ cdef OP op_maxint_long = callocobject(),
578
+ cdef OP quo_long = callocobject()
579
+ cdef OP rem_long = callocobject()
580
+
581
+ qr = x.quo_rem(sage_maxint)
582
+
583
+ m_i_longint(maxint, op_maxint_long)
584
+ _op_integer(qr[0], a)
585
+ _op_integer(qr[1], rem_long)
586
+
587
+ #Multiply a by op_maxint_long
588
+ mult(op_maxint_long, a, a)
589
+
590
+ #Add rem to a
591
+ add(a, rem_long, a)
592
+
593
+ freeall(rem_long)
594
+ freeall(quo_long)
595
+ freeall(op_maxint_long)
596
+ return 0
597
+
598
+ cdef object _py_longint(OP a):
599
+ late_import()
600
+ cdef longint *x = S_O_S(a).ob_longint
601
+ cdef loc *l = x.floc
602
+ cdef int sign = x.signum
603
+ res = zero
604
+ n = zero
605
+ while l != NULL:
606
+ res += Integer( l.w0 ) * two**n
607
+ res += Integer( l.w1 ) * two**(n+fifteen)
608
+ res += Integer( l.w2 ) * two**(n+thirty)
609
+ n += thirty + fifteen
610
+ l = l.nloc
611
+ if sign < 0:
612
+ res *= Integer(-1)
613
+
614
+ return res
615
+
616
+
617
+ ###########
618
+ #Fractions#
619
+ ###########
620
+ cdef object _py_fraction(OP a):
621
+ return _py(S_B_O(a))/_py(S_B_U(a))
622
+
623
+ cdef int _op_fraction(object f, OP a) except -1:
624
+ cdef OP o = callocobject(), u = callocobject()
625
+ _op_integer(f.numerator(), o)
626
+ _op_integer(f.denominator(), u)
627
+ m_ou_b(o, u, a)
628
+
629
+ #########
630
+ #Vectors#
631
+ #########
632
+ cdef object _py_vector(OP a):
633
+ cdef INT i
634
+ res = []
635
+ for i from 0 <= i < s_v_li(a):
636
+ res.append( _py(s_v_i(a, i)))
637
+ return res
638
+
639
+ cdef void* _op_il_vector(object l, OP a) noexcept:
640
+ cdef INT length, i
641
+ length = len(l)
642
+
643
+ m_il_v(length, a)
644
+ for i from 0 <= i < length:
645
+ m_i_i(l[i], s_v_i(a, i))
646
+
647
+ #########
648
+ #Numbers#
649
+ #########
650
+ cdef object _py_sq_radical(OP a):
651
+ late_import()
652
+
653
+ cdef OP ptr
654
+ ptr = S_N_S(a)
655
+
656
+ res = 0
657
+ if nullp_sqrad(a):
658
+ return res
659
+
660
+ while ptr != NULL:
661
+
662
+ if einsp(S_PO_S(ptr)):
663
+ res += _py(S_PO_K(ptr))
664
+ else:
665
+ res += _py(S_PO_K(ptr))*sqrt(_py(S_PO_S(ptr)))
666
+
667
+ ptr = S_L_N(ptr)
668
+
669
+ return res.radical_simplify()
670
+
671
+ ############
672
+ #Partitions#
673
+ ############
674
+ cdef void* _op_partition(object p, OP a) noexcept:
675
+ cdef int n, i, j
676
+
677
+ if not EMPTYP(a):
678
+ freeself(a)
679
+
680
+ n = len(p)
681
+ b_ks_pa(VECTOR, callocobject(), a)
682
+ m_il_v(n, S_PA_S(a))
683
+
684
+ j = 0
685
+ for i from n > i >= 0:
686
+ _op_integer(p[i], S_PA_I(a,j))
687
+ j = j + 1
688
+
689
+ cdef object _py_partition(OP a):
690
+ cdef INT n, i
691
+ late_import()
692
+ res = []
693
+ n = s_pa_li(a)
694
+ for i from n > i >=0:
695
+ res.append(s_pa_ii(a, i))
696
+ return Partition(res)
697
+
698
+ ################
699
+ #Skew Partition#
700
+ ################
701
+ cdef void* _op_skew_partition(object p, OP a) noexcept:
702
+ cdef OP gross, klein
703
+ gross = callocobject()
704
+ klein = callocobject()
705
+ _op_partition(p[0], gross)
706
+ _op_partition(p[1], klein)
707
+ b_gk_spa(gross, klein, a)
708
+
709
+ cdef object _py_skew_partition(OP a):
710
+ late_import()
711
+ return SkewPartition( [ _py_partition(s_spa_g(a)), _py_partition(s_spa_k(a)) ] )
712
+
713
+ ##############
714
+ #Permutations#
715
+ ##############
716
+ cdef void* _op_permutation(object p, OP a) noexcept:
717
+ cdef int n, i, j
718
+
719
+ if not EMPTYP(a):
720
+ freeself(a)
721
+
722
+ n = len(p)
723
+ m_il_p(n, a)
724
+ for i from 0 <= i < n:
725
+ _op_integer(p[i], s_p_i(a,i))
726
+
727
+ cdef object _py_permutation(OP a):
728
+ late_import()
729
+ cdef INT n, i
730
+ res = []
731
+ n = s_p_li(a)
732
+ for i from 0 <= i < n:
733
+ res.append(s_p_ii(a, i))
734
+ return Permutation(res)
735
+
736
+ #####################
737
+ #Barred Permutations#
738
+ #####################
739
+
740
+ #######
741
+ #Lists#
742
+ #######
743
+ cdef object _py_list(OP a):
744
+ cdef OP x
745
+ x = a
746
+ res = []
747
+ if S_L_S(a) == NULL:
748
+ return []
749
+ elif empty_listp(a):
750
+ return []
751
+ while x != NULL:
752
+ res.append(_py(s_l_s(x)))
753
+ x = s_l_n(x)
754
+
755
+ return res
756
+
757
+
758
+ #############
759
+ #Polynomials#
760
+ #############
761
+ cdef object _py_polynom(OP a):
762
+ late_import()
763
+ cdef int maxneeded = 0, i = 0
764
+ cdef OP pointer = a
765
+
766
+ if pointer == NULL:
767
+ return 0
768
+
769
+
770
+ #Find the maximum number of variables needed
771
+ while pointer != NULL:
772
+ l = _py(s_po_sl(pointer))
773
+ if l > maxneeded:
774
+ maxneeded = l
775
+ pointer = s_po_n(pointer)
776
+
777
+ pointer = a
778
+ parent_ring = _py(s_po_k(pointer)).parent()
779
+ if maxneeded == 1:
780
+ P = PolynomialRing(parent_ring, 'x')
781
+ else:
782
+ P = PolynomialRing(parent_ring, maxneeded, 'x')
783
+ d = {}
784
+ while pointer != NULL:
785
+ exps = tuple(_py_vector(s_po_s(pointer)))
786
+ d[ exps ] = _py(s_po_k(pointer))
787
+ pointer = s_po_n(pointer)
788
+
789
+ return P(d)
790
+
791
+
792
+ cdef object _py_polynom_alphabet(OP a, object alphabet, object length):
793
+ """
794
+ Convert a symmetrica multivariate polynomial a to a Sage multivariate
795
+ polynomials. Alphabet specifies the names of the variables which are
796
+ fed into PolynomialRing. length specifies the number of variables; if
797
+ it is set to 0, then the number of variables is autodetected based on
798
+ the number of variables in alphabet or the result obtained from
799
+ symmetrica.
800
+ """
801
+ late_import()
802
+ cdef OP pointer = a
803
+
804
+ if pointer == NULL:
805
+ return 0
806
+
807
+ parent_ring = _py(s_po_k(pointer)).parent()
808
+ if length == 0:
809
+ if isinstance(alphabet, (builtinlist, tuple)):
810
+ l = len(alphabet)
811
+ elif isinstance(alphabet, str) and ',' in alphabet:
812
+ l = len(alphabet.split(','))
813
+ else:
814
+ l = _py(s_po_sl(a))
815
+ else:
816
+ l = length
817
+
818
+ P = PolynomialRing(parent_ring, l, alphabet)
819
+ x = P.gens()
820
+ res = P(0)
821
+ while pointer != NULL:
822
+ exps = _py_vector(s_po_s(pointer))
823
+ res += _py(s_po_k(pointer)) *prod([ x[i]**exps[i] for i in range(min(len(exps),l))])
824
+ pointer = s_po_n(pointer)
825
+ return res
826
+
827
+ cdef object _op_polynom(object d, OP res):
828
+ late_import()
829
+
830
+ poly_ring = d.parent()
831
+
832
+ if not isinstance(poly_ring, MPolynomialRing_base):
833
+ raise TypeError("you must pass a multivariate polynomial")
834
+ base_ring = poly_ring.base_ring()
835
+
836
+ if not ( base_ring == ZZ or base_ring == QQ):
837
+ raise TypeError("the base ring must be either ZZ or QQ")
838
+
839
+ cdef OP c = callocobject(), v = callocobject()
840
+ cdef OP pointer = res
841
+ m = d.monomials()
842
+ exp = d.exponents()
843
+ cdef int n, i
844
+ n = len(exp)
845
+
846
+ for i from 0 <= i < n:
847
+ _op_il_vector(exp[i], v)
848
+ _op(d.monomial_coefficient(poly_ring(m[i])), c)
849
+ if i != n-1:
850
+ m_skn_po(v,c, callocobject(), pointer)
851
+ else:
852
+ m_skn_po(v,c, NULL, pointer)
853
+ pointer = s_po_n(pointer)
854
+
855
+ freeall(c)
856
+ freeall(v)
857
+ return None
858
+
859
+
860
+ #######################################
861
+ #Schur symmetric functions and friends#
862
+ #######################################
863
+ cdef object _py_schur(OP a):
864
+ late_import()
865
+ z_elt = _py_schur_general(a)
866
+ if len(z_elt) == 0:
867
+ return SymmetricFunctions(ZZ).s()(0)
868
+
869
+ #Figure out the parent ring of a coefficient
870
+ R = z_elt[next(iter(z_elt))].parent()
871
+
872
+ s = SymmetricFunctions(R).s()
873
+ z = s(0)
874
+ z._monomial_coefficients = z_elt
875
+ return z
876
+
877
+ cdef void* _op_schur(object d, OP res) noexcept:
878
+ _op_schur_general(d, res)
879
+
880
+ cdef object _py_monomial(OP a): #Monomial symmetric functions
881
+ late_import()
882
+ z_elt = _py_schur_general(a)
883
+ if len(z_elt) == 0:
884
+ return SymmetricFunctions(ZZ).m()(0)
885
+
886
+ R = z_elt[next(iter(z_elt))].parent()
887
+
888
+ m = SymmetricFunctions(R).m()
889
+ z = m(0)
890
+ z._monomial_coefficients = z_elt
891
+ return z
892
+
893
+ cdef void* _op_monomial(object d, OP res) noexcept: #Monomial symmetric functions
894
+ cdef OP pointer = res
895
+ _op_schur_general(d, res)
896
+ while pointer != NULL:
897
+ c_o_k(pointer, MONOMIAL)
898
+ pointer = s_s_n(pointer)
899
+
900
+ cdef object _py_powsym(OP a): #Power-sum symmetric functions
901
+ late_import()
902
+ z_elt = _py_schur_general(a)
903
+ if len(z_elt) == 0:
904
+ return SymmetricFunctions(ZZ).p()(0)
905
+
906
+ R = z_elt[next(iter(z_elt))].parent()
907
+
908
+ p = SymmetricFunctions(R).p()
909
+ z = p(0)
910
+ z._monomial_coefficients = z_elt
911
+ return z
912
+
913
+ cdef void* _op_powsym(object d, OP res) noexcept: #Power-sum symmetric functions
914
+ cdef OP pointer = res
915
+ _op_schur_general(d, res)
916
+ while pointer != NULL:
917
+ c_o_k(pointer, POWSYM)
918
+ pointer = s_s_n(pointer)
919
+
920
+
921
+ cdef object _py_elmsym(OP a): #Elementary symmetric functions
922
+ late_import()
923
+ z_elt = _py_schur_general(a)
924
+ if len(z_elt) == 0:
925
+ return SymmetricFunctions(ZZ).e()(0)
926
+
927
+ R = z_elt[next(iter(z_elt))].parent()
928
+
929
+ e = SymmetricFunctions(R).e()
930
+ z = e(0)
931
+ z._monomial_coefficients = z_elt
932
+ return z
933
+
934
+ cdef void* _op_elmsym(object d, OP res) noexcept: #Elementary symmetric functions
935
+ cdef OP pointer = res
936
+ _op_schur_general(d, res)
937
+ while pointer != NULL:
938
+ c_o_k(pointer, ELMSYM)
939
+ pointer = s_s_n(pointer)
940
+
941
+
942
+ cdef object _py_homsym(OP a): # Homogeneous symmetric functions
943
+ late_import()
944
+ z_elt = _py_schur_general(a)
945
+ if len(z_elt) == 0:
946
+ return SymmetricFunctions(ZZ).h()(0)
947
+
948
+ R = z_elt[next(iter(z_elt))].parent()
949
+
950
+ h = SymmetricFunctions(R).h()
951
+ z = h(0)
952
+ z._monomial_coefficients = z_elt
953
+ return z
954
+
955
+ cdef void* _op_homsym(object d, OP res) noexcept: # Homogeneous symmetric functions
956
+ cdef OP pointer = res
957
+ _op_schur_general(d, res)
958
+ while pointer != NULL:
959
+ c_o_k(pointer, HOMSYM)
960
+ pointer = s_s_n(pointer)
961
+
962
+
963
+ cdef object _py_schur_general(OP a):
964
+ cdef OP pointer = a
965
+ d = {}
966
+ if a == NULL:
967
+ return d
968
+ while pointer != NULL:
969
+ d[ _py_partition(s_s_s(pointer)) ] = _py(s_s_k(pointer))
970
+ pointer = s_s_n(pointer)
971
+ return d
972
+
973
+ cdef void* _op_schur_general(object d, OP res) noexcept:
974
+ if isinstance(d, dict):
975
+ _op_schur_general_dict(d, res)
976
+ else:
977
+ _op_schur_general_sf(d, res)
978
+
979
+ cdef void* _op_schur_general_sf(object f, OP res) noexcept:
980
+ late_import()
981
+ base_ring = f.parent().base_ring()
982
+ if not ( base_ring is QQ or base_ring is ZZ ):
983
+ raise ValueError("the base ring must be either ZZ or QQ")
984
+
985
+ _op_schur_general_dict( f.monomial_coefficients(), res)
986
+
987
+ cdef void* _op_schur_general_dict(object d, OP res) noexcept:
988
+ late_import()
989
+
990
+ cdef OP next
991
+ cdef OP pointer = res
992
+ cdef INT n, i
993
+
994
+
995
+ keys = builtinlist(d)
996
+ n = len(keys)
997
+
998
+ if n == 0:
999
+ raise ValueError("the dictionary must be nonempty")
1000
+
1001
+ b_skn_s(callocobject(), callocobject(), NULL, res)
1002
+ _op_partition(keys[0], s_s_s(res))
1003
+ _op(d[keys[0]], s_s_k(res))
1004
+
1005
+
1006
+ for i from 0 < i < n:
1007
+ next = callocobject()
1008
+
1009
+ b_skn_s(callocobject(), callocobject(), NULL, next)
1010
+ _op_partition(keys[i], s_s_s(next))
1011
+ _op(d[keys[i]], s_s_k(next))
1012
+
1013
+ insert(next, res, NULL, NULL)
1014
+
1015
+
1016
+ ######################
1017
+ #Schubert Polynomials#
1018
+ ######################
1019
+ cdef void* _op_schubert_general(object d, OP res) noexcept:
1020
+ if isinstance(d, dict):
1021
+ _op_schubert_dict(d, res)
1022
+ else:
1023
+ _op_schubert_sp(d, res)
1024
+
1025
+ cdef void* _op_schubert_perm(object a, OP res) noexcept:
1026
+ cdef OP caperm = callocobject()
1027
+ _op_permutation(a, caperm)
1028
+ m_perm_sch(caperm, res)
1029
+ freeall(caperm)
1030
+
1031
+ cdef void* _op_schubert_sp(object f, OP res) noexcept:
1032
+ late_import()
1033
+ base_ring = f.parent().base_ring()
1034
+ if not ( base_ring is QQ or base_ring is ZZ ):
1035
+ raise ValueError("the base ring must be either ZZ or QQ")
1036
+
1037
+ _op_schubert_dict( f.monomial_coefficients(), res)
1038
+
1039
+ cdef void* _op_schubert_dict(object d, OP res) noexcept:
1040
+ late_import()
1041
+
1042
+ cdef OP next
1043
+ cdef OP pointer = res
1044
+ cdef INT n, i
1045
+
1046
+ keys = builtinlist(d)
1047
+ n = len(keys)
1048
+
1049
+ if n == 0:
1050
+ raise ValueError("the dictionary must be nonempty")
1051
+
1052
+ b_skn_sch(callocobject(), callocobject(), NULL, res)
1053
+ _op_permutation(keys[0], s_sch_s(res))
1054
+ _op(d[keys[0]], s_sch_k(res))
1055
+
1056
+
1057
+ for i from 0 < i < n:
1058
+ next = callocobject()
1059
+
1060
+ b_skn_sch(callocobject(), callocobject(), NULL, next)
1061
+ _op_permutation(keys[i], s_sch_s(next))
1062
+ _op(d[keys[i]], s_sch_k(next))
1063
+
1064
+ insert(next, res, NULL, NULL)
1065
+
1066
+ cdef object _py_schubert(OP a):
1067
+ late_import()
1068
+ cdef OP pointer = a
1069
+ cdef dict z_elt = {}
1070
+
1071
+ # SCHUBERT is (like) a list, so we also need to make sure it is not empty
1072
+ if a == NULL or empty_listp(a):
1073
+ return SchubertPolynomialRing(ZZ).zero()
1074
+
1075
+ while pointer != NULL:
1076
+ z_elt[_py(s_s_s(pointer)).remove_extra_fixed_points() ] = _py(s_sch_k(pointer))
1077
+ pointer = s_sch_n(pointer)
1078
+
1079
+ if not z_elt:
1080
+ return SchubertPolynomialRing(ZZ).zero()
1081
+
1082
+ R = z_elt[next(iter(z_elt))].parent()
1083
+ X = SchubertPolynomialRing(R)
1084
+ # If the element constructor ends up copying the input dict in the future,
1085
+ # then this will not be as fast as creating a copy of the zero element
1086
+ # and explicitly setting the _monomial_coefficients.
1087
+ return X.element_class(X, z_elt)
1088
+
1089
+
1090
+ ##########
1091
+ #Matrices#
1092
+ ##########
1093
+ cdef object _py_matrix(OP a):
1094
+
1095
+ late_import()
1096
+
1097
+ cdef INT i,j,rows, cols
1098
+ rows = S_M_HI(a)
1099
+ cols = S_M_LI(a)
1100
+
1101
+ res = []
1102
+ for i from 0 <= i < rows:
1103
+ row = []
1104
+ for j from 0 <= j < cols:
1105
+ row.append( _py(S_M_IJ(a,i,j)) )
1106
+
1107
+ res.append(row)
1108
+
1109
+ #return res
1110
+ if res == [] or res is None:
1111
+ return res
1112
+ else:
1113
+ return matrix_constructor(res)
1114
+
1115
+
1116
+ cdef void* _op_matrix(object a, OP res) noexcept:
1117
+ #FIXME: only constructs integer matrices
1118
+
1119
+ cdef INT i,j,rows, cols
1120
+
1121
+ rows = a.nrows()
1122
+ cols = a.ncols()
1123
+
1124
+ m_ilih_m(rows, cols, res)
1125
+
1126
+ for i from 0 <= i < rows:
1127
+ for j from 0 <= j < cols:
1128
+ _op_integer( a[(i,j)], S_M_IJ(res,i,j) )
1129
+
1130
+ ##########
1131
+ #Tableaux#
1132
+ ##########
1133
+ cdef object _py_tableau(OP t):
1134
+
1135
+ late_import()
1136
+
1137
+ cdef INT i,j,rows, cols, added, is_skew = 0
1138
+ cdef OP a
1139
+ a = S_T_S(t)
1140
+ rows = S_M_HI(a)
1141
+ cols = S_M_LI(a)
1142
+
1143
+ res = []
1144
+ for i from 0 <= i < rows:
1145
+ row = []
1146
+ added = 0
1147
+ for j from 0 <= j < cols:
1148
+ if s_o_k(S_M_IJ(a,i,j)) == EMPTY:
1149
+ if added:
1150
+ break
1151
+ else:
1152
+ row.append( None )
1153
+ is_skew = 1
1154
+ else:
1155
+ added = 1
1156
+ row.append( _py(S_M_IJ(a,i,j)) )
1157
+
1158
+ res.append(row)
1159
+
1160
+ #return res
1161
+ if is_skew:
1162
+ return SkewTableau(res)
1163
+ else:
1164
+ return Tableau(res)
1165
+
1166
+
1167
+ def start():
1168
+ anfang()
1169
+
1170
+ # Automatically clean up when sage exits.
1171
+ import atexit
1172
+ atexit.register(ende)