passagemath-combinat 10.6.31rc3__cp314-cp314-macosx_13_0_x86_64.whl

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

Potentially problematic release.


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

Files changed (399) hide show
  1. passagemath_combinat-10.6.31rc3.dist-info/METADATA +160 -0
  2. passagemath_combinat-10.6.31rc3.dist-info/RECORD +399 -0
  3. passagemath_combinat-10.6.31rc3.dist-info/WHEEL +6 -0
  4. passagemath_combinat-10.6.31rc3.dist-info/top_level.txt +2 -0
  5. passagemath_combinat.dylibs/libgmp.10.dylib +0 -0
  6. passagemath_combinat.dylibs/libsymmetrica.3.0.0.dylib +0 -0
  7. sage/algebras/affine_nil_temperley_lieb.py +263 -0
  8. sage/algebras/all.py +25 -0
  9. sage/algebras/all__sagemath_combinat.py +35 -0
  10. sage/algebras/askey_wilson.py +935 -0
  11. sage/algebras/associated_graded.py +345 -0
  12. sage/algebras/cellular_basis.py +350 -0
  13. sage/algebras/cluster_algebra.py +2766 -0
  14. sage/algebras/down_up_algebra.py +860 -0
  15. sage/algebras/free_algebra.py +1698 -0
  16. sage/algebras/free_algebra_element.py +345 -0
  17. sage/algebras/free_algebra_quotient.py +405 -0
  18. sage/algebras/free_algebra_quotient_element.py +295 -0
  19. sage/algebras/free_zinbiel_algebra.py +885 -0
  20. sage/algebras/hall_algebra.py +783 -0
  21. sage/algebras/hecke_algebras/all.py +4 -0
  22. sage/algebras/hecke_algebras/ariki_koike_algebra.py +1796 -0
  23. sage/algebras/hecke_algebras/ariki_koike_specht_modules.py +475 -0
  24. sage/algebras/hecke_algebras/cubic_hecke_algebra.py +3520 -0
  25. sage/algebras/hecke_algebras/cubic_hecke_base_ring.py +1473 -0
  26. sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py +1079 -0
  27. sage/algebras/iwahori_hecke_algebra.py +3095 -0
  28. sage/algebras/jordan_algebra.py +1773 -0
  29. sage/algebras/lie_conformal_algebras/abelian_lie_conformal_algebra.py +113 -0
  30. sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py +156 -0
  31. sage/algebras/lie_conformal_algebras/all.py +18 -0
  32. sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py +134 -0
  33. sage/algebras/lie_conformal_algebras/examples.py +43 -0
  34. sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py +131 -0
  35. sage/algebras/lie_conformal_algebras/finitely_freely_generated_lca.py +139 -0
  36. sage/algebras/lie_conformal_algebras/free_bosons_lie_conformal_algebra.py +174 -0
  37. sage/algebras/lie_conformal_algebras/free_fermions_lie_conformal_algebra.py +167 -0
  38. sage/algebras/lie_conformal_algebras/freely_generated_lie_conformal_algebra.py +107 -0
  39. sage/algebras/lie_conformal_algebras/graded_lie_conformal_algebra.py +135 -0
  40. sage/algebras/lie_conformal_algebras/lie_conformal_algebra.py +353 -0
  41. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py +236 -0
  42. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_basis.py +78 -0
  43. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py +328 -0
  44. sage/algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py +117 -0
  45. sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py +86 -0
  46. sage/algebras/lie_conformal_algebras/virasoro_lie_conformal_algebra.py +82 -0
  47. sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py +205 -0
  48. sage/algebras/nil_coxeter_algebra.py +191 -0
  49. sage/algebras/q_commuting_polynomials.py +673 -0
  50. sage/algebras/q_system.py +608 -0
  51. sage/algebras/quantum_clifford.py +959 -0
  52. sage/algebras/quantum_groups/ace_quantum_onsager.py +693 -0
  53. sage/algebras/quantum_groups/all.py +9 -0
  54. sage/algebras/quantum_groups/fock_space.py +2219 -0
  55. sage/algebras/quantum_groups/q_numbers.py +207 -0
  56. sage/algebras/quantum_groups/quantum_group_gap.py +2695 -0
  57. sage/algebras/quantum_groups/representations.py +591 -0
  58. sage/algebras/quantum_matrix_coordinate_algebra.py +1006 -0
  59. sage/algebras/quantum_oscillator.py +623 -0
  60. sage/algebras/quaternion_algebra.py +20 -0
  61. sage/algebras/quaternion_algebra_element.py +55 -0
  62. sage/algebras/rational_cherednik_algebra.py +525 -0
  63. sage/algebras/schur_algebra.py +670 -0
  64. sage/algebras/shuffle_algebra.py +1011 -0
  65. sage/algebras/splitting_algebra.py +779 -0
  66. sage/algebras/tensor_algebra.py +709 -0
  67. sage/algebras/yangian.py +1082 -0
  68. sage/algebras/yokonuma_hecke_algebra.py +1018 -0
  69. sage/all__sagemath_combinat.py +35 -0
  70. sage/combinat/SJT.py +255 -0
  71. sage/combinat/affine_permutation.py +2405 -0
  72. sage/combinat/algebraic_combinatorics.py +55 -0
  73. sage/combinat/all.py +53 -0
  74. sage/combinat/all__sagemath_combinat.py +195 -0
  75. sage/combinat/alternating_sign_matrix.py +2063 -0
  76. sage/combinat/baxter_permutations.py +346 -0
  77. sage/combinat/bijectionist.py +3220 -0
  78. sage/combinat/binary_recurrence_sequences.py +1180 -0
  79. sage/combinat/blob_algebra.py +685 -0
  80. sage/combinat/catalog_partitions.py +27 -0
  81. sage/combinat/chas/all.py +23 -0
  82. sage/combinat/chas/fsym.py +1180 -0
  83. sage/combinat/chas/wqsym.py +2601 -0
  84. sage/combinat/cluster_complex.py +326 -0
  85. sage/combinat/colored_permutations.py +2039 -0
  86. sage/combinat/colored_permutations_representations.py +964 -0
  87. sage/combinat/composition_signed.py +142 -0
  88. sage/combinat/composition_tableau.py +855 -0
  89. sage/combinat/constellation.py +1729 -0
  90. sage/combinat/core.py +751 -0
  91. sage/combinat/counting.py +12 -0
  92. sage/combinat/crystals/affine.py +742 -0
  93. sage/combinat/crystals/affine_factorization.py +518 -0
  94. sage/combinat/crystals/affinization.py +331 -0
  95. sage/combinat/crystals/alcove_path.py +2013 -0
  96. sage/combinat/crystals/all.py +22 -0
  97. sage/combinat/crystals/bkk_crystals.py +141 -0
  98. sage/combinat/crystals/catalog.py +115 -0
  99. sage/combinat/crystals/catalog_elementary_crystals.py +18 -0
  100. sage/combinat/crystals/catalog_infinity_crystals.py +33 -0
  101. sage/combinat/crystals/catalog_kirillov_reshetikhin.py +18 -0
  102. sage/combinat/crystals/crystals.py +257 -0
  103. sage/combinat/crystals/direct_sum.py +260 -0
  104. sage/combinat/crystals/elementary_crystals.py +1251 -0
  105. sage/combinat/crystals/fast_crystals.py +441 -0
  106. sage/combinat/crystals/fully_commutative_stable_grothendieck.py +1205 -0
  107. sage/combinat/crystals/generalized_young_walls.py +1076 -0
  108. sage/combinat/crystals/highest_weight_crystals.py +436 -0
  109. sage/combinat/crystals/induced_structure.py +695 -0
  110. sage/combinat/crystals/infinity_crystals.py +730 -0
  111. sage/combinat/crystals/kac_modules.py +863 -0
  112. sage/combinat/crystals/kirillov_reshetikhin.py +4196 -0
  113. sage/combinat/crystals/kyoto_path_model.py +497 -0
  114. sage/combinat/crystals/letters.cpython-314-darwin.so +0 -0
  115. sage/combinat/crystals/letters.pxd +79 -0
  116. sage/combinat/crystals/letters.pyx +3056 -0
  117. sage/combinat/crystals/littelmann_path.py +1518 -0
  118. sage/combinat/crystals/monomial_crystals.py +1262 -0
  119. sage/combinat/crystals/multisegments.py +462 -0
  120. sage/combinat/crystals/mv_polytopes.py +467 -0
  121. sage/combinat/crystals/pbw_crystal.py +511 -0
  122. sage/combinat/crystals/pbw_datum.cpython-314-darwin.so +0 -0
  123. sage/combinat/crystals/pbw_datum.pxd +4 -0
  124. sage/combinat/crystals/pbw_datum.pyx +487 -0
  125. sage/combinat/crystals/polyhedral_realization.py +372 -0
  126. sage/combinat/crystals/spins.cpython-314-darwin.so +0 -0
  127. sage/combinat/crystals/spins.pxd +21 -0
  128. sage/combinat/crystals/spins.pyx +756 -0
  129. sage/combinat/crystals/star_crystal.py +290 -0
  130. sage/combinat/crystals/subcrystal.py +464 -0
  131. sage/combinat/crystals/tensor_product.py +1177 -0
  132. sage/combinat/crystals/tensor_product_element.cpython-314-darwin.so +0 -0
  133. sage/combinat/crystals/tensor_product_element.pxd +35 -0
  134. sage/combinat/crystals/tensor_product_element.pyx +1870 -0
  135. sage/combinat/crystals/virtual_crystal.py +420 -0
  136. sage/combinat/cyclic_sieving_phenomenon.py +204 -0
  137. sage/combinat/debruijn_sequence.cpython-314-darwin.so +0 -0
  138. sage/combinat/debruijn_sequence.pyx +355 -0
  139. sage/combinat/decorated_permutation.py +270 -0
  140. sage/combinat/degree_sequences.cpython-314-darwin.so +0 -0
  141. sage/combinat/degree_sequences.pyx +588 -0
  142. sage/combinat/derangements.py +527 -0
  143. sage/combinat/descent_algebra.py +1008 -0
  144. sage/combinat/diagram.py +1551 -0
  145. sage/combinat/diagram_algebras.py +5886 -0
  146. sage/combinat/dyck_word.py +4349 -0
  147. sage/combinat/e_one_star.py +1623 -0
  148. sage/combinat/enumerated_sets.py +123 -0
  149. sage/combinat/expnums.cpython-314-darwin.so +0 -0
  150. sage/combinat/expnums.pyx +148 -0
  151. sage/combinat/fast_vector_partitions.cpython-314-darwin.so +0 -0
  152. sage/combinat/fast_vector_partitions.pyx +346 -0
  153. sage/combinat/fqsym.py +1977 -0
  154. sage/combinat/free_dendriform_algebra.py +954 -0
  155. sage/combinat/free_prelie_algebra.py +1141 -0
  156. sage/combinat/fully_commutative_elements.py +1077 -0
  157. sage/combinat/fully_packed_loop.py +1523 -0
  158. sage/combinat/gelfand_tsetlin_patterns.py +1409 -0
  159. sage/combinat/gray_codes.py +311 -0
  160. sage/combinat/grossman_larson_algebras.py +667 -0
  161. sage/combinat/growth.py +4352 -0
  162. sage/combinat/hall_polynomial.py +188 -0
  163. sage/combinat/hillman_grassl.py +866 -0
  164. sage/combinat/integer_matrices.py +329 -0
  165. sage/combinat/integer_vectors_mod_permgroup.py +1238 -0
  166. sage/combinat/k_tableau.py +4564 -0
  167. sage/combinat/kazhdan_lusztig.py +215 -0
  168. sage/combinat/key_polynomial.py +885 -0
  169. sage/combinat/knutson_tao_puzzles.py +2286 -0
  170. sage/combinat/lr_tableau.py +311 -0
  171. sage/combinat/matrices/all.py +24 -0
  172. sage/combinat/matrices/hadamard_matrix.py +3790 -0
  173. sage/combinat/matrices/latin.py +2912 -0
  174. sage/combinat/misc.py +401 -0
  175. sage/combinat/multiset_partition_into_sets_ordered.py +3541 -0
  176. sage/combinat/ncsf_qsym/all.py +21 -0
  177. sage/combinat/ncsf_qsym/combinatorics.py +317 -0
  178. sage/combinat/ncsf_qsym/generic_basis_code.py +1427 -0
  179. sage/combinat/ncsf_qsym/ncsf.py +5637 -0
  180. sage/combinat/ncsf_qsym/qsym.py +4053 -0
  181. sage/combinat/ncsf_qsym/tutorial.py +447 -0
  182. sage/combinat/ncsym/all.py +21 -0
  183. sage/combinat/ncsym/bases.py +855 -0
  184. sage/combinat/ncsym/dual.py +593 -0
  185. sage/combinat/ncsym/ncsym.py +2076 -0
  186. sage/combinat/necklace.py +551 -0
  187. sage/combinat/non_decreasing_parking_function.py +634 -0
  188. sage/combinat/nu_dyck_word.py +1474 -0
  189. sage/combinat/output.py +861 -0
  190. sage/combinat/parallelogram_polyomino.py +4326 -0
  191. sage/combinat/parking_functions.py +1602 -0
  192. sage/combinat/partition_algebra.py +1998 -0
  193. sage/combinat/partition_kleshchev.py +1982 -0
  194. sage/combinat/partition_shifting_algebras.py +584 -0
  195. sage/combinat/partition_tuple.py +3114 -0
  196. sage/combinat/path_tableaux/all.py +13 -0
  197. sage/combinat/path_tableaux/catalog.py +29 -0
  198. sage/combinat/path_tableaux/dyck_path.py +380 -0
  199. sage/combinat/path_tableaux/frieze.py +476 -0
  200. sage/combinat/path_tableaux/path_tableau.py +728 -0
  201. sage/combinat/path_tableaux/semistandard.py +510 -0
  202. sage/combinat/perfect_matching.py +779 -0
  203. sage/combinat/plane_partition.py +3300 -0
  204. sage/combinat/q_bernoulli.cpython-314-darwin.so +0 -0
  205. sage/combinat/q_bernoulli.pyx +128 -0
  206. sage/combinat/quickref.py +81 -0
  207. sage/combinat/recognizable_series.py +2051 -0
  208. sage/combinat/regular_sequence.py +4316 -0
  209. sage/combinat/regular_sequence_bounded.py +543 -0
  210. sage/combinat/restricted_growth.py +81 -0
  211. sage/combinat/ribbon.py +20 -0
  212. sage/combinat/ribbon_shaped_tableau.py +489 -0
  213. sage/combinat/ribbon_tableau.py +1180 -0
  214. sage/combinat/rigged_configurations/all.py +46 -0
  215. sage/combinat/rigged_configurations/bij_abstract_class.py +548 -0
  216. sage/combinat/rigged_configurations/bij_infinity.py +370 -0
  217. sage/combinat/rigged_configurations/bij_type_A.py +163 -0
  218. sage/combinat/rigged_configurations/bij_type_A2_dual.py +338 -0
  219. sage/combinat/rigged_configurations/bij_type_A2_even.py +218 -0
  220. sage/combinat/rigged_configurations/bij_type_A2_odd.py +199 -0
  221. sage/combinat/rigged_configurations/bij_type_B.py +900 -0
  222. sage/combinat/rigged_configurations/bij_type_C.py +267 -0
  223. sage/combinat/rigged_configurations/bij_type_D.py +771 -0
  224. sage/combinat/rigged_configurations/bij_type_D_tri.py +392 -0
  225. sage/combinat/rigged_configurations/bij_type_D_twisted.py +576 -0
  226. sage/combinat/rigged_configurations/bij_type_E67.py +402 -0
  227. sage/combinat/rigged_configurations/bijection.py +143 -0
  228. sage/combinat/rigged_configurations/kleber_tree.py +1475 -0
  229. sage/combinat/rigged_configurations/kr_tableaux.py +1898 -0
  230. sage/combinat/rigged_configurations/rc_crystal.py +461 -0
  231. sage/combinat/rigged_configurations/rc_infinity.py +540 -0
  232. sage/combinat/rigged_configurations/rigged_configuration_element.py +2403 -0
  233. sage/combinat/rigged_configurations/rigged_configurations.py +1918 -0
  234. sage/combinat/rigged_configurations/rigged_partition.cpython-314-darwin.so +0 -0
  235. sage/combinat/rigged_configurations/rigged_partition.pxd +15 -0
  236. sage/combinat/rigged_configurations/rigged_partition.pyx +680 -0
  237. sage/combinat/rigged_configurations/tensor_product_kr_tableaux.py +499 -0
  238. sage/combinat/rigged_configurations/tensor_product_kr_tableaux_element.py +428 -0
  239. sage/combinat/rsk.py +3438 -0
  240. sage/combinat/schubert_polynomial.py +508 -0
  241. sage/combinat/set_partition.py +3318 -0
  242. sage/combinat/set_partition_iterator.cpython-314-darwin.so +0 -0
  243. sage/combinat/set_partition_iterator.pyx +136 -0
  244. sage/combinat/set_partition_ordered.py +1590 -0
  245. sage/combinat/sf/abreu_nigro.py +346 -0
  246. sage/combinat/sf/all.py +52 -0
  247. sage/combinat/sf/character.py +576 -0
  248. sage/combinat/sf/classical.py +319 -0
  249. sage/combinat/sf/dual.py +996 -0
  250. sage/combinat/sf/elementary.py +549 -0
  251. sage/combinat/sf/hall_littlewood.py +1028 -0
  252. sage/combinat/sf/hecke.py +336 -0
  253. sage/combinat/sf/homogeneous.py +464 -0
  254. sage/combinat/sf/jack.py +1428 -0
  255. sage/combinat/sf/k_dual.py +1458 -0
  256. sage/combinat/sf/kfpoly.py +447 -0
  257. sage/combinat/sf/llt.py +789 -0
  258. sage/combinat/sf/macdonald.py +2019 -0
  259. sage/combinat/sf/monomial.py +525 -0
  260. sage/combinat/sf/multiplicative.py +113 -0
  261. sage/combinat/sf/new_kschur.py +1786 -0
  262. sage/combinat/sf/ns_macdonald.py +964 -0
  263. sage/combinat/sf/orthogonal.py +246 -0
  264. sage/combinat/sf/orthotriang.py +355 -0
  265. sage/combinat/sf/powersum.py +963 -0
  266. sage/combinat/sf/schur.py +880 -0
  267. sage/combinat/sf/sf.py +1653 -0
  268. sage/combinat/sf/sfa.py +7053 -0
  269. sage/combinat/sf/symplectic.py +253 -0
  270. sage/combinat/sf/witt.py +721 -0
  271. sage/combinat/shifted_primed_tableau.py +2735 -0
  272. sage/combinat/shuffle.py +830 -0
  273. sage/combinat/sidon_sets.py +146 -0
  274. sage/combinat/similarity_class_type.py +1721 -0
  275. sage/combinat/sine_gordon.py +618 -0
  276. sage/combinat/six_vertex_model.py +784 -0
  277. sage/combinat/skew_partition.py +2053 -0
  278. sage/combinat/skew_tableau.py +2989 -0
  279. sage/combinat/sloane_functions.py +8935 -0
  280. sage/combinat/specht_module.py +1403 -0
  281. sage/combinat/species/all.py +48 -0
  282. sage/combinat/species/characteristic_species.py +321 -0
  283. sage/combinat/species/composition_species.py +273 -0
  284. sage/combinat/species/cycle_species.py +284 -0
  285. sage/combinat/species/empty_species.py +155 -0
  286. sage/combinat/species/functorial_composition_species.py +148 -0
  287. sage/combinat/species/generating_series.py +673 -0
  288. sage/combinat/species/library.py +148 -0
  289. sage/combinat/species/linear_order_species.py +169 -0
  290. sage/combinat/species/misc.py +83 -0
  291. sage/combinat/species/partition_species.py +290 -0
  292. sage/combinat/species/permutation_species.py +268 -0
  293. sage/combinat/species/product_species.py +423 -0
  294. sage/combinat/species/recursive_species.py +476 -0
  295. sage/combinat/species/set_species.py +192 -0
  296. sage/combinat/species/species.py +820 -0
  297. sage/combinat/species/structure.py +539 -0
  298. sage/combinat/species/subset_species.py +243 -0
  299. sage/combinat/species/sum_species.py +225 -0
  300. sage/combinat/subword.py +564 -0
  301. sage/combinat/subword_complex.py +2122 -0
  302. sage/combinat/subword_complex_c.cpython-314-darwin.so +0 -0
  303. sage/combinat/subword_complex_c.pyx +119 -0
  304. sage/combinat/super_tableau.py +821 -0
  305. sage/combinat/superpartition.py +1154 -0
  306. sage/combinat/symmetric_group_algebra.py +3774 -0
  307. sage/combinat/symmetric_group_representations.py +1830 -0
  308. sage/combinat/t_sequences.py +877 -0
  309. sage/combinat/tableau.py +9506 -0
  310. sage/combinat/tableau_residues.py +860 -0
  311. sage/combinat/tableau_tuple.py +5353 -0
  312. sage/combinat/tiling.py +2432 -0
  313. sage/combinat/triangles_FHM.py +777 -0
  314. sage/combinat/tutorial.py +1857 -0
  315. sage/combinat/vector_partition.py +337 -0
  316. sage/combinat/words/abstract_word.py +1722 -0
  317. sage/combinat/words/all.py +59 -0
  318. sage/combinat/words/alphabet.py +268 -0
  319. sage/combinat/words/finite_word.py +7201 -0
  320. sage/combinat/words/infinite_word.py +113 -0
  321. sage/combinat/words/lyndon_word.py +652 -0
  322. sage/combinat/words/morphic.py +351 -0
  323. sage/combinat/words/morphism.py +3878 -0
  324. sage/combinat/words/paths.py +2932 -0
  325. sage/combinat/words/shuffle_product.py +278 -0
  326. sage/combinat/words/suffix_trees.py +1873 -0
  327. sage/combinat/words/word.py +765 -0
  328. sage/combinat/words/word_char.cpython-314-darwin.so +0 -0
  329. sage/combinat/words/word_char.pyx +847 -0
  330. sage/combinat/words/word_datatypes.cpython-314-darwin.so +0 -0
  331. sage/combinat/words/word_datatypes.pxd +4 -0
  332. sage/combinat/words/word_datatypes.pyx +1067 -0
  333. sage/combinat/words/word_generators.py +2026 -0
  334. sage/combinat/words/word_infinite_datatypes.py +1218 -0
  335. sage/combinat/words/word_options.py +99 -0
  336. sage/combinat/words/words.py +2396 -0
  337. sage/data_structures/all__sagemath_combinat.py +1 -0
  338. sage/databases/all__sagemath_combinat.py +13 -0
  339. sage/databases/findstat.py +4897 -0
  340. sage/databases/oeis.py +2058 -0
  341. sage/databases/sloane.py +393 -0
  342. sage/dynamics/all__sagemath_combinat.py +14 -0
  343. sage/dynamics/cellular_automata/all.py +7 -0
  344. sage/dynamics/cellular_automata/catalog.py +34 -0
  345. sage/dynamics/cellular_automata/elementary.py +612 -0
  346. sage/dynamics/cellular_automata/glca.py +477 -0
  347. sage/dynamics/cellular_automata/solitons.py +1463 -0
  348. sage/dynamics/finite_dynamical_system.py +1249 -0
  349. sage/dynamics/finite_dynamical_system_catalog.py +382 -0
  350. sage/games/all.py +7 -0
  351. sage/games/hexad.py +704 -0
  352. sage/games/quantumino.py +591 -0
  353. sage/games/sudoku.py +889 -0
  354. sage/games/sudoku_backtrack.cpython-314-darwin.so +0 -0
  355. sage/games/sudoku_backtrack.pyx +189 -0
  356. sage/groups/all__sagemath_combinat.py +1 -0
  357. sage/groups/indexed_free_group.py +489 -0
  358. sage/libs/all__sagemath_combinat.py +6 -0
  359. sage/libs/lrcalc/__init__.py +1 -0
  360. sage/libs/lrcalc/lrcalc.py +525 -0
  361. sage/libs/symmetrica/__init__.py +7 -0
  362. sage/libs/symmetrica/all.py +101 -0
  363. sage/libs/symmetrica/kostka.pxi +168 -0
  364. sage/libs/symmetrica/part.pxi +193 -0
  365. sage/libs/symmetrica/plet.pxi +42 -0
  366. sage/libs/symmetrica/sab.pxi +196 -0
  367. sage/libs/symmetrica/sb.pxi +332 -0
  368. sage/libs/symmetrica/sc.pxi +192 -0
  369. sage/libs/symmetrica/schur.pxi +956 -0
  370. sage/libs/symmetrica/symmetrica.cpython-314-darwin.so +0 -0
  371. sage/libs/symmetrica/symmetrica.pxi +1172 -0
  372. sage/libs/symmetrica/symmetrica.pyx +39 -0
  373. sage/monoids/all.py +13 -0
  374. sage/monoids/automatic_semigroup.py +1054 -0
  375. sage/monoids/free_abelian_monoid.py +315 -0
  376. sage/monoids/free_abelian_monoid_element.cpython-314-darwin.so +0 -0
  377. sage/monoids/free_abelian_monoid_element.pxd +16 -0
  378. sage/monoids/free_abelian_monoid_element.pyx +397 -0
  379. sage/monoids/free_monoid.py +335 -0
  380. sage/monoids/free_monoid_element.py +431 -0
  381. sage/monoids/hecke_monoid.py +65 -0
  382. sage/monoids/string_monoid.py +817 -0
  383. sage/monoids/string_monoid_element.py +547 -0
  384. sage/monoids/string_ops.py +143 -0
  385. sage/monoids/trace_monoid.py +972 -0
  386. sage/rings/all__sagemath_combinat.py +2 -0
  387. sage/sat/all.py +4 -0
  388. sage/sat/boolean_polynomials.py +405 -0
  389. sage/sat/converters/__init__.py +6 -0
  390. sage/sat/converters/anf2cnf.py +14 -0
  391. sage/sat/converters/polybori.py +611 -0
  392. sage/sat/solvers/__init__.py +5 -0
  393. sage/sat/solvers/cryptominisat.py +287 -0
  394. sage/sat/solvers/dimacs.py +783 -0
  395. sage/sat/solvers/picosat.py +228 -0
  396. sage/sat/solvers/sat_lp.py +156 -0
  397. sage/sat/solvers/satsolver.cpython-314-darwin.so +0 -0
  398. sage/sat/solvers/satsolver.pxd +3 -0
  399. sage/sat/solvers/satsolver.pyx +405 -0
@@ -0,0 +1,861 @@
1
+ # sage_setup: distribution = sagemath-combinat
2
+ r"""
3
+ Output functions
4
+
5
+ These are the output functions for latexing and ascii/unicode art versions of
6
+ partitions and tableaux.
7
+
8
+ AUTHORS:
9
+
10
+ - Mike Hansen (?): initial version
11
+ - Andrew Mathas (2013-02-14): Added support for displaying conventions and
12
+ lines, and tableaux of skew partition, composition, and
13
+ skew/composition/partition/tableaux tuple shape.
14
+ - Travis Scrimshaw (2020-08): Added support for ascii/unicode art
15
+ """
16
+
17
+
18
+ from string import Template
19
+ from sage.combinat.tableau import Tableaux
20
+
21
+ # The tex macro used to latex individual cells in an array (as a template).
22
+ # When using bar should be replaced by '|' or ''.
23
+ lr_macro = Template(r'\def\lr#1{\multicolumn{1}{$bar@{\hspace{.6ex}}c@{\hspace{.6ex}}$bar}{\raisebox{-.3ex}{$$#1$$}}}')
24
+
25
+
26
+ def tex_from_array(array, with_lines=True) -> str:
27
+ r"""
28
+ Return a latex string for a two dimensional array of partition, composition
29
+ or skew composition shape.
30
+
31
+ INPUT:
32
+
33
+ - ``array`` -- list of list
34
+ - ``with_lines`` -- boolean (default: ``True``); whether to draw a line to
35
+ separate the entries in the array
36
+
37
+ Empty rows are allowed; however, such rows should be given as
38
+ ``[None]`` rather than ``[]``.
39
+
40
+ The array is drawn using either the English or French convention
41
+ following :meth:`Tableaux.options`.
42
+
43
+ .. SEEALSO:: :meth:`tex_from_array_tuple`
44
+
45
+ EXAMPLES::
46
+
47
+ sage: from sage.combinat.output import tex_from_array
48
+ sage: print(tex_from_array([[1,2,3],[4,5]]))
49
+ {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}}
50
+ \raisebox{-.6ex}{$\begin{array}[b]{*{3}c}\cline{1-3}
51
+ \lr{1}&\lr{2}&\lr{3}\\\cline{1-3}
52
+ \lr{4}&\lr{5}\\\cline{1-2}
53
+ \end{array}$}
54
+ }
55
+ sage: print(tex_from_array([[1,2,3],[4,5]], with_lines=False))
56
+ {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}}
57
+ \raisebox{-.6ex}{$\begin{array}[b]{*{3}c}\\
58
+ \lr{1}&\lr{2}&\lr{3}\\
59
+ \lr{4}&\lr{5}\\
60
+ \end{array}$}
61
+ }
62
+ sage: print(tex_from_array([[1,2,3],[4,5,6,7],[8]]))
63
+ {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}}
64
+ \raisebox{-.6ex}{$\begin{array}[b]{*{4}c}\cline{1-3}
65
+ \lr{1}&\lr{2}&\lr{3}\\\cline{1-4}
66
+ \lr{4}&\lr{5}&\lr{6}&\lr{7}\\\cline{1-4}
67
+ \lr{8}\\\cline{1-1}
68
+ \end{array}$}
69
+ }
70
+ sage: print(tex_from_array([[1,2,3],[4,5,6,7],[8]], with_lines=False))
71
+ {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}}
72
+ \raisebox{-.6ex}{$\begin{array}[b]{*{4}c}\\
73
+ \lr{1}&\lr{2}&\lr{3}\\
74
+ \lr{4}&\lr{5}&\lr{6}&\lr{7}\\
75
+ \lr{8}\\
76
+ \end{array}$}
77
+ }
78
+ sage: print(tex_from_array([[None,None,3],[None,5,6,7],[8]]))
79
+ {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}}
80
+ \raisebox{-.6ex}{$\begin{array}[b]{*{4}c}\cline{3-3}
81
+ &&\lr{3}\\\cline{2-4}
82
+ &\lr{5}&\lr{6}&\lr{7}\\\cline{1-4}
83
+ \lr{8}\\\cline{1-1}
84
+ \end{array}$}
85
+ }
86
+ sage: print(tex_from_array([[None,None,3],[None,5,6,7],[None,8]]))
87
+ {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}}
88
+ \raisebox{-.6ex}{$\begin{array}[b]{*{4}c}\cline{3-3}
89
+ &&\lr{3}\\\cline{2-4}
90
+ &\lr{5}&\lr{6}&\lr{7}\\\cline{2-4}
91
+ &\lr{8}\\\cline{2-2}
92
+ \end{array}$}
93
+ }
94
+ sage: print(tex_from_array([[None,None,3],[None,5,6,7],[8]], with_lines=False))
95
+ {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}}
96
+ \raisebox{-.6ex}{$\begin{array}[b]{*{4}c}\\
97
+ &&\lr{3}\\
98
+ &\lr{5}&\lr{6}&\lr{7}\\
99
+ \lr{8}\\
100
+ \end{array}$}
101
+ }
102
+ sage: print(tex_from_array([[None,None,3],[None,5,6,7],[None,8]], with_lines=False))
103
+ {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}}
104
+ \raisebox{-.6ex}{$\begin{array}[b]{*{4}c}\\
105
+ &&\lr{3}\\
106
+ &\lr{5}&\lr{6}&\lr{7}\\
107
+ &\lr{8}\\
108
+ \end{array}$}
109
+ }
110
+ sage: Tableaux.options.convention="french"
111
+ sage: print(tex_from_array([[1,2,3],[4,5]]))
112
+ {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}}
113
+ \raisebox{-.6ex}{$\begin{array}[t]{*{3}c}\cline{1-2}
114
+ \lr{4}&\lr{5}\\\cline{1-3}
115
+ \lr{1}&\lr{2}&\lr{3}\\\cline{1-3}
116
+ \end{array}$}
117
+ }
118
+ sage: print(tex_from_array([[1,2,3],[4,5]], with_lines=False))
119
+ {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}}
120
+ \raisebox{-.6ex}{$\begin{array}[t]{*{3}c}\\
121
+ \lr{4}&\lr{5}\\
122
+ \lr{1}&\lr{2}&\lr{3}\\
123
+ \end{array}$}
124
+ }
125
+ sage: print(tex_from_array([[1,2,3],[4,5,6,7],[8]]))
126
+ {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}}
127
+ \raisebox{-.6ex}{$\begin{array}[t]{*{4}c}\cline{1-1}
128
+ \lr{8}\\\cline{1-4}
129
+ \lr{4}&\lr{5}&\lr{6}&\lr{7}\\\cline{1-4}
130
+ \lr{1}&\lr{2}&\lr{3}\\\cline{1-3}
131
+ \end{array}$}
132
+ }
133
+ sage: print(tex_from_array([[1,2,3],[4,5,6,7],[8]], with_lines=False))
134
+ {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}}
135
+ \raisebox{-.6ex}{$\begin{array}[t]{*{4}c}\\
136
+ \lr{8}\\
137
+ \lr{4}&\lr{5}&\lr{6}&\lr{7}\\
138
+ \lr{1}&\lr{2}&\lr{3}\\
139
+ \end{array}$}
140
+ }
141
+ sage: print(tex_from_array([[None,None,3],[None,5,6,7],[8]]))
142
+ {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}}
143
+ \raisebox{-.6ex}{$\begin{array}[t]{*{4}c}\cline{1-1}
144
+ \lr{8}\\\cline{1-4}
145
+ &\lr{5}&\lr{6}&\lr{7}\\\cline{2-4}
146
+ &&\lr{3}\\\cline{3-3}
147
+ \end{array}$}
148
+ }
149
+ sage: print(tex_from_array([[None,None,3],[None,5,6,7],[None,8]]))
150
+ {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}}
151
+ \raisebox{-.6ex}{$\begin{array}[t]{*{4}c}\cline{2-2}
152
+ &\lr{8}\\\cline{2-4}
153
+ &\lr{5}&\lr{6}&\lr{7}\\\cline{2-4}
154
+ &&\lr{3}\\\cline{3-3}
155
+ \end{array}$}
156
+ }
157
+ sage: print(tex_from_array([[None,None,3],[None,5,6,7],[8]], with_lines=False))
158
+ {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}}
159
+ \raisebox{-.6ex}{$\begin{array}[t]{*{4}c}\\
160
+ \lr{8}\\
161
+ &\lr{5}&\lr{6}&\lr{7}\\
162
+ &&\lr{3}\\
163
+ \end{array}$}
164
+ }
165
+ sage: print(tex_from_array([[None,None,3],[None,5,6,7],[None,8]], with_lines=False))
166
+ {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}}
167
+ \raisebox{-.6ex}{$\begin{array}[t]{*{4}c}\\
168
+ &\lr{8}\\
169
+ &\lr{5}&\lr{6}&\lr{7}\\
170
+ &&\lr{3}\\
171
+ \end{array}$}
172
+ }
173
+ sage: Tableaux.options.convention="russian"
174
+ sage: print(tex_from_array([[1,2,3],[4,5]]))
175
+ {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}}
176
+ \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{3}c}\cline{1-2}
177
+ \lr{\rotatebox{-45}{4}}&\lr{\rotatebox{-45}{5}}\\\cline{1-3}
178
+ \lr{\rotatebox{-45}{1}}&\lr{\rotatebox{-45}{2}}&\lr{\rotatebox{-45}{3}}\\\cline{1-3}
179
+ \end{array}$}}
180
+ }
181
+ sage: print(tex_from_array([[1,2,3],[4,5]], with_lines=False))
182
+ {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}}
183
+ \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{3}c}\\
184
+ \lr{\rotatebox{-45}{4}}&\lr{\rotatebox{-45}{5}}\\
185
+ \lr{\rotatebox{-45}{1}}&\lr{\rotatebox{-45}{2}}&\lr{\rotatebox{-45}{3}}\\
186
+ \end{array}$}}
187
+ }
188
+ sage: print(tex_from_array([[1,2,3],[4,5,6,7],[8]]))
189
+ {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}}
190
+ \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{4}c}\cline{1-1}
191
+ \lr{\rotatebox{-45}{8}}\\\cline{1-4}
192
+ \lr{\rotatebox{-45}{4}}&\lr{\rotatebox{-45}{5}}&\lr{\rotatebox{-45}{6}}&\lr{\rotatebox{-45}{7}}\\\cline{1-4}
193
+ \lr{\rotatebox{-45}{1}}&\lr{\rotatebox{-45}{2}}&\lr{\rotatebox{-45}{3}}\\\cline{1-3}
194
+ \end{array}$}}
195
+ }
196
+ sage: print(tex_from_array([[1,2,3],[4,5,6,7],[8]], with_lines=False))
197
+ {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}}
198
+ \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{4}c}\\
199
+ \lr{\rotatebox{-45}{8}}\\
200
+ \lr{\rotatebox{-45}{4}}&\lr{\rotatebox{-45}{5}}&\lr{\rotatebox{-45}{6}}&\lr{\rotatebox{-45}{7}}\\
201
+ \lr{\rotatebox{-45}{1}}&\lr{\rotatebox{-45}{2}}&\lr{\rotatebox{-45}{3}}\\
202
+ \end{array}$}}
203
+ }
204
+ sage: print(tex_from_array([[None,None,3],[None,5,6,7],[8]]))
205
+ {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}}
206
+ \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{4}c}\cline{1-1}
207
+ \lr{\rotatebox{-45}{8}}\\\cline{1-4}
208
+ &\lr{\rotatebox{-45}{5}}&\lr{\rotatebox{-45}{6}}&\lr{\rotatebox{-45}{7}}\\\cline{2-4}
209
+ &&\lr{\rotatebox{-45}{3}}\\\cline{3-3}
210
+ \end{array}$}}
211
+ }
212
+ sage: print(tex_from_array([[None,None,3],[None,5,6,7],[None,8]]))
213
+ {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}}
214
+ \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{4}c}\cline{2-2}
215
+ &\lr{\rotatebox{-45}{8}}\\\cline{2-4}
216
+ &\lr{\rotatebox{-45}{5}}&\lr{\rotatebox{-45}{6}}&\lr{\rotatebox{-45}{7}}\\\cline{2-4}
217
+ &&\lr{\rotatebox{-45}{3}}\\\cline{3-3}
218
+ \end{array}$}}
219
+ }
220
+ sage: print(tex_from_array([[None,None,3],[None,5,6,7],[8]], with_lines=False))
221
+ {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}}
222
+ \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{4}c}\\
223
+ \lr{\rotatebox{-45}{8}}\\
224
+ &\lr{\rotatebox{-45}{5}}&\lr{\rotatebox{-45}{6}}&\lr{\rotatebox{-45}{7}}\\
225
+ &&\lr{\rotatebox{-45}{3}}\\
226
+ \end{array}$}}
227
+ }
228
+ sage: print(tex_from_array([[None,None,3],[None,5,6,7],[None,8]], with_lines=False))
229
+ {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}}
230
+ \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{4}c}\\
231
+ &\lr{\rotatebox{-45}{8}}\\
232
+ &\lr{\rotatebox{-45}{5}}&\lr{\rotatebox{-45}{6}}&\lr{\rotatebox{-45}{7}}\\
233
+ &&\lr{\rotatebox{-45}{3}}\\
234
+ \end{array}$}}
235
+ }
236
+
237
+ sage: Tableaux.options._reset()
238
+ """
239
+ lr = lr_macro.substitute(bar='|' if with_lines else '')
240
+ if Tableaux.options.convention == "English":
241
+ return '{%s\n%s\n}' % (lr, tex_from_skew_array(array, with_lines))
242
+ return '{%s\n%s\n}' % (lr, tex_from_skew_array(array[::-1], with_lines,
243
+ align='t'))
244
+
245
+
246
+ def svg_from_array(array, with_lines=True) -> str:
247
+ """
248
+ Return the svg code for this array.
249
+
250
+ EXAMPLES::
251
+
252
+ sage: array=[[1,9,1],[6,9,1],[2,8,3,3]]
253
+ sage: sage.combinat.output.svg_from_array(array)
254
+ '<?xml version="1.0" ...</svg>'
255
+ """
256
+ if Tableaux.options.convention == "English":
257
+ return svg_from_skew_array(array, with_lines)
258
+ return svg_from_skew_array(array[::-1], with_lines, align='t')
259
+
260
+
261
+ def tex_from_array_tuple(a_tuple, with_lines=True) -> str:
262
+ r"""
263
+ Return a latex string for a tuple of two dimensional array of partition,
264
+ composition or skew composition shape.
265
+
266
+ INPUT:
267
+
268
+ - ``a_tuple`` -- tuple of lists of lists
269
+ - ``with_lines`` -- boolean (default: ``True``); whether to draw lines to
270
+ separate the entries in the components of ``a_tuple``
271
+
272
+ .. SEEALSO:: :meth:`tex_from_array` for the description of each array
273
+
274
+ EXAMPLES::
275
+
276
+ sage: from sage.combinat.output import tex_from_array_tuple
277
+ sage: print(tex_from_array_tuple([[[1,2,3],[4,5]],[],[[None,6,7],[None,8],[9]]]))
278
+ {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}}
279
+ \raisebox{-.6ex}{$\begin{array}[b]{*{3}c}\cline{1-3}
280
+ \lr{1}&\lr{2}&\lr{3}\\\cline{1-3}
281
+ \lr{4}&\lr{5}\\\cline{1-2}
282
+ \end{array}$},\emptyset,\raisebox{-.6ex}{$\begin{array}[b]{*{3}c}\cline{2-3}
283
+ &\lr{6}&\lr{7}\\\cline{2-3}
284
+ &\lr{8}\\\cline{1-2}
285
+ \lr{9}\\\cline{1-1}
286
+ \end{array}$}
287
+ }
288
+ sage: print(tex_from_array_tuple([[[1,2,3],[4,5]],[],[[None,6,7],[None,8],[9]]], with_lines=False))
289
+ {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}}
290
+ \raisebox{-.6ex}{$\begin{array}[b]{*{3}c}\\
291
+ \lr{1}&\lr{2}&\lr{3}\\
292
+ \lr{4}&\lr{5}\\
293
+ \end{array}$},\emptyset,\raisebox{-.6ex}{$\begin{array}[b]{*{3}c}\\
294
+ &\lr{6}&\lr{7}\\
295
+ &\lr{8}\\
296
+ \lr{9}\\
297
+ \end{array}$}
298
+ }
299
+ sage: Tableaux.options.convention="french"
300
+ sage: print(tex_from_array_tuple([[[1,2,3],[4,5]],[],[[None,6,7],[None,8],[9]]]))
301
+ {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}}
302
+ \raisebox{-.6ex}{$\begin{array}[t]{*{3}c}\cline{1-2}
303
+ \lr{4}&\lr{5}\\\cline{1-3}
304
+ \lr{1}&\lr{2}&\lr{3}\\\cline{1-3}
305
+ \end{array}$},\emptyset,\raisebox{-.6ex}{$\begin{array}[t]{*{3}c}\cline{1-1}
306
+ \lr{9}\\\cline{1-2}
307
+ &\lr{8}\\\cline{2-3}
308
+ &\lr{6}&\lr{7}\\\cline{2-3}
309
+ \end{array}$}
310
+ }
311
+ sage: print(tex_from_array_tuple([[[1,2,3],[4,5]],[],[[None,6,7],[None,8],[9]]], with_lines=False))
312
+ {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}}
313
+ \raisebox{-.6ex}{$\begin{array}[t]{*{3}c}\\
314
+ \lr{4}&\lr{5}\\
315
+ \lr{1}&\lr{2}&\lr{3}\\
316
+ \end{array}$},\emptyset,\raisebox{-.6ex}{$\begin{array}[t]{*{3}c}\\
317
+ \lr{9}\\
318
+ &\lr{8}\\
319
+ &\lr{6}&\lr{7}\\
320
+ \end{array}$}
321
+ }
322
+ sage: Tableaux.options.convention="russian"
323
+ sage: print(tex_from_array_tuple([[[1,2,3],[4,5]],[],[[None,6,7],[None,8],[9]]]))
324
+ {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}}
325
+ \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{3}c}\cline{1-2}
326
+ \lr{\rotatebox{-45}{4}}&\lr{\rotatebox{-45}{5}}\\\cline{1-3}
327
+ \lr{\rotatebox{-45}{1}}&\lr{\rotatebox{-45}{2}}&\lr{\rotatebox{-45}{3}}\\\cline{1-3}
328
+ \end{array}$}},\emptyset,\raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{3}c}\cline{1-1}
329
+ \lr{\rotatebox{-45}{9}}\\\cline{1-2}
330
+ &\lr{\rotatebox{-45}{8}}\\\cline{2-3}
331
+ &\lr{\rotatebox{-45}{6}}&\lr{\rotatebox{-45}{7}}\\\cline{2-3}
332
+ \end{array}$}}
333
+ }
334
+ sage: print(tex_from_array_tuple([[[1,2,3],[4,5]],[],[[None,6,7],[None,8],[9]]], with_lines=False))
335
+ {\def\lr#1{\multicolumn{1}{@{\hspace{.6ex}}c@{\hspace{.6ex}}}{\raisebox{-.3ex}{$#1$}}}
336
+ \raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{3}c}\\
337
+ \lr{\rotatebox{-45}{4}}&\lr{\rotatebox{-45}{5}}\\
338
+ \lr{\rotatebox{-45}{1}}&\lr{\rotatebox{-45}{2}}&\lr{\rotatebox{-45}{3}}\\
339
+ \end{array}$}},\emptyset,\raisebox{-.6ex}{\rotatebox{45}{$\begin{array}[t]{*{3}c}\\
340
+ \lr{\rotatebox{-45}{9}}\\
341
+ &\lr{\rotatebox{-45}{8}}\\
342
+ &\lr{\rotatebox{-45}{6}}&\lr{\rotatebox{-45}{7}}\\
343
+ \end{array}$}}
344
+ }
345
+
346
+ sage: Tableaux.options._reset()
347
+ """
348
+ lr = lr_macro.substitute(bar='|' if with_lines else '')
349
+ if Tableaux.options.convention == "English":
350
+ return '{%s\n%s\n}' % (lr, ','.join(
351
+ r'\emptyset' if not comp else tex_from_skew_array(comp, with_lines) for comp in a_tuple))
352
+ else:
353
+ return '{%s\n%s\n}' % (lr, ','.join(
354
+ r'\emptyset' if not comp else tex_from_skew_array(comp[::-1], with_lines, align='t') for comp in a_tuple))
355
+
356
+
357
+ def tex_from_skew_array(array, with_lines=False, align='b') -> str:
358
+ r"""
359
+ Create latex code for a "skew composition" ``array``.
360
+
361
+ That is, for a two dimensional array in which each row can begin
362
+ with an arbitrary number ``None``'s and the remaining entries
363
+ could, in principle, be anything but probably should be strings or
364
+ integers of similar width. A row consisting completely of
365
+ ``None``'s is allowed.
366
+
367
+ INPUT:
368
+
369
+ - ``array`` -- the array
370
+
371
+ - ``with_lines`` -- (default: ``False``) if ``True`` lines are drawn, if
372
+ ``False`` they are not
373
+
374
+ - ``align`` -- (default: ``'b'``) determine the alignment on the latex
375
+ array environments
376
+
377
+ EXAMPLES::
378
+
379
+ sage: array=[[None, 2,3,4],[None,None],[5,6,7,8]]
380
+ sage: print(sage.combinat.output.tex_from_skew_array(array))
381
+ \raisebox{-.6ex}{$\begin{array}[b]{*{4}c}\\
382
+ &\lr{2}&\lr{3}&\lr{4}\\
383
+ &\\
384
+ \lr{5}&\lr{6}&\lr{7}&\lr{8}\\
385
+ \end{array}$}
386
+
387
+ TESTS::
388
+
389
+ sage: sage.combinat.output.tex_from_skew_array([(1,2,3), (2,3,4)])
390
+ '\\raisebox{-.6ex}{$\\begin{array}[b]{*{3}c}\\\\\n\\lr{1}&\\lr{2}&\\lr{3}\\\\\n\\lr{2}&\\lr{3}&\\lr{4}\\\\\n\\end{array}$}'
391
+ sage: sage.combinat.output.tex_from_skew_array([((1,2,),)])
392
+ '\\raisebox{-.6ex}{$\\begin{array}[b]{*{1}c}\\\\\n\\lr{(1, 2)}\\\\\n\\end{array}$}'
393
+ """
394
+ # first identify where the None's appear in ``array`` and define a
395
+ # function end_line which puts in the required \cline's.
396
+ if with_lines:
397
+ # last position of None in each row
398
+ nones = [1 if None not in row else 1 + len(row) - row[::-1].index(None)
399
+ for row in array]
400
+
401
+ def end_line(r):
402
+ # in a slightly unpythonic way, we label the lines as 0, 1, ..., len(array)
403
+ if r == 0:
404
+ return r'\cline{%s-%s}' % (nones[0], len(array[0]))
405
+ elif r == len(array):
406
+ start = nones[r-1]
407
+ finish = len(array[r-1])
408
+ else:
409
+ start = min(nones[r], nones[r-1])
410
+ finish = max(len(array[r]), len(array[r-1]))
411
+ return r'\\' if start > finish else r'\\\cline{%s-%s}' % (start, finish)
412
+ else:
413
+ def end_line(r):
414
+ return r'\\'
415
+
416
+ # now we draw the array
417
+ raisebox_start = r'\raisebox{-.6ex}{'
418
+ raisebox_end = r'}'
419
+ lr_start = r'\lr{'
420
+ lr_end = r'}'
421
+ if Tableaux.options.convention == "Russian":
422
+ raisebox_start += r'\rotatebox{45}{'
423
+ raisebox_end += r'}'
424
+ lr_start += r'\rotatebox{-45}{'
425
+ lr_end += r'}'
426
+
427
+ tex = r'%s$\begin{array}[%s]{*{%s}c}' % (raisebox_start, align, max(map(len, array)))
428
+ tex += end_line(0)+'\n'
429
+ for r in range(len(array)):
430
+ tex += '&'.join('' if c is None else r'%s%s%s' % (lr_start, c, lr_end)
431
+ for c in array[r])
432
+ tex += end_line(r+1)+'\n'
433
+ return tex + r'\end{array}$' + raisebox_end
434
+
435
+
436
+ def svg_from_skew_array(array, with_lines=False, align='b') -> str:
437
+ """
438
+ Return the svg code for this skew array.
439
+
440
+ EXAMPLES::
441
+
442
+ sage: array=[[None, 2,3,4],[None,None],[5,6,7,8]]
443
+ sage: sage.combinat.output.svg_from_skew_array(array)
444
+ '<?xml version="1.0" ...</svg>'
445
+ """
446
+ resu = '<?xml version=\"1.0\" standalone=\"no\"?>'
447
+ resu += '<svg xmlns=\"http://www.w3.org/2000/svg\" '
448
+ resu += 'xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"300\" viewBox='
449
+
450
+ resu1 = '<defs><polygon points=\"0, 0 10, 0 10, 10 0, 10\" '
451
+ resu1 += 'id=\"square\" style=\"stroke-width:0.1;stroke:black;fill:white\"/></defs>'
452
+ resu1 += '<g style=\"stroke-width:0.1;fill:steelblue;font-size:6;dominant-baseline:middle;text-anchor:middle\">'
453
+
454
+ Nx = max((len(line) for line in array), default=0)
455
+ Ny = len(array)
456
+ # viewBox
457
+ resu += '\"%.3f %.3f %.3f %.3f \">' % (-5, -5,
458
+ 10 * Nx + 10, 10 * Ny + 10)
459
+ resu += resu1
460
+
461
+ for i, line in enumerate(array):
462
+ ci = 10 * i
463
+ for j, content in enumerate(line):
464
+ cj = 10 * j
465
+ if content is not None:
466
+ resu += '<use transform=\"translate(%.3f, %.3f)' % (cj, ci)
467
+ resu += '\" xlink:href=\"#square\" />'
468
+ resu += f'<text x=\"{cj + 5}\" y=\"{ci + 5}\">{content}</text>'
469
+ return resu + '</g></svg>'
470
+
471
+
472
+ def ascii_art_table(data, use_unicode=False, convention='English'):
473
+ r"""
474
+ Return an ascii art table of ``data``.
475
+
476
+ EXAMPLES::
477
+
478
+ sage: from sage.combinat.output import ascii_art_table
479
+
480
+ sage: data = [[None, None, 1], [2, 2], [3,4,5], [None, None, 10], [], [6]]
481
+ sage: print(ascii_art_table(data))
482
+ +----+
483
+ | 1 |
484
+ +---+---+----+
485
+ | 2 | 2 |
486
+ +---+---+----+
487
+ | 3 | 4 | 5 |
488
+ +---+---+----+
489
+ | 10 |
490
+ +----+
491
+ <BLANKLINE>
492
+ +---+
493
+ | 6 |
494
+ +---+
495
+ sage: print(ascii_art_table(data, use_unicode=True))
496
+ ┌────┐
497
+ │ 1 │
498
+ ┌───┬───┼────┘
499
+ │ 2 │ 2 │
500
+ ├───┼───┼────┐
501
+ │ 3 │ 4 │ 5 │
502
+ └───┴───┼────┤
503
+ │ 10 │
504
+ └────┘
505
+ <BLANKLINE>
506
+ ┌───┐
507
+ │ 6 │
508
+ └───┘
509
+
510
+ sage: data = [[1, None, 2], [None, 2]]
511
+ sage: print(ascii_art_table(data))
512
+ +---+ +---+
513
+ | 1 | | 2 |
514
+ +---+---+---+
515
+ | 2 |
516
+ +---+
517
+ sage: print(ascii_art_table(data, use_unicode=True))
518
+ ┌───┐ ┌───┐
519
+ │ 1 │ │ 2 │
520
+ └───┼───┼───┘
521
+ │ 2 │
522
+ └───┘
523
+ """
524
+ if convention == "Russian":
525
+ return ascii_art_table_russian(data, use_unicode)
526
+
527
+ if use_unicode:
528
+ import unicodedata
529
+ v = unicodedata.lookup('BOX DRAWINGS LIGHT VERTICAL')
530
+ h = unicodedata.lookup('BOX DRAWINGS LIGHT HORIZONTAL')
531
+ dl = unicodedata.lookup('BOX DRAWINGS LIGHT DOWN AND LEFT')
532
+ dr = unicodedata.lookup('BOX DRAWINGS LIGHT DOWN AND RIGHT')
533
+ ul = unicodedata.lookup('BOX DRAWINGS LIGHT UP AND LEFT')
534
+ ur = unicodedata.lookup('BOX DRAWINGS LIGHT UP AND RIGHT')
535
+ vr = unicodedata.lookup('BOX DRAWINGS LIGHT VERTICAL AND RIGHT')
536
+ vl = unicodedata.lookup('BOX DRAWINGS LIGHT VERTICAL AND LEFT')
537
+ uh = unicodedata.lookup('BOX DRAWINGS LIGHT UP AND HORIZONTAL')
538
+ dh = unicodedata.lookup('BOX DRAWINGS LIGHT DOWN AND HORIZONTAL')
539
+ vh = unicodedata.lookup('BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL')
540
+ from sage.typeset.unicode_art import unicode_art as art
541
+ else:
542
+ v = '|'
543
+ h = '-'
544
+ dl = dr = ul = ur = vr = vl = uh = dh = vh = '+'
545
+ from sage.typeset.ascii_art import ascii_art as art
546
+
547
+ if not data:
548
+ # return dr + dl + '\n' + ur + ul
549
+ return ''
550
+
551
+ # Convert the input into a rectangular array with the top and bottom row
552
+ # being all None's for ease later on.
553
+ ncols = max(len(row) for row in data)
554
+ str_tab = [[None]*ncols] + [[art(val) if val is not None else None for val in row] + [None]*(ncols-len(row))
555
+ for row in data]
556
+ str_tab.append([None]*ncols)
557
+ # Get the widths of the columns
558
+ col_widths = [1]*len(str_tab[0])
559
+ if use_unicode:
560
+ # Special handling of overline not adding to printed length
561
+ def get_len(e):
562
+ if e is None:
563
+ return 0
564
+ return len(e) - list(str(e)).count("\u0304")
565
+ else:
566
+ def get_len(e):
567
+ if e is None:
568
+ return 0
569
+ return len(e)
570
+ for row in str_tab:
571
+ for i, e in enumerate(row):
572
+ col_widths[i] = max(col_widths[i], get_len(e))
573
+
574
+ matr = [] # just the list of lines
575
+ for nrow, row in enumerate(str_tab):
576
+ if nrow == 0: # skip the first row
577
+ continue
578
+
579
+ l1 = ""
580
+ l2 = ""
581
+ for i, (e, w) in enumerate(zip(row, col_widths)):
582
+ prev_row = str_tab[nrow-1]
583
+ if i == 0:
584
+ if e is None:
585
+ if prev_row[i] is None:
586
+ l1 += " "*(3+w)
587
+ else:
588
+ l1 += ur + h*(2+w)
589
+ l2 += " "*(3+w)
590
+ else:
591
+ if prev_row[i] is None:
592
+ l1 += dr + h*(2+w)
593
+ else:
594
+ l1 += vr + h*(2+w)
595
+ l2 += "{} {:^{width}} ".format(v, e, width=w)
596
+ else:
597
+ if e is None:
598
+ if row[i-1] is None:
599
+ if prev_row[i-1] is None:
600
+ if prev_row[i] is None:
601
+ l1 += " "*(3+w)
602
+ else:
603
+ l1 += ur + h*(2+w)
604
+ else:
605
+ if prev_row[i] is None:
606
+ l1 += ul + " "*(2+w)
607
+ else:
608
+ l1 += uh + h*(2+w)
609
+ l2 += " "*(3+w)
610
+ else:
611
+ if prev_row[i-1] is None:
612
+ if prev_row[i] is None:
613
+ l1 += dl + " "*(2+w)
614
+ else:
615
+ l1 += vh + h*(2+w)
616
+ else:
617
+ if prev_row[i] is None:
618
+ l1 += vl + " "*(2+w)
619
+ else:
620
+ l1 += vh + h*(2+w)
621
+ l2 += v + " "*(2+w)
622
+ else:
623
+ if row[i-1] is None:
624
+ if prev_row[i-1] is None:
625
+ if prev_row[i] is None:
626
+ l1 += dr + h*(2+w)
627
+ else:
628
+ l1 += vr + h*(2+w)
629
+ else:
630
+ l1 += vh + h*(2+w)
631
+ else:
632
+ if prev_row[i-1] is None and prev_row[i] is None:
633
+ l1 += dh + h*(2+w)
634
+ else:
635
+ l1 += vh + h*(2+w)
636
+ l2 += "{} {:^{width}} ".format(v, e, width=w)
637
+
638
+ if row[-1] is None:
639
+ if prev_row[-1] is None:
640
+ l1 += " "
641
+ else:
642
+ l1 += ul
643
+ l2 += " "
644
+ else:
645
+ if prev_row[-1] is None:
646
+ l1 += dl
647
+ else:
648
+ l1 += vl
649
+ l2 += v
650
+
651
+ matr.append(l1)
652
+ matr.append(l2)
653
+
654
+ matr.pop() # Remove the last row (which is blank)
655
+
656
+ if convention == "English":
657
+ return "\n".join(matr)
658
+ else:
659
+ output = "\n".join(reversed(matr))
660
+ if use_unicode:
661
+ tr = {
662
+ ord(dl): ul, ord(dr): ur,
663
+ ord(ul): dl, ord(ur): dr,
664
+ ord(dh): uh, ord(uh): dh}
665
+ return output.translate(tr)
666
+ else:
667
+ return output
668
+
669
+
670
+ def ascii_art_table_russian(data, use_unicode=False, compact=False):
671
+ r"""
672
+ Return an ascii art table of ``data`` for the russian convention.
673
+
674
+ EXAMPLES::
675
+
676
+ sage: from sage.combinat.output import ascii_art_table_russian
677
+ sage: data = [[None, None, 1], [2, 2], [3,4,5], [None, None, 10], [], [6]]
678
+ sage: print(ascii_art_table_russian(data))
679
+ / \ / \
680
+ / \ / \
681
+ \ 6 / \ 10 \
682
+ \ / \ / \
683
+ \ / \ / \
684
+ X 5 /
685
+ / \ /
686
+ / \ /
687
+ / 4 X
688
+ / \ / \ / \
689
+ / \ / \ / \
690
+ \ 3 X 2 X 1 /
691
+ \ / \ / \ /
692
+ \ / \ / \ /
693
+ \ 2 /
694
+ \ /
695
+ \ /
696
+ sage: print(ascii_art_table_russian(data, use_unicode=True))
697
+ ╱ ╲ ╱ ╲
698
+ ╱ ╲ ╱ ╲
699
+ ╲ 6 ╱ ╲ 10 ╲
700
+ ╲ ╱ ╲ ╱ ╲
701
+ ╲ ╱ ╲ ╱ ╲
702
+ ╳ 5 ╱
703
+ ╱ ╲ ╱
704
+ ╱ ╲ ╱
705
+ ╱ 4 ╳
706
+ ╱ ╲ ╱ ╲ ╱ ╲
707
+ ╱ ╲ ╱ ╲ ╱ ╲
708
+ ╲ 3 ╳ 2 ╳ 1 ╱
709
+ ╲ ╱ ╲ ╱ ╲ ╱
710
+ ╲ ╱ ╲ ╱ ╲ ╱
711
+ ╲ 2 ╱
712
+ ╲ ╱
713
+ ╲ ╱
714
+ sage: data = [[1, None, 2], [None, 2]]
715
+ sage: print(ascii_art_table_russian(data))
716
+ / \ / \
717
+ \ 2 X 2 /
718
+ \ / \ /
719
+ X
720
+ / \
721
+ \ 1 /
722
+ \ /
723
+ sage: print(ascii_art_table_russian(data, use_unicode=True))
724
+ ╱ ╲ ╱ ╲
725
+ ╲ 2 ╳ 2 ╱
726
+ ╲ ╱ ╲ ╱
727
+
728
+ ╱ ╲
729
+ ╲ 1 ╱
730
+ ╲ ╱
731
+ """
732
+ if use_unicode:
733
+ import unicodedata
734
+ urdl = unicodedata.lookup('BOX DRAWINGS LIGHT DIAGONAL UPPER RIGHT TO LOWER LEFT')
735
+ uldr = unicodedata.lookup('BOX DRAWINGS LIGHT DIAGONAL UPPER LEFT TO LOWER RIGHT')
736
+ x = unicodedata.lookup('BOX DRAWINGS LIGHT DIAGONAL CROSS')
737
+ else:
738
+ urdl = '/'
739
+ uldr = '\\'
740
+ x = 'X'
741
+
742
+ if not data:
743
+ # return urdl + uldr + '\n' + uldr + urdl
744
+ return ''
745
+
746
+ if use_unicode:
747
+ # Special handling of overline not adding to printed length
748
+ def get_len(e):
749
+ if e is None:
750
+ return 0
751
+ return len(e) - list(str(e)).count("\u0304")
752
+ else:
753
+ def get_len(e):
754
+ if e is None:
755
+ return 0
756
+ return len(e)
757
+
758
+ # Length of max string (ensure it's odd)
759
+ str_tab = [[str(val) if val is not None else None for val in row] for row in data]
760
+ max_str = max([max([1] + [get_len(e) for e in row]) for row in str_tab])
761
+ max_str = max_str + 1 - (max_str % 2)
762
+
763
+ if compact:
764
+ diag_length = max_str
765
+ else:
766
+ diag_length = max_str + 2 # space on both sides
767
+
768
+ row_height = int((diag_length + 1) // 2)
769
+ max_height = max(a + len(val) for a, val in enumerate(str_tab))
770
+ str_list = []
771
+ for k in range(max_height, -1, -1):
772
+ for i in range(row_height):
773
+ if k == max_height and i == 0:
774
+ continue
775
+ st = ' ' * ((max_height - k) * row_height)
776
+ for j in range(k + 1):
777
+ N_box = box_exists(str_tab, k-j+1, j)
778
+ S_box = box_exists(str_tab, k-j, j-1)
779
+ SE_box = box_exists(str_tab, k-j-1, j)
780
+ E_box = box_exists(str_tab, k-j, j)
781
+ W_box = box_exists(str_tab, k-j+1, j-1)
782
+ if i == 0:
783
+ if (N_box and S_box) or (W_box and E_box):
784
+ st += x
785
+ elif (E_box and S_box) or (W_box and N_box):
786
+ st += urdl
787
+ elif (E_box and N_box) or (W_box and S_box):
788
+ st += uldr
789
+ elif E_box:
790
+ st += uldr
791
+ elif W_box:
792
+ st += urdl
793
+ else:
794
+ st += ' '
795
+ if E_box:
796
+ st_num = str_tab[k-j][j]
797
+ ln_left = len(st_num) // 2
798
+ st += st_num.rjust(row_height - 1 - ln_left + len(st_num), ' ').ljust(diag_length, ' ')
799
+ else:
800
+ st += ' ' * diag_length
801
+ if j == k and E_box:
802
+ st += urdl
803
+ else:
804
+ lstr = ' '
805
+ rstr = ' '
806
+ if E_box or S_box:
807
+ lstr = uldr
808
+ if E_box or SE_box:
809
+ rstr = urdl
810
+ st += ' ' * i
811
+ st += lstr
812
+ st += ' ' * (2 * (row_height - i) - 1)
813
+ st += rstr
814
+ st += ' ' * (i-1)
815
+ str_list.append(st)
816
+
817
+ import re
818
+ mm = min(len(re.search('^ +', ell)[0]) for ell in str_list) - 1
819
+ str_list = [ell[mm:].rstrip() for ell in str_list]
820
+ while not str_list[-1]:
821
+ str_list.pop()
822
+ return "\n".join(str_list)
823
+
824
+
825
+ def box_exists(tab, i, j) -> bool:
826
+ r"""
827
+ Return ``True`` if ``tab[i][j]`` exists and is not ``None``.
828
+
829
+ In particular this
830
+ allows for `tab[i][j]` to be ``''`` or ``0``.
831
+
832
+ INPUT:
833
+
834
+ - ``tab`` -- list of lists
835
+ - ``i`` -- first coordinate
836
+ - ``j`` -- second coordinate
837
+
838
+ TESTS::
839
+
840
+ sage: from sage.combinat.output import box_exists
841
+ sage: tab = [[1,None,'', 0],[None]]
842
+ sage: box_exists(tab, 0, 0)
843
+ True
844
+ sage: box_exists(tab, 0, 1)
845
+ False
846
+ sage: box_exists(tab, 0, 2)
847
+ True
848
+ sage: box_exists(tab, 0, 3)
849
+ True
850
+ sage: box_exists(tab, 0, 4)
851
+ False
852
+ sage: box_exists(tab, 1, 0)
853
+ False
854
+ sage: box_exists(tab, 1, 1)
855
+ False
856
+ sage: box_exists(tab, 0, -1)
857
+ False
858
+ """
859
+ if j < 0 or i < 0:
860
+ return False
861
+ return len(tab) > i and len(tab[i]) > j and tab[i][j] is not None