passagemath-combinat 10.6.42__cp314-cp314-musllinux_1_2_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (400) hide show
  1. passagemath_combinat/__init__.py +3 -0
  2. passagemath_combinat-10.6.42.dist-info/METADATA +160 -0
  3. passagemath_combinat-10.6.42.dist-info/RECORD +400 -0
  4. passagemath_combinat-10.6.42.dist-info/WHEEL +5 -0
  5. passagemath_combinat-10.6.42.dist-info/top_level.txt +3 -0
  6. passagemath_combinat.libs/libgmp-0e7fc84e.so.10.5.0 +0 -0
  7. passagemath_combinat.libs/libsymmetrica-81fe8739.so.3.0.0 +0 -0
  8. sage/algebras/affine_nil_temperley_lieb.py +263 -0
  9. sage/algebras/all.py +24 -0
  10. sage/algebras/all__sagemath_combinat.py +35 -0
  11. sage/algebras/askey_wilson.py +935 -0
  12. sage/algebras/associated_graded.py +345 -0
  13. sage/algebras/cellular_basis.py +350 -0
  14. sage/algebras/cluster_algebra.py +2766 -0
  15. sage/algebras/down_up_algebra.py +860 -0
  16. sage/algebras/free_algebra.py +1698 -0
  17. sage/algebras/free_algebra_element.py +345 -0
  18. sage/algebras/free_algebra_quotient.py +405 -0
  19. sage/algebras/free_algebra_quotient_element.py +295 -0
  20. sage/algebras/free_zinbiel_algebra.py +885 -0
  21. sage/algebras/hall_algebra.py +783 -0
  22. sage/algebras/hecke_algebras/all.py +4 -0
  23. sage/algebras/hecke_algebras/ariki_koike_algebra.py +1796 -0
  24. sage/algebras/hecke_algebras/ariki_koike_specht_modules.py +475 -0
  25. sage/algebras/hecke_algebras/cubic_hecke_algebra.py +3520 -0
  26. sage/algebras/hecke_algebras/cubic_hecke_base_ring.py +1473 -0
  27. sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py +1079 -0
  28. sage/algebras/iwahori_hecke_algebra.py +3095 -0
  29. sage/algebras/jordan_algebra.py +1773 -0
  30. sage/algebras/lie_conformal_algebras/abelian_lie_conformal_algebra.py +113 -0
  31. sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py +156 -0
  32. sage/algebras/lie_conformal_algebras/all.py +18 -0
  33. sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py +134 -0
  34. sage/algebras/lie_conformal_algebras/examples.py +43 -0
  35. sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py +131 -0
  36. sage/algebras/lie_conformal_algebras/finitely_freely_generated_lca.py +139 -0
  37. sage/algebras/lie_conformal_algebras/free_bosons_lie_conformal_algebra.py +174 -0
  38. sage/algebras/lie_conformal_algebras/free_fermions_lie_conformal_algebra.py +167 -0
  39. sage/algebras/lie_conformal_algebras/freely_generated_lie_conformal_algebra.py +107 -0
  40. sage/algebras/lie_conformal_algebras/graded_lie_conformal_algebra.py +135 -0
  41. sage/algebras/lie_conformal_algebras/lie_conformal_algebra.py +353 -0
  42. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py +236 -0
  43. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_basis.py +78 -0
  44. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py +328 -0
  45. sage/algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py +117 -0
  46. sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py +86 -0
  47. sage/algebras/lie_conformal_algebras/virasoro_lie_conformal_algebra.py +82 -0
  48. sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py +205 -0
  49. sage/algebras/nil_coxeter_algebra.py +191 -0
  50. sage/algebras/q_commuting_polynomials.py +673 -0
  51. sage/algebras/q_system.py +608 -0
  52. sage/algebras/quantum_clifford.py +959 -0
  53. sage/algebras/quantum_groups/ace_quantum_onsager.py +693 -0
  54. sage/algebras/quantum_groups/all.py +9 -0
  55. sage/algebras/quantum_groups/fock_space.py +2219 -0
  56. sage/algebras/quantum_groups/q_numbers.py +207 -0
  57. sage/algebras/quantum_groups/quantum_group_gap.py +2695 -0
  58. sage/algebras/quantum_groups/representations.py +591 -0
  59. sage/algebras/quantum_matrix_coordinate_algebra.py +1006 -0
  60. sage/algebras/quantum_oscillator.py +623 -0
  61. sage/algebras/quaternion_algebra.py +20 -0
  62. sage/algebras/quaternion_algebra_element.py +55 -0
  63. sage/algebras/rational_cherednik_algebra.py +525 -0
  64. sage/algebras/schur_algebra.py +670 -0
  65. sage/algebras/shuffle_algebra.py +1011 -0
  66. sage/algebras/splitting_algebra.py +779 -0
  67. sage/algebras/tensor_algebra.py +709 -0
  68. sage/algebras/yangian.py +1082 -0
  69. sage/algebras/yokonuma_hecke_algebra.py +1018 -0
  70. sage/all__sagemath_combinat.py +35 -0
  71. sage/combinat/SJT.py +255 -0
  72. sage/combinat/affine_permutation.py +2405 -0
  73. sage/combinat/algebraic_combinatorics.py +55 -0
  74. sage/combinat/all.py +53 -0
  75. sage/combinat/all__sagemath_combinat.py +195 -0
  76. sage/combinat/alternating_sign_matrix.py +2063 -0
  77. sage/combinat/baxter_permutations.py +346 -0
  78. sage/combinat/bijectionist.py +3220 -0
  79. sage/combinat/binary_recurrence_sequences.py +1180 -0
  80. sage/combinat/blob_algebra.py +685 -0
  81. sage/combinat/catalog_partitions.py +27 -0
  82. sage/combinat/chas/all.py +23 -0
  83. sage/combinat/chas/fsym.py +1180 -0
  84. sage/combinat/chas/wqsym.py +2601 -0
  85. sage/combinat/cluster_complex.py +326 -0
  86. sage/combinat/colored_permutations.py +2039 -0
  87. sage/combinat/colored_permutations_representations.py +964 -0
  88. sage/combinat/composition_signed.py +142 -0
  89. sage/combinat/composition_tableau.py +855 -0
  90. sage/combinat/constellation.py +1729 -0
  91. sage/combinat/core.py +751 -0
  92. sage/combinat/counting.py +12 -0
  93. sage/combinat/crystals/affine.py +742 -0
  94. sage/combinat/crystals/affine_factorization.py +518 -0
  95. sage/combinat/crystals/affinization.py +331 -0
  96. sage/combinat/crystals/alcove_path.py +2013 -0
  97. sage/combinat/crystals/all.py +22 -0
  98. sage/combinat/crystals/bkk_crystals.py +141 -0
  99. sage/combinat/crystals/catalog.py +115 -0
  100. sage/combinat/crystals/catalog_elementary_crystals.py +18 -0
  101. sage/combinat/crystals/catalog_infinity_crystals.py +33 -0
  102. sage/combinat/crystals/catalog_kirillov_reshetikhin.py +18 -0
  103. sage/combinat/crystals/crystals.py +257 -0
  104. sage/combinat/crystals/direct_sum.py +260 -0
  105. sage/combinat/crystals/elementary_crystals.py +1251 -0
  106. sage/combinat/crystals/fast_crystals.py +441 -0
  107. sage/combinat/crystals/fully_commutative_stable_grothendieck.py +1205 -0
  108. sage/combinat/crystals/generalized_young_walls.py +1076 -0
  109. sage/combinat/crystals/highest_weight_crystals.py +436 -0
  110. sage/combinat/crystals/induced_structure.py +695 -0
  111. sage/combinat/crystals/infinity_crystals.py +730 -0
  112. sage/combinat/crystals/kac_modules.py +863 -0
  113. sage/combinat/crystals/kirillov_reshetikhin.py +4196 -0
  114. sage/combinat/crystals/kyoto_path_model.py +497 -0
  115. sage/combinat/crystals/letters.cpython-314-x86_64-linux-musl.so +0 -0
  116. sage/combinat/crystals/letters.pxd +79 -0
  117. sage/combinat/crystals/letters.pyx +3056 -0
  118. sage/combinat/crystals/littelmann_path.py +1518 -0
  119. sage/combinat/crystals/monomial_crystals.py +1262 -0
  120. sage/combinat/crystals/multisegments.py +462 -0
  121. sage/combinat/crystals/mv_polytopes.py +467 -0
  122. sage/combinat/crystals/pbw_crystal.py +511 -0
  123. sage/combinat/crystals/pbw_datum.cpython-314-x86_64-linux-musl.so +0 -0
  124. sage/combinat/crystals/pbw_datum.pxd +4 -0
  125. sage/combinat/crystals/pbw_datum.pyx +487 -0
  126. sage/combinat/crystals/polyhedral_realization.py +372 -0
  127. sage/combinat/crystals/spins.cpython-314-x86_64-linux-musl.so +0 -0
  128. sage/combinat/crystals/spins.pxd +21 -0
  129. sage/combinat/crystals/spins.pyx +756 -0
  130. sage/combinat/crystals/star_crystal.py +290 -0
  131. sage/combinat/crystals/subcrystal.py +464 -0
  132. sage/combinat/crystals/tensor_product.py +1177 -0
  133. sage/combinat/crystals/tensor_product_element.cpython-314-x86_64-linux-musl.so +0 -0
  134. sage/combinat/crystals/tensor_product_element.pxd +35 -0
  135. sage/combinat/crystals/tensor_product_element.pyx +1870 -0
  136. sage/combinat/crystals/virtual_crystal.py +420 -0
  137. sage/combinat/cyclic_sieving_phenomenon.py +204 -0
  138. sage/combinat/debruijn_sequence.cpython-314-x86_64-linux-musl.so +0 -0
  139. sage/combinat/debruijn_sequence.pyx +355 -0
  140. sage/combinat/decorated_permutation.py +270 -0
  141. sage/combinat/degree_sequences.cpython-314-x86_64-linux-musl.so +0 -0
  142. sage/combinat/degree_sequences.pyx +588 -0
  143. sage/combinat/derangements.py +527 -0
  144. sage/combinat/descent_algebra.py +1008 -0
  145. sage/combinat/diagram.py +1551 -0
  146. sage/combinat/diagram_algebras.py +5886 -0
  147. sage/combinat/dyck_word.py +4349 -0
  148. sage/combinat/e_one_star.py +1623 -0
  149. sage/combinat/enumerated_sets.py +123 -0
  150. sage/combinat/expnums.cpython-314-x86_64-linux-musl.so +0 -0
  151. sage/combinat/expnums.pyx +148 -0
  152. sage/combinat/fast_vector_partitions.cpython-314-x86_64-linux-musl.so +0 -0
  153. sage/combinat/fast_vector_partitions.pyx +346 -0
  154. sage/combinat/fqsym.py +1977 -0
  155. sage/combinat/free_dendriform_algebra.py +954 -0
  156. sage/combinat/free_prelie_algebra.py +1141 -0
  157. sage/combinat/fully_commutative_elements.py +1077 -0
  158. sage/combinat/fully_packed_loop.py +1523 -0
  159. sage/combinat/gelfand_tsetlin_patterns.py +1409 -0
  160. sage/combinat/gray_codes.py +311 -0
  161. sage/combinat/grossman_larson_algebras.py +667 -0
  162. sage/combinat/growth.py +4352 -0
  163. sage/combinat/hall_polynomial.py +188 -0
  164. sage/combinat/hillman_grassl.py +866 -0
  165. sage/combinat/integer_matrices.py +329 -0
  166. sage/combinat/integer_vectors_mod_permgroup.py +1238 -0
  167. sage/combinat/k_tableau.py +4564 -0
  168. sage/combinat/kazhdan_lusztig.py +215 -0
  169. sage/combinat/key_polynomial.py +885 -0
  170. sage/combinat/knutson_tao_puzzles.py +2286 -0
  171. sage/combinat/lr_tableau.py +311 -0
  172. sage/combinat/matrices/all.py +24 -0
  173. sage/combinat/matrices/hadamard_matrix.py +3790 -0
  174. sage/combinat/matrices/latin.py +2912 -0
  175. sage/combinat/misc.py +401 -0
  176. sage/combinat/multiset_partition_into_sets_ordered.py +3541 -0
  177. sage/combinat/ncsf_qsym/all.py +21 -0
  178. sage/combinat/ncsf_qsym/combinatorics.py +317 -0
  179. sage/combinat/ncsf_qsym/generic_basis_code.py +1427 -0
  180. sage/combinat/ncsf_qsym/ncsf.py +5637 -0
  181. sage/combinat/ncsf_qsym/qsym.py +4053 -0
  182. sage/combinat/ncsf_qsym/tutorial.py +447 -0
  183. sage/combinat/ncsym/all.py +21 -0
  184. sage/combinat/ncsym/bases.py +855 -0
  185. sage/combinat/ncsym/dual.py +593 -0
  186. sage/combinat/ncsym/ncsym.py +2076 -0
  187. sage/combinat/necklace.py +551 -0
  188. sage/combinat/non_decreasing_parking_function.py +634 -0
  189. sage/combinat/nu_dyck_word.py +1474 -0
  190. sage/combinat/output.py +861 -0
  191. sage/combinat/parallelogram_polyomino.py +4326 -0
  192. sage/combinat/parking_functions.py +1602 -0
  193. sage/combinat/partition_algebra.py +1998 -0
  194. sage/combinat/partition_kleshchev.py +1982 -0
  195. sage/combinat/partition_shifting_algebras.py +584 -0
  196. sage/combinat/partition_tuple.py +3114 -0
  197. sage/combinat/path_tableaux/all.py +13 -0
  198. sage/combinat/path_tableaux/catalog.py +29 -0
  199. sage/combinat/path_tableaux/dyck_path.py +380 -0
  200. sage/combinat/path_tableaux/frieze.py +476 -0
  201. sage/combinat/path_tableaux/path_tableau.py +728 -0
  202. sage/combinat/path_tableaux/semistandard.py +510 -0
  203. sage/combinat/perfect_matching.py +779 -0
  204. sage/combinat/plane_partition.py +3300 -0
  205. sage/combinat/q_bernoulli.cpython-314-x86_64-linux-musl.so +0 -0
  206. sage/combinat/q_bernoulli.pyx +128 -0
  207. sage/combinat/quickref.py +81 -0
  208. sage/combinat/recognizable_series.py +2051 -0
  209. sage/combinat/regular_sequence.py +4316 -0
  210. sage/combinat/regular_sequence_bounded.py +543 -0
  211. sage/combinat/restricted_growth.py +81 -0
  212. sage/combinat/ribbon.py +20 -0
  213. sage/combinat/ribbon_shaped_tableau.py +489 -0
  214. sage/combinat/ribbon_tableau.py +1180 -0
  215. sage/combinat/rigged_configurations/all.py +46 -0
  216. sage/combinat/rigged_configurations/bij_abstract_class.py +548 -0
  217. sage/combinat/rigged_configurations/bij_infinity.py +370 -0
  218. sage/combinat/rigged_configurations/bij_type_A.py +163 -0
  219. sage/combinat/rigged_configurations/bij_type_A2_dual.py +338 -0
  220. sage/combinat/rigged_configurations/bij_type_A2_even.py +218 -0
  221. sage/combinat/rigged_configurations/bij_type_A2_odd.py +199 -0
  222. sage/combinat/rigged_configurations/bij_type_B.py +900 -0
  223. sage/combinat/rigged_configurations/bij_type_C.py +267 -0
  224. sage/combinat/rigged_configurations/bij_type_D.py +771 -0
  225. sage/combinat/rigged_configurations/bij_type_D_tri.py +392 -0
  226. sage/combinat/rigged_configurations/bij_type_D_twisted.py +576 -0
  227. sage/combinat/rigged_configurations/bij_type_E67.py +402 -0
  228. sage/combinat/rigged_configurations/bijection.py +143 -0
  229. sage/combinat/rigged_configurations/kleber_tree.py +1475 -0
  230. sage/combinat/rigged_configurations/kr_tableaux.py +1898 -0
  231. sage/combinat/rigged_configurations/rc_crystal.py +461 -0
  232. sage/combinat/rigged_configurations/rc_infinity.py +540 -0
  233. sage/combinat/rigged_configurations/rigged_configuration_element.py +2403 -0
  234. sage/combinat/rigged_configurations/rigged_configurations.py +1918 -0
  235. sage/combinat/rigged_configurations/rigged_partition.cpython-314-x86_64-linux-musl.so +0 -0
  236. sage/combinat/rigged_configurations/rigged_partition.pxd +15 -0
  237. sage/combinat/rigged_configurations/rigged_partition.pyx +680 -0
  238. sage/combinat/rigged_configurations/tensor_product_kr_tableaux.py +499 -0
  239. sage/combinat/rigged_configurations/tensor_product_kr_tableaux_element.py +428 -0
  240. sage/combinat/rsk.py +3438 -0
  241. sage/combinat/schubert_polynomial.py +508 -0
  242. sage/combinat/set_partition.py +3318 -0
  243. sage/combinat/set_partition_iterator.cpython-314-x86_64-linux-musl.so +0 -0
  244. sage/combinat/set_partition_iterator.pyx +136 -0
  245. sage/combinat/set_partition_ordered.py +1590 -0
  246. sage/combinat/sf/abreu_nigro.py +346 -0
  247. sage/combinat/sf/all.py +52 -0
  248. sage/combinat/sf/character.py +576 -0
  249. sage/combinat/sf/classical.py +319 -0
  250. sage/combinat/sf/dual.py +996 -0
  251. sage/combinat/sf/elementary.py +549 -0
  252. sage/combinat/sf/hall_littlewood.py +1028 -0
  253. sage/combinat/sf/hecke.py +336 -0
  254. sage/combinat/sf/homogeneous.py +464 -0
  255. sage/combinat/sf/jack.py +1428 -0
  256. sage/combinat/sf/k_dual.py +1458 -0
  257. sage/combinat/sf/kfpoly.py +447 -0
  258. sage/combinat/sf/llt.py +789 -0
  259. sage/combinat/sf/macdonald.py +2019 -0
  260. sage/combinat/sf/monomial.py +525 -0
  261. sage/combinat/sf/multiplicative.py +113 -0
  262. sage/combinat/sf/new_kschur.py +1786 -0
  263. sage/combinat/sf/ns_macdonald.py +964 -0
  264. sage/combinat/sf/orthogonal.py +246 -0
  265. sage/combinat/sf/orthotriang.py +355 -0
  266. sage/combinat/sf/powersum.py +963 -0
  267. sage/combinat/sf/schur.py +880 -0
  268. sage/combinat/sf/sf.py +1653 -0
  269. sage/combinat/sf/sfa.py +7053 -0
  270. sage/combinat/sf/symplectic.py +253 -0
  271. sage/combinat/sf/witt.py +721 -0
  272. sage/combinat/shifted_primed_tableau.py +2735 -0
  273. sage/combinat/shuffle.py +830 -0
  274. sage/combinat/sidon_sets.py +146 -0
  275. sage/combinat/similarity_class_type.py +1721 -0
  276. sage/combinat/sine_gordon.py +618 -0
  277. sage/combinat/six_vertex_model.py +784 -0
  278. sage/combinat/skew_partition.py +2053 -0
  279. sage/combinat/skew_tableau.py +2989 -0
  280. sage/combinat/sloane_functions.py +8935 -0
  281. sage/combinat/specht_module.py +1403 -0
  282. sage/combinat/species/all.py +48 -0
  283. sage/combinat/species/characteristic_species.py +321 -0
  284. sage/combinat/species/composition_species.py +273 -0
  285. sage/combinat/species/cycle_species.py +284 -0
  286. sage/combinat/species/empty_species.py +155 -0
  287. sage/combinat/species/functorial_composition_species.py +148 -0
  288. sage/combinat/species/generating_series.py +673 -0
  289. sage/combinat/species/library.py +148 -0
  290. sage/combinat/species/linear_order_species.py +169 -0
  291. sage/combinat/species/misc.py +83 -0
  292. sage/combinat/species/partition_species.py +290 -0
  293. sage/combinat/species/permutation_species.py +268 -0
  294. sage/combinat/species/product_species.py +423 -0
  295. sage/combinat/species/recursive_species.py +476 -0
  296. sage/combinat/species/set_species.py +192 -0
  297. sage/combinat/species/species.py +820 -0
  298. sage/combinat/species/structure.py +539 -0
  299. sage/combinat/species/subset_species.py +243 -0
  300. sage/combinat/species/sum_species.py +225 -0
  301. sage/combinat/subword.py +564 -0
  302. sage/combinat/subword_complex.py +2122 -0
  303. sage/combinat/subword_complex_c.cpython-314-x86_64-linux-musl.so +0 -0
  304. sage/combinat/subword_complex_c.pyx +119 -0
  305. sage/combinat/super_tableau.py +821 -0
  306. sage/combinat/superpartition.py +1154 -0
  307. sage/combinat/symmetric_group_algebra.py +3774 -0
  308. sage/combinat/symmetric_group_representations.py +1830 -0
  309. sage/combinat/t_sequences.py +877 -0
  310. sage/combinat/tableau.py +9506 -0
  311. sage/combinat/tableau_residues.py +860 -0
  312. sage/combinat/tableau_tuple.py +5353 -0
  313. sage/combinat/tiling.py +2432 -0
  314. sage/combinat/triangles_FHM.py +777 -0
  315. sage/combinat/tutorial.py +1857 -0
  316. sage/combinat/vector_partition.py +337 -0
  317. sage/combinat/words/abstract_word.py +1722 -0
  318. sage/combinat/words/all.py +59 -0
  319. sage/combinat/words/alphabet.py +268 -0
  320. sage/combinat/words/finite_word.py +7201 -0
  321. sage/combinat/words/infinite_word.py +113 -0
  322. sage/combinat/words/lyndon_word.py +652 -0
  323. sage/combinat/words/morphic.py +351 -0
  324. sage/combinat/words/morphism.py +3878 -0
  325. sage/combinat/words/paths.py +2932 -0
  326. sage/combinat/words/shuffle_product.py +278 -0
  327. sage/combinat/words/suffix_trees.py +1873 -0
  328. sage/combinat/words/word.py +769 -0
  329. sage/combinat/words/word_char.cpython-314-x86_64-linux-musl.so +0 -0
  330. sage/combinat/words/word_char.pyx +847 -0
  331. sage/combinat/words/word_datatypes.cpython-314-x86_64-linux-musl.so +0 -0
  332. sage/combinat/words/word_datatypes.pxd +4 -0
  333. sage/combinat/words/word_datatypes.pyx +1067 -0
  334. sage/combinat/words/word_generators.py +2026 -0
  335. sage/combinat/words/word_infinite_datatypes.py +1218 -0
  336. sage/combinat/words/word_options.py +99 -0
  337. sage/combinat/words/words.py +2396 -0
  338. sage/data_structures/all__sagemath_combinat.py +1 -0
  339. sage/databases/all__sagemath_combinat.py +13 -0
  340. sage/databases/findstat.py +4897 -0
  341. sage/databases/oeis.py +2058 -0
  342. sage/databases/sloane.py +393 -0
  343. sage/dynamics/all__sagemath_combinat.py +14 -0
  344. sage/dynamics/cellular_automata/all.py +7 -0
  345. sage/dynamics/cellular_automata/catalog.py +34 -0
  346. sage/dynamics/cellular_automata/elementary.py +612 -0
  347. sage/dynamics/cellular_automata/glca.py +477 -0
  348. sage/dynamics/cellular_automata/solitons.py +1463 -0
  349. sage/dynamics/finite_dynamical_system.py +1249 -0
  350. sage/dynamics/finite_dynamical_system_catalog.py +382 -0
  351. sage/games/all.py +7 -0
  352. sage/games/hexad.py +704 -0
  353. sage/games/quantumino.py +591 -0
  354. sage/games/sudoku.py +889 -0
  355. sage/games/sudoku_backtrack.cpython-314-x86_64-linux-musl.so +0 -0
  356. sage/games/sudoku_backtrack.pyx +189 -0
  357. sage/groups/all__sagemath_combinat.py +1 -0
  358. sage/groups/indexed_free_group.py +489 -0
  359. sage/libs/all__sagemath_combinat.py +6 -0
  360. sage/libs/lrcalc/__init__.py +1 -0
  361. sage/libs/lrcalc/lrcalc.py +525 -0
  362. sage/libs/symmetrica/__init__.py +7 -0
  363. sage/libs/symmetrica/all.py +101 -0
  364. sage/libs/symmetrica/kostka.pxi +168 -0
  365. sage/libs/symmetrica/part.pxi +193 -0
  366. sage/libs/symmetrica/plet.pxi +42 -0
  367. sage/libs/symmetrica/sab.pxi +196 -0
  368. sage/libs/symmetrica/sb.pxi +332 -0
  369. sage/libs/symmetrica/sc.pxi +192 -0
  370. sage/libs/symmetrica/schur.pxi +956 -0
  371. sage/libs/symmetrica/symmetrica.cpython-314-x86_64-linux-musl.so +0 -0
  372. sage/libs/symmetrica/symmetrica.pxi +1172 -0
  373. sage/libs/symmetrica/symmetrica.pyx +39 -0
  374. sage/monoids/all.py +13 -0
  375. sage/monoids/automatic_semigroup.py +1054 -0
  376. sage/monoids/free_abelian_monoid.py +315 -0
  377. sage/monoids/free_abelian_monoid_element.cpython-314-x86_64-linux-musl.so +0 -0
  378. sage/monoids/free_abelian_monoid_element.pxd +16 -0
  379. sage/monoids/free_abelian_monoid_element.pyx +397 -0
  380. sage/monoids/free_monoid.py +335 -0
  381. sage/monoids/free_monoid_element.py +431 -0
  382. sage/monoids/hecke_monoid.py +65 -0
  383. sage/monoids/string_monoid.py +817 -0
  384. sage/monoids/string_monoid_element.py +547 -0
  385. sage/monoids/string_ops.py +143 -0
  386. sage/monoids/trace_monoid.py +972 -0
  387. sage/rings/all__sagemath_combinat.py +2 -0
  388. sage/sat/all.py +4 -0
  389. sage/sat/boolean_polynomials.py +405 -0
  390. sage/sat/converters/__init__.py +6 -0
  391. sage/sat/converters/anf2cnf.py +14 -0
  392. sage/sat/converters/polybori.py +611 -0
  393. sage/sat/solvers/__init__.py +5 -0
  394. sage/sat/solvers/cryptominisat.py +287 -0
  395. sage/sat/solvers/dimacs.py +783 -0
  396. sage/sat/solvers/picosat.py +228 -0
  397. sage/sat/solvers/sat_lp.py +156 -0
  398. sage/sat/solvers/satsolver.cpython-314-x86_64-linux-musl.so +0 -0
  399. sage/sat/solvers/satsolver.pxd +3 -0
  400. sage/sat/solvers/satsolver.pyx +405 -0
@@ -0,0 +1,1898 @@
1
+ # sage_setup: distribution = sagemath-combinat
2
+ # sage.doctest: needs sage.combinat sage.graphs sage.modules
3
+ r"""
4
+ Kirillov-Reshetikhin tableaux
5
+
6
+ Kirillov-Reshetikhin tableaux are rectangular tableaux with `r` rows and
7
+ `s` columns that naturally arise under the bijection between rigged
8
+ configurations and tableaux [RigConBijection]_. They are in bijection with
9
+ the elements of the Kirillov-Reshetikhin crystal `B^{r,s}` under the (inverse)
10
+ filling map [OSS13]_ [SS2015]_. They do not have to satisfy the semistandard row or column
11
+ restrictions. These tensor products are the result from the bijection from
12
+ rigged configurations [RigConBijection]_.
13
+
14
+ For more information, see :class:`~sage.combinat.rigged_configurations.kr_tableaux.KirillovReshetikhinTableaux`
15
+ and :class:`~sage.combinat.rigged_configurations.tensor_product_kr_tableaux.TensorProductOfKirillovReshetikhinTableaux`.
16
+
17
+ REFERENCES:
18
+
19
+ .. [OSS13] Masato Okado, Reiho Sakamoto, and Anne Schilling.
20
+ *Affine crystal structure on rigged configurations of type* `D_n^{(1)}`.
21
+ J. Algebraic Combinatorics, **37** (2013). 571-599. :arxiv:`1109.3523`.
22
+
23
+ AUTHORS:
24
+
25
+ - Travis Scrimshaw (2012-01-03): initial version
26
+ - Travis Scrimshaw (2012-11-14): added bijection to KR crystals
27
+ """
28
+
29
+ # ***************************************************************************
30
+ # Copyright (C) 2012 Travis Scrimshaw <tscrim@ucdavis.edu>
31
+ #
32
+ # Distributed under the terms of the GNU General Public License (GPL)
33
+ #
34
+ # This code is distributed in the hope that it will be useful,
35
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
36
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
37
+ # General Public License for more details.
38
+ #
39
+ # The full text of the GPL is available at:
40
+ #
41
+ # https://www.gnu.org/licenses/
42
+ # ***************************************************************************
43
+
44
+ # This contains both the parent and element classes. These should be split if
45
+ # the classes grow larger.
46
+
47
+ from sage.misc.cachefunc import cached_method
48
+ from sage.misc.abstract_method import abstract_method
49
+ from sage.misc.lazy_attribute import lazy_attribute
50
+ from sage.misc.flatten import flatten
51
+
52
+ from sage.structure.parent import Parent
53
+
54
+ from sage.categories.loop_crystals import KirillovReshetikhinCrystals
55
+
56
+ from sage.combinat.crystals.letters import CrystalOfLetters, EmptyLetter
57
+ from sage.combinat.root_system.cartan_type import CartanType
58
+ from sage.combinat.crystals.tensor_product import CrystalOfWords
59
+ from sage.combinat.crystals.tensor_product import TensorProductOfRegularCrystalsElement
60
+ from sage.combinat.crystals.kirillov_reshetikhin import (
61
+ horizontal_dominoes_removed,
62
+ KashiwaraNakashimaTableaux, KirillovReshetikhinGenericCrystalElement,
63
+ partitions_in_box, vertical_dominoes_removed
64
+ )
65
+ from sage.combinat.partition import Partition
66
+ from sage.combinat.tableau import Tableau
67
+
68
+
69
+ class KirillovReshetikhinTableaux(CrystalOfWords):
70
+ r"""
71
+ Kirillov-Reshetikhin tableaux.
72
+
73
+ Kirillov-Reshetikhin tableaux are rectangular tableaux with `r` rows and
74
+ `s` columns that naturally arise under the bijection between rigged
75
+ configurations and tableaux [RigConBijection]_. They are in bijection with
76
+ the elements of the Kirillov-Reshetikhin crystal `B^{r,s}` under the
77
+ (inverse) filling map.
78
+
79
+ Whenever `B^{r,s} \cong B(s\Lambda_r)` as a classical crystal (which is
80
+ the case for `B^{r,s}` in type `A_n^{(1)}`, `B^{n,s}` in type `C_n^{(1)}`
81
+ and `D_{n+1}^{(2)}`, `B^{n,s}` and `B^{n-1,s}` in type `D_n^{(1)}`) then
82
+ the filling map is trivial.
83
+
84
+ For `B^{r,s}` in:
85
+
86
+ - type `D_n^{(1)}` when `r \leq n-2`,
87
+ - type `B_n^{(1)}` when `r < n`,
88
+ - type `A_{2n-1}^{(2)}` for all `r`,
89
+
90
+ the filling map is defined in [OSS2011]_.
91
+
92
+ For the spinor cases in type `D_n^{(1)}`, the crystal `B^{k,s}` where
93
+ `k = n-1, n`, is isomorphic as a classical crystal to `B(s\Lambda_k)`,
94
+ and here we consider the Kirillov-Reshetikhin tableaux as living in
95
+ `B(2s \Lambda_k)` under the natural doubling map. In this case, the
96
+ crystal operators `e_i` and `f_i` act as `e_i^2` and `f_i^2` respectively.
97
+ See [BijectionDn]_.
98
+
99
+ For the spinor case in type `B_n^{(1)}`, the crystal `B^{n,s}`, we
100
+ consider the images under the natural doubling map into `B^{n,2s}`.
101
+ The classical components of this crystal are now given by
102
+ removing `2 \times 2` boxes. The filling map is the same as below
103
+ (see the non-spin type `C_n^{(1)}`).
104
+
105
+ For `B^{r,s}` in:
106
+
107
+ - type `C_n^{(1)}` when `r < n`,
108
+ - type `A_{2n}^{(2)\dagger}` for all `r`,
109
+
110
+ the filling map is given as follows. Suppose we are considering the
111
+ (classically) highest weight element in the classical component
112
+ `B(\lambda)`. Then we fill it in with the horizontal dominoes
113
+ `[\bar{\imath}, i]` in the `i`-th row from the top (in English notation)
114
+ and reordering the columns so that they are increasing. Recall from above
115
+ that `B^{n,s} \cong B(s\Lambda_n)` in type `C^{(1)}_n`.
116
+
117
+ For `B^{r,s}` in:
118
+
119
+ - type `A_{2n}^{(2)}` for all `r`,
120
+ - type `D_{n+1}^{(2)}` when `r < n`,
121
+ - type `D_4^{(3)}` when `r = 1`,
122
+
123
+ the filling map is the same as given in [OSS2011]_ except for
124
+ the rightmost column which is given by the column `[1, 2, \ldots, k,
125
+ \emptyset, \ldots \emptyset]` where `k = (r+x-1)/2` in Step 3 of
126
+ [OSS2011]_.
127
+
128
+ For the spinor case in type `D_{n+1}^{(2)}`, the crystal `B^{n,s}`, we
129
+ define the filling map in the same way as in type `D_n^{(1)}`.
130
+
131
+ .. NOTE::
132
+
133
+ The filling map and classical decompositions in non-spinor cases can
134
+ be classified by how the special node `0` connects with the
135
+ corresponding classical diagram.
136
+
137
+ The classical crystal structure is given by the usual Kashiwara-Nakashima
138
+ tableaux rules. That is to embed this into `B(\Lambda_1)^{\otimes n s}`
139
+ by using the reading word and then applying the classical crystal
140
+ operator. The affine crystal structure is given by converting to
141
+ the corresponding KR crystal element, performing the affine crystal
142
+ operator, and pulling back to a KR tableau.
143
+
144
+ For more information about the bijection between rigged configurations
145
+ and tensor products of Kirillov-Reshetikhin tableaux, see
146
+ :class:`~sage.combinat.rigged_configurations.tensor_product_kr_tableaux.TensorProductOfKirillovReshetikhinTableaux`.
147
+
148
+ .. NOTE::
149
+
150
+ The tableaux for all non-simply-laced types are provably correct if the
151
+ bijection with :class:`rigged configurations
152
+ <sage.combinat.rigged_configurations.rigged_configurations.RiggedConfigurations>`
153
+ holds. Therefore this is currently only proven for `B^{r,1}` or
154
+ `B^{1,s}` and in general for types `A_n^{(1)}` and `D_n^{(1)}`.
155
+
156
+ INPUT:
157
+
158
+ - ``cartan_type`` -- the Cartan type
159
+
160
+ - ``r`` -- the Dynkin diagram index (typically the number of rows)
161
+
162
+ - ``s`` -- the number of columns
163
+
164
+ EXAMPLES::
165
+
166
+ sage: KRT = crystals.KirillovReshetikhin(['A', 4, 1], 2, 1, model='KR')
167
+ sage: elt = KRT(4, 3); elt
168
+ [[3], [4]]
169
+
170
+ sage: KRT = crystals.KirillovReshetikhin(['D', 4, 1], 2, 1, model='KR')
171
+ sage: elt = KRT(-1, 1); elt
172
+ [[1], [-1]]
173
+
174
+ We can create highest weight crystals from a given shape or weight::
175
+
176
+ sage: KRT = crystals.KirillovReshetikhin(['D', 4, 1], 2, 2, model='KR')
177
+ sage: KRT.module_generator(shape=[1,1])
178
+ [[1, 1], [2, -1]]
179
+ sage: KRT.module_generator(column_shape=[2])
180
+ [[1, 1], [2, -1]]
181
+ sage: WS = RootSystem(['D',4,1]).weight_space()
182
+ sage: KRT.module_generator(weight=WS.sum_of_terms([[0,-2],[2,1]]))
183
+ [[1, 1], [2, -1]]
184
+ sage: WSC = RootSystem(['D',4]).weight_space()
185
+ sage: KRT.module_generator(classical_weight=WSC.fundamental_weight(2))
186
+ [[1, 1], [2, -1]]
187
+
188
+ We can go between
189
+ :func:`~sage.combinat.crystals.kirillov_reshetikhin.KashiwaraNakashimaTableaux`
190
+ and
191
+ :class:`~sage.combinat.rigged_configurations.kr_tableaux.KirillovReshetikhinTableaux`
192
+ elements::
193
+
194
+ sage: KRCrys = crystals.KirillovReshetikhin(['D', 4, 1], 2, 2, model='KN')
195
+ sage: KRTab = crystals.KirillovReshetikhin(['D', 4, 1], 2, 2, model='KR')
196
+ sage: elt = KRCrys(3, 2); elt
197
+ [[2], [3]]
198
+ sage: k = KRTab(elt); k
199
+ [[2, 1], [3, -1]]
200
+ sage: KRCrys(k)
201
+ [[2], [3]]
202
+
203
+ We check that the classical weights in the classical decompositions
204
+ agree in a few different type::
205
+
206
+ sage: KRCrys = crystals.KirillovReshetikhin(['D', 4, 1], 2, 2, model='KN')
207
+ sage: KRTab = crystals.KirillovReshetikhin(['D', 4, 1], 2, 2, model='KR')
208
+ sage: all(t.classical_weight() == KRCrys(t).classical_weight() for t in KRTab)
209
+ True
210
+ sage: KRCrys = crystals.KirillovReshetikhin(['B', 3, 1], 2, 2, model='KN')
211
+ sage: KRTab = crystals.KirillovReshetikhin(['B', 3, 1], 2, 2, model='KR')
212
+ sage: all(t.classical_weight() == KRCrys(t).classical_weight() for t in KRTab)
213
+ True
214
+ sage: KRCrys = crystals.KirillovReshetikhin(['C', 3, 1], 2, 2, model='KN')
215
+ sage: KRTab = crystals.KirillovReshetikhin(['C', 3, 1], 2, 2, model='KR')
216
+ sage: all(t.classical_weight() == KRCrys(t).classical_weight() for t in KRTab)
217
+ True
218
+ sage: KRCrys = crystals.KirillovReshetikhin(['D', 4, 2], 2, 2, model='KN')
219
+ sage: KRTab = crystals.KirillovReshetikhin(['D', 4, 2], 2, 2, model='KR')
220
+ sage: all(t.classical_weight() == KRCrys(t).classical_weight() for t in KRTab)
221
+ True
222
+ sage: KRCrys = crystals.KirillovReshetikhin(['A', 4, 2], 2, 2, model='KN')
223
+ sage: KRTab = crystals.KirillovReshetikhin(['A', 4, 2], 2, 2, model='KR')
224
+ sage: all(t.classical_weight() == KRCrys(t).classical_weight() for t in KRTab)
225
+ True
226
+ """
227
+ @staticmethod
228
+ def __classcall_private__(cls, cartan_type, r, s):
229
+ """
230
+ Normalize the input arguments to ensure unique representation.
231
+
232
+ EXAMPLES::
233
+
234
+ sage: KRT1 = crystals.KirillovReshetikhin(CartanType(['A',3,1]), 2, 3, model='KR')
235
+ sage: KRT2 = crystals.KirillovReshetikhin(['A',3,1], 2, 3, model='KR')
236
+ sage: KRT1 is KRT2
237
+ True
238
+ """
239
+ ct = CartanType(cartan_type)
240
+ if not ct.is_affine():
241
+ raise ValueError("The Cartan type must be affine")
242
+
243
+ typ = ct.type()
244
+ if ct.is_untwisted_affine():
245
+ if typ == 'A':
246
+ return KRTableauxRectangle(ct, r, s)
247
+ if typ == 'B':
248
+ if r == ct.classical().rank():
249
+ return KRTableauxBn(ct, r, s)
250
+ return KRTableauxTypeVertical(ct, r, s)
251
+ if typ == 'C':
252
+ if r == ct.classical().rank():
253
+ return KRTableauxRectangle(ct, r, s)
254
+ return KRTableauxTypeHorizonal(ct, r, s)
255
+ if typ == 'D':
256
+ if r == ct.classical().rank() or r == ct.classical().rank() - 1:
257
+ return KRTableauxSpin(ct, r, s)
258
+ return KRTableauxTypeVertical(ct, r, s)
259
+ if typ == 'E':
260
+ return KRTableauxTypeFromRC(ct, r, s)
261
+ else:
262
+ if typ == 'BC': # A_{2n}^{(2)}
263
+ return KRTableauxTypeBox(ct, r, s)
264
+ typ = ct.dual().type()
265
+ if typ == 'BC': # A_{2n}^{(2)\dagger}
266
+ return KRTableauxTypeHorizonal(ct, r, s)
267
+ if typ == 'B': # A_{2n-1}^{(2)}
268
+ return KRTableauxTypeVertical(ct, r, s)
269
+ if typ == 'C': # D_{n+1}^{(2)}
270
+ if r == ct.dual().classical().rank():
271
+ return KRTableauxDTwistedSpin(ct, r, s)
272
+ return KRTableauxTypeBox(ct, r, s)
273
+ # if typ == 'F': # E_6^{(2)}
274
+ if typ == 'G': # D_4^{(3)}
275
+ if r == 1:
276
+ return KRTableauxTypeBox(ct, r, s)
277
+ return KRTableauxTypeFromRC(ct, r, s)
278
+
279
+ raise NotImplementedError
280
+ # return super(KirillovReshetikhinTableaux, cls).__classcall__(cls, ct, r, s)
281
+
282
+ def __init__(self, cartan_type, r, s):
283
+ r"""
284
+ Initialize ``self``.
285
+
286
+ EXAMPLES::
287
+
288
+ sage: KRT = crystals.KirillovReshetikhin(['A', 4, 1], 2, 2, model='KR')
289
+ sage: TestSuite(KRT).run()
290
+ sage: KRT = crystals.KirillovReshetikhin(['D', 4, 1], 2, 2, model='KR')
291
+ sage: TestSuite(KRT).run() # long time
292
+ sage: KRT = crystals.KirillovReshetikhin(['D', 4, 1], 4, 1, model='KR'); KRT
293
+ Kirillov-Reshetikhin tableaux of type ['D', 4, 1] and shape (4, 1)
294
+ sage: TestSuite(KRT).run()
295
+ """
296
+ self._r = r
297
+ self._s = s
298
+ self._cartan_type = cartan_type
299
+
300
+ Parent.__init__(self, category=KirillovReshetikhinCrystals())
301
+
302
+ self.letters = CrystalOfLetters(cartan_type.classical())
303
+ self.module_generators = self._build_module_generators()
304
+
305
+ def _repr_(self):
306
+ """
307
+ Return a string representation of ``self``.
308
+
309
+ EXAMPLES::
310
+
311
+ sage: crystals.KirillovReshetikhin(['A', 4, 1], 2, 3, model='KR')
312
+ Kirillov-Reshetikhin tableaux of type ['A', 4, 1] and shape (2, 3)
313
+ """
314
+ return "Kirillov-Reshetikhin tableaux of type {} and shape ({}, {})".format(
315
+ self._cartan_type, self._r, self._s)
316
+
317
+ def __iter__(self):
318
+ """
319
+ Return the iterator of ``self``.
320
+
321
+ EXAMPLES::
322
+
323
+ sage: KR = crystals.KirillovReshetikhin(['A', 5, 2], 2, 1, model='KR')
324
+ sage: L = [x for x in KR]
325
+ sage: len(L)
326
+ 15
327
+ """
328
+ index_set = self._cartan_type.classical().index_set()
329
+ from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet
330
+ rset = RecursivelyEnumeratedSet(self.module_generators,
331
+ lambda x: [x.f(i) for i in index_set],
332
+ structure='graded')
333
+ return rset.breadth_first_search_iterator()
334
+
335
+ def module_generator(self, i=None, **options):
336
+ r"""
337
+ Return the specified module generator.
338
+
339
+ INPUT:
340
+
341
+ - ``i`` -- the index of the module generator
342
+
343
+ We can also get a module generator by using one of the following
344
+ optional arguments:
345
+
346
+ - ``shape`` -- the associated shape
347
+ - ``column_shape`` -- the shape given as columns (a column of length
348
+ `k` correspond to a classical weight `\omega_k`)
349
+ - ``weight`` -- the weight
350
+ - ``classical_weight`` -- the classical weight
351
+
352
+ If no arguments are specified, then return the unique module generator
353
+ of classical weight `s \Lambda_r`.
354
+
355
+ EXAMPLES::
356
+
357
+ sage: KRT = crystals.KirillovReshetikhin(['D', 4, 1], 2, 2, model='KR')
358
+ sage: KRT.module_generator(1)
359
+ [[1, 1], [2, -1]]
360
+ sage: KRT.module_generator(shape=[1,1])
361
+ [[1, 1], [2, -1]]
362
+ sage: KRT.module_generator(column_shape=[2])
363
+ [[1, 1], [2, -1]]
364
+ sage: WS = RootSystem(['D',4,1]).weight_space()
365
+ sage: KRT.module_generator(weight=WS.sum_of_terms([[0,-2],[2,1]]))
366
+ [[1, 1], [2, -1]]
367
+ sage: WSC = RootSystem(['D',4]).weight_space()
368
+ sage: KRT.module_generator(classical_weight=WSC.fundamental_weight(2))
369
+ [[1, 1], [2, -1]]
370
+ sage: KRT.module_generator()
371
+ [[1, 1], [2, 2]]
372
+
373
+ sage: KRT = crystals.KirillovReshetikhin(['A', 3, 1], 2, 2, model='KR')
374
+ sage: KRT.module_generator()
375
+ [[1, 1], [2, 2]]
376
+ """
377
+ if i is not None:
378
+ return self.module_generators[i]
379
+ n = self._cartan_type.classical().rank()
380
+
381
+ if "shape" in options:
382
+ shape = list(options["shape"])
383
+ # Make sure the shape is the correct length
384
+ if len(shape) < n:
385
+ shape.extend([0] * (n - len(shape)))
386
+ for mg in self.module_generators:
387
+ if list(mg.classical_weight().to_vector()) == shape:
388
+ return mg
389
+ return None
390
+
391
+ if "column_shape" in options:
392
+ shape = list(Partition(options["column_shape"]).conjugate())
393
+ if len(shape) < n:
394
+ shape.extend([0] * (n - len(shape)))
395
+ for mg in self.module_generators:
396
+ if list(mg.classical_weight().to_vector()) == shape:
397
+ return mg
398
+ return None
399
+
400
+ if "weight" in options:
401
+ wt = options["weight"]
402
+ for mg in self.module_generators:
403
+ if mg.weight() == wt:
404
+ return mg
405
+ return None
406
+
407
+ if "classical_weight" in options:
408
+ wt = options["classical_weight"]
409
+ for mg in self.module_generators:
410
+ if mg.classical_weight() == wt:
411
+ return mg
412
+ return None
413
+
414
+ # Otherwise return the unique module generator of classical weight `s \Lambda_r`
415
+ R = self.weight_lattice_realization()
416
+ Lambda = R.fundamental_weights()
417
+ r = self.r()
418
+ s = self.s()
419
+ weight = s * Lambda[r] - s * Lambda[0] * Lambda[r].level() / Lambda[0].level()
420
+ for b in self.module_generators:
421
+ if b.weight() == weight:
422
+ return b
423
+ assert False
424
+
425
+ @abstract_method
426
+ def _build_module_generators(self):
427
+ """
428
+ Build the module generators.
429
+
430
+ EXAMPLES::
431
+
432
+ sage: KRT = crystals.KirillovReshetikhin(['A', 4, 1], 2, 3, model='KR')
433
+ sage: KRT._build_module_generators()
434
+ ([[1, 1, 1], [2, 2, 2]],)
435
+ """
436
+
437
+ @abstract_method(optional=True)
438
+ def from_kirillov_reshetikhin_crystal(self, krc):
439
+ """
440
+ Construct an element of ``self`` from the Kirillov-Reshetikhin
441
+ crystal element ``krc``.
442
+
443
+ EXAMPLES::
444
+
445
+ sage: KRT = crystals.KirillovReshetikhin(['A', 4, 1], 2, 1, model='KR')
446
+ sage: C = crystals.KirillovReshetikhin(['A',4,1], 2, 1, model='KN')
447
+ sage: krc = C(4,3); krc
448
+ [[3], [4]]
449
+ sage: KRT.from_kirillov_reshetikhin_crystal(krc)
450
+ [[3], [4]]
451
+ """
452
+
453
+ def _element_constructor_(self, *lst, **options):
454
+ """
455
+ Construct a
456
+ :class:`~sage.combinat.rigged_configurations.kr_tableaux.KirillovReshetikhinTableauxElement`.
457
+
458
+ EXAMPLES::
459
+
460
+ sage: KRT = crystals.KirillovReshetikhin(['A', 4, 1], 2, 1, model='KR')
461
+ sage: KRT(3, 4) # indirect doctest
462
+ [[4], [3]]
463
+ sage: KRT(4, 3)
464
+ [[3], [4]]
465
+ """
466
+ if isinstance(lst[0], KirillovReshetikhinGenericCrystalElement):
467
+ # Check to make sure it can be converted
468
+ if lst[0].cartan_type() != self.cartan_type() \
469
+ or lst[0].parent().r() != self._r or lst[0].parent().s() != self._s:
470
+ raise ValueError("the Kirillov-Reshetikhin crystal must have the same Cartan type and (r,s)")
471
+ return self.from_kirillov_reshetikhin_crystal(lst[0])
472
+
473
+ return self.element_class(self, list(lst), **options)
474
+
475
+ def r(self):
476
+ """
477
+ Return the value `r` for this tableaux class which corresponds to the
478
+ number of rows.
479
+
480
+ EXAMPLES::
481
+
482
+ sage: KRT = crystals.KirillovReshetikhin(['A', 4, 1], 2, 1, model='KR')
483
+ sage: KRT.r()
484
+ 2
485
+ """
486
+ return self._r
487
+
488
+ def s(self):
489
+ """
490
+ Return the value `s` for this tableaux class which corresponds to the
491
+ number of columns.
492
+
493
+ EXAMPLES::
494
+
495
+ sage: KRT = crystals.KirillovReshetikhin(['A', 4, 1], 2, 1, model='KR')
496
+ sage: KRT.s()
497
+ 1
498
+ """
499
+ return self._s
500
+
501
+ @cached_method
502
+ def kirillov_reshetikhin_crystal(self):
503
+ """
504
+ Return the corresponding KR crystal in the
505
+ :func:`Kashiwara-Nakashima model
506
+ <sage.combinat.crystals.kirillov_reshetikhin.KashiwaraNakashimaTableaux>`.
507
+
508
+ EXAMPLES::
509
+
510
+ sage: crystals.KirillovReshetikhin(['A', 4, 1], 2, 1, model='KR').kirillov_reshetikhin_crystal()
511
+ Kirillov-Reshetikhin crystal of type ['A', 4, 1] with (r,s)=(2,1)
512
+ """
513
+ return KashiwaraNakashimaTableaux(self._cartan_type, self._r, self._s)
514
+
515
+ def classical_decomposition(self):
516
+ """
517
+ Return the classical crystal decomposition of ``self``.
518
+
519
+ EXAMPLES::
520
+
521
+ sage: crystals.KirillovReshetikhin(['D', 4, 1], 2, 2, model='KR').classical_decomposition()
522
+ The crystal of tableaux of type ['D', 4] and shape(s) [[], [1, 1], [2, 2]]
523
+ """
524
+ return self.kirillov_reshetikhin_crystal().classical_decomposition()
525
+
526
+ def tensor(self, *crystals, **options):
527
+ """
528
+ Return the tensor product of ``self`` with ``crystals``.
529
+
530
+ If ``crystals`` is a list of (a tensor product of) KR tableaux, this
531
+ returns a
532
+ :class:`~sage.combinat.rigged_configurations.tensor_product_kr_tableaux.TensorProductOfKirillovReshetikhinTableaux`.
533
+
534
+ EXAMPLES::
535
+
536
+ sage: K = crystals.KirillovReshetikhin(['A', 3, 1], 2, 2, model='KR')
537
+ sage: TP = crystals.TensorProductOfKirillovReshetikhinTableaux(['A', 3, 1], [[1,3],[3,1]])
538
+ sage: K.tensor(TP, K)
539
+ Tensor product of Kirillov-Reshetikhin tableaux of type ['A', 3, 1]
540
+ and factor(s) ((2, 2), (1, 3), (3, 1), (2, 2))
541
+
542
+ sage: C = crystals.KirillovReshetikhin(['A',3,1], 3, 1, model='KN')
543
+ sage: K.tensor(K, C)
544
+ Full tensor product of the crystals
545
+ [Kirillov-Reshetikhin tableaux of type ['A', 3, 1] and shape (2, 2),
546
+ Kirillov-Reshetikhin tableaux of type ['A', 3, 1] and shape (2, 2),
547
+ Kirillov-Reshetikhin crystal of type ['A', 3, 1] with (r,s)=(3,1)]
548
+ """
549
+ ct = self._cartan_type
550
+ from sage.combinat.rigged_configurations.tensor_product_kr_tableaux \
551
+ import TensorProductOfKirillovReshetikhinTableaux
552
+ if all(isinstance(B, (KirillovReshetikhinTableaux, TensorProductOfKirillovReshetikhinTableaux))
553
+ and B.cartan_type() == ct for B in crystals):
554
+ dims = [[self._r, self._s]]
555
+ for B in crystals:
556
+ if isinstance(B, TensorProductOfKirillovReshetikhinTableaux):
557
+ dims += B.dims
558
+ elif isinstance(B, KirillovReshetikhinTableaux):
559
+ dims.append([B._r, B._s])
560
+ return TensorProductOfKirillovReshetikhinTableaux(ct, dims)
561
+ return super().tensor(*crystals, **options)
562
+
563
+ @lazy_attribute
564
+ def _tableau_height(self):
565
+ """
566
+ The height of the tableaux in ``self``.
567
+
568
+ EXAMPLES::
569
+
570
+ sage: K = crystals.KirillovReshetikhin(['A', 3, 1], 3, 2, model='KR')
571
+ sage: K._tableau_height
572
+ 3
573
+ """
574
+ return self._r
575
+
576
+
577
+ class KRTableauxRectangle(KirillovReshetikhinTableaux):
578
+ r"""
579
+ Kirillov-Reshetkhin tableaux `B^{r,s}` whose module generator is a single
580
+ `r \times s` rectangle.
581
+
582
+ These are Kirillov-Reshetkhin tableaux `B^{r,s}` of type:
583
+
584
+ - `A_n^{(1)}` for all `1 \leq r \leq n`,
585
+ - `C_n^{(1)}` when `r = n`.
586
+
587
+ TESTS::
588
+
589
+ sage: KRT = crystals.KirillovReshetikhin(['A', 3, 1], 2, 2, model='KR')
590
+ sage: TestSuite(KRT).run()
591
+ sage: KRT = crystals.KirillovReshetikhin(['C', 3, 1], 3, 2, model='KR')
592
+ sage: TestSuite(KRT).run() # long time
593
+ """
594
+
595
+ def _build_module_generators(self):
596
+ r"""
597
+ Build the module generators.
598
+
599
+ There is only one module generator which corresponds to a single
600
+ `r \times s` rectangle.
601
+
602
+ EXAMPLES::
603
+
604
+ sage: KRT = crystals.KirillovReshetikhin(['A', 4, 1], 2, 3, model='KR')
605
+ sage: KRT._build_module_generators()
606
+ ([[1, 1, 1], [2, 2, 2]],)
607
+ """
608
+ tableau = [[self._r - j for j in range(self._r)]
609
+ for i in range(self._s)]
610
+
611
+ return (self.element_class(self, [self.letters(x) for x in flatten(tableau)]),)
612
+
613
+ def from_kirillov_reshetikhin_crystal(self, krc):
614
+ """
615
+ Construct a
616
+ :class:`~sage.combinat.rigged_configurations.kr_tableaux.KirillovReshetikhinTableauxElement`.
617
+
618
+ EXAMPLES::
619
+
620
+ sage: KRT = crystals.KirillovReshetikhin(['A', 4, 1], 2, 1, model='KR')
621
+ sage: C = crystals.KirillovReshetikhin(['A',4,1], 2, 1, model='KN')
622
+ sage: krc = C(4,3); krc
623
+ [[3], [4]]
624
+ sage: KRT.from_kirillov_reshetikhin_crystal(krc)
625
+ [[3], [4]]
626
+ """
627
+ # To build a KR tableau from a KR crystal:
628
+ # 1 - start with the highest weight KR tableau
629
+ # 2 - determine a path from the KR crystal to its highest weight
630
+ # 3 - apply the inverse path to the highest weight KR tableau
631
+ f_str = reversed(krc.lift().to_highest_weight()[1])
632
+ return self.module_generators[0].f_string(f_str)
633
+
634
+
635
+ class KRTableauxTypeVertical(KirillovReshetikhinTableaux):
636
+ r"""
637
+ Kirillov-Reshetkihn tableaux `B^{r,s}` of type:
638
+
639
+ - `D_n^{(1)}` for all `1 \leq r < n-1`,
640
+ - `B_n^{(1)}` for all `1 \leq r < n`,
641
+ - `A_{2n-1}^{(2)}` for all `1 \leq r \leq n`.
642
+
643
+ TESTS::
644
+
645
+ sage: KRT = crystals.KirillovReshetikhin(['D', 4, 1], 1, 1, model='KR')
646
+ sage: TestSuite(KRT).run()
647
+ sage: KRT = crystals.KirillovReshetikhin(['B', 3, 1], 2, 2, model='KR')
648
+ sage: TestSuite(KRT).run() # long time
649
+ sage: KRT = crystals.KirillovReshetikhin(['A', 5, 2], 2, 2, model='KR')
650
+ sage: TestSuite(KRT).run() # long time
651
+ """
652
+
653
+ def _fill(self, weight):
654
+ r"""
655
+ Return the highest weight KR tableau of weight ``weight``.
656
+
657
+ INPUT:
658
+
659
+ - ``weight`` -- the weight of the highest weight KR tableau (the
660
+ conjugate of the shape of the KR crystal's tableau)
661
+
662
+ OUTPUT: a `r \times s` tableau
663
+
664
+ EXAMPLES::
665
+
666
+ sage: KRT = crystals.KirillovReshetikhin(['D', 4, 1], 2, 1, model='KR')
667
+ sage: KRT._fill([])
668
+ [[1], [-1]]
669
+ sage: KRT = crystals.KirillovReshetikhin(['D', 14, 1], 12, 7, model='KR')
670
+ sage: KRT._fill([10,10,8,2,2,2])
671
+ [[1, 1, 1, 1, 1, 7, 1], [2, 2, 2, 2, 2, 8, 2], [3, 3, 7, 9, 7, 9, 3], [4, 4, 8, 10, 8, 10, 4], [5, 5, 9, 11, 9, 11, 5], [6, 6, 10, 12, 10, 12, 6], [7, 7, 11, -12, 11, -12, 7], [8, 8, 12, -11, 12, -11, 8], [9, 9, -12, -10, -12, -10, 9], [10, 10, -11, -9, -11, -9, -9], [-12, 11, -10, -8, -10, -8, -8], [-11, 12, -9, -7, -9, -7, -7]]
672
+ sage: KRT._fill([10,10,6,2,2,2])
673
+ [[1, 1, 1, 1, 1, 5, 1], [2, 2, 2, 2, 2, 6, 2], [3, 3, 9, 7, 9, 7, 3], [4, 4, 10, 8, 10, 8, 4], [5, 5, 11, 9, 11, 9, 5], [6, 6, 12, 10, 12, 10, 6], [7, 7, -12, 11, -12, 11, 7], [8, 8, -11, 12, -11, 12, 8], [9, 9, -10, -12, -10, -12, -8], [10, 10, -9, -11, -9, -11, -7], [-12, 11, -8, -10, -8, -10, -6], [-11, 12, -7, -9, -7, -9, -5]]
674
+ """
675
+ # Add zeros until the shape has length s
676
+ weight_list = list(weight) # Make sure we have a list
677
+ while len(weight_list) != self._s:
678
+ weight_list.append(0)
679
+
680
+ tableau = []
681
+ i = 0
682
+ # Step 0 - Fill first columns of height r
683
+ while i < self._s and weight_list[i] == self._r:
684
+ tableau.append([self._r - j for j in range(self._r)])
685
+ i += 1
686
+
687
+ # Step 1 - Add the alternating columns until we hit an odd number of columns
688
+ c = -1
689
+ while i < self._s:
690
+ # If it is an odd number of columns
691
+ if i == self._s - 1 or weight_list[i] != weight_list[i + 1]:
692
+ c = weight_list[i]
693
+ i += 1
694
+ break
695
+ temp_list = [-(weight_list[i] + j + 1) for j in range(self._r - weight_list[i])]
696
+ for j in range(weight_list[i]):
697
+ temp_list.append(weight_list[i] - j)
698
+ tableau.append(temp_list)
699
+ tableau.append([self._r - j for j in range(self._r)])
700
+ i += 2
701
+
702
+ # Step 2 - Add the x dependent columns
703
+ x = c + 1
704
+ while i < self._s:
705
+ temp_list = [-x - j for j in range(self._r - x + 1)] # +1 for indexing
706
+ for j in range(x - weight_list[i] - 1): # +1 for indexing
707
+ temp_list.append(self._r - j)
708
+ x = temp_list[-1] # This is the h+1 entry of the column
709
+ for j in range(weight_list[i]):
710
+ temp_list.append(weight_list[i] - j)
711
+
712
+ tableau.append(temp_list)
713
+ i += 1
714
+
715
+ # Step 3 - Add the final column
716
+ if c > -1:
717
+ val = (self._r + x - 1) // 2
718
+ temp_list = [-x - j for j in range(self._r - val)]
719
+ for j in range(val):
720
+ temp_list.append(val - j)
721
+ tableau.append(temp_list)
722
+
723
+ return self.element_class(self, [self.letters(x) for x in flatten(tableau)])
724
+
725
+ def _build_module_generators(self):
726
+ """
727
+ Build the module generators.
728
+
729
+ EXAMPLES::
730
+
731
+ sage: KRT = crystals.KirillovReshetikhin(['D',4,1], 2, 3, model='KR')
732
+ sage: KRT._build_module_generators()
733
+ ([[-2, 1, 1], [-1, 2, -1]], [[1, -2, 1], [2, -1, 2]],
734
+ [[1, 1, 1], [2, 2, -1]], [[1, 1, 1], [2, 2, 2]])
735
+ """
736
+ return tuple(self._fill(weight) for weight in
737
+ horizontal_dominoes_removed(self._s, self._r))
738
+
739
+ def from_kirillov_reshetikhin_crystal(self, krc):
740
+ """
741
+ Construct an element of ``self`` from the Kirillov-Reshetikhin
742
+ crystal element ``krc``.
743
+
744
+ EXAMPLES::
745
+
746
+ sage: KRT = crystals.KirillovReshetikhin(['D',4,1], 2, 3, model='KR')
747
+ sage: C = crystals.KirillovReshetikhin(['D',4,1], 2, 3, model='KN')
748
+ sage: krc = C(4,3); krc
749
+ [[3], [4]]
750
+ sage: KRT.from_kirillov_reshetikhin_crystal(krc)
751
+ [[3, -2, 1], [4, -1, 2]]
752
+ """
753
+ # To build a KR tableau from a KR crystal:
754
+ # 1 - start with a highest weight KR tableau generated from the
755
+ # shape of the KR crystal
756
+ # 2 - determine a path from the KR crystal to its highest weight
757
+ # 3 - apply the inverse path to the highest weight KR tableau
758
+ lifted = krc.lift()
759
+ weight = lifted.to_tableau().shape().conjugate()
760
+ f_str = reversed(lifted.to_highest_weight()[1])
761
+ return self._fill(weight).f_string(f_str)
762
+
763
+
764
+ class KRTableauxTypeHorizonal(KirillovReshetikhinTableaux):
765
+ r"""
766
+ Kirillov-Reshetikhin tableaux `B^{r,s}` of type:
767
+
768
+ - `C_n^{(1)}` for `1 \leq r < n`,
769
+ - `A_{2n}^{(2)\dagger}` for `1 \leq r \leq n`.
770
+
771
+ TESTS::
772
+
773
+ sage: KRT = crystals.KirillovReshetikhin(['C', 3, 1], 2, 2, model='KR')
774
+ sage: TestSuite(KRT).run() # long time
775
+ sage: KRT = crystals.KirillovReshetikhin(CartanType(['A', 4, 2]).dual(), 2, 2, model='KR')
776
+ sage: TestSuite(KRT).run()
777
+ """
778
+
779
+ def _fill(self, shape):
780
+ r"""
781
+ Return the highest weight KR tableau of weight ``shape``.
782
+
783
+ INPUT:
784
+
785
+ - ``shape`` -- the shape of the KR crystal's tableau
786
+
787
+ OUTPUT: a `r \times s` tableau
788
+
789
+ EXAMPLES::
790
+
791
+ sage: KRT = crystals.KirillovReshetikhin(['C', 5, 1], 3, 5, model='KR')
792
+ sage: KRT._fill([3,3,1])
793
+ [[1, 1, 1, -3, 1], [2, 2, 2, -2, 2], [3, -3, 3, -1, 3]]
794
+ sage: KRT = crystals.KirillovReshetikhin(['C', 10, 1], 5, 6, model='KR')
795
+ sage: KRT._fill([6,4,2,2])
796
+ [[1, 1, 1, 1, 1, 1], [2, 2, 2, 2, -5, 2], [3, 3, -5, 3, -4, 3], [4, 4, -4, 4, -3, 4], [-5, 5, -3, 5, -2, 5]]
797
+ sage: KRT._fill([6,4])
798
+ [[1, 1, 1, 1, 1, 1], [2, 2, 2, 2, -5, 2], [-5, 3, -5, 3, -4, 3], [-4, 4, -4, 4, -3, 4], [-3, 5, -3, 5, -2, 5]]
799
+ """
800
+ # Add zeros until the shape has length s
801
+ shape_list = list(shape) # Make sure we have a list
802
+ while len(shape_list) != self._r:
803
+ shape_list.append(0)
804
+
805
+ lst = []
806
+ for col in range(1, self._s + 1):
807
+ if (self._s - col) % 2 == 0:
808
+ lst.extend(self.letters(self._r - x) for x in range(self._r))
809
+ else:
810
+ m = self._r
811
+ for j, val in enumerate(shape_list):
812
+ if col >= val:
813
+ m = j
814
+ break
815
+ lst.extend(self.letters(-x) for x in range(m + 1, self._r + 1))
816
+ lst.extend(self.letters(m - x) for x in range(m))
817
+
818
+ return self.element_class(self, lst)
819
+
820
+ def _build_module_generators(self):
821
+ """
822
+ Build the module generators.
823
+
824
+ EXAMPLES::
825
+
826
+ sage: KRT = crystals.KirillovReshetikhin(['C',4,1], 2, 3, model='KR')
827
+ sage: KRT._build_module_generators()
828
+ ([[1, -2, 1], [2, -1, 2]], [[1, 1, 1], [2, -2, 2]], [[1, 1, 1], [2, 2, 2]])
829
+ """
830
+ return tuple(self._fill(shape) for shape in horizontal_dominoes_removed(self._r, self._s))
831
+
832
+ def from_kirillov_reshetikhin_crystal(self, krc):
833
+ """
834
+ Construct an element of ``self`` from the Kirillov-Reshetikhin
835
+ crystal element ``krc``.
836
+
837
+ EXAMPLES::
838
+
839
+ sage: KRT = crystals.KirillovReshetikhin(['C',4,1], 2, 3, model='KR')
840
+ sage: C = crystals.KirillovReshetikhin(['C',4,1], 2, 3, model='KN')
841
+ sage: krc = C(4,3); krc
842
+ [[3], [4]]
843
+ sage: KRT.from_kirillov_reshetikhin_crystal(krc)
844
+ [[3, -2, 1], [4, -1, 2]]
845
+ """
846
+ # To build a KR tableau from a KR crystal:
847
+ # 1 - start with a highest weight KR tableau generated from the
848
+ # shape of the KR crystal
849
+ # 2 - determine a path from the KR crystal to its highest weight
850
+ # 3 - apply the inverse path to the highest weight KR tableau
851
+ lifted = krc.lift()
852
+ shape = lifted.to_tableau().shape()
853
+ f_str = reversed(lifted.to_highest_weight()[1])
854
+ return self._fill(shape).f_string(f_str)
855
+
856
+
857
+ class KRTableauxTypeBox(KRTableauxTypeVertical):
858
+ r"""
859
+ Kirillov-Reshetikhin tableaux `B^{r,s}` of type:
860
+
861
+ - `A_{2n}^{(2)}` for all `r \leq n`,
862
+ - `D_{n+1}^{(2)}` for all `r < n`,
863
+ - `D_4^{(3)}` for `r = 1`.
864
+
865
+ TESTS::
866
+
867
+ sage: KRT = crystals.KirillovReshetikhin(['A', 4, 2], 2, 2, model='KR')
868
+ sage: TestSuite(KRT).run()
869
+ sage: KRT = crystals.KirillovReshetikhin(['D', 4, 2], 2, 2, model='KR')
870
+ sage: TestSuite(KRT).run() # long time
871
+ sage: KRT = crystals.KirillovReshetikhin(['D', 4, 3], 1, 2, model='KR')
872
+ sage: TestSuite(KRT).run() # long time
873
+ """
874
+
875
+ def _fill(self, weight):
876
+ r"""
877
+ Return the highest weight KR tableau of weight ``weight``.
878
+
879
+ INPUT:
880
+
881
+ - ``weight`` -- the weight of the highest weight KR tableau (the
882
+ conjugate of the shape of the KR crystal's tableau)
883
+
884
+ OUTPUT: a `r \times s` tableau
885
+
886
+ EXAMPLES::
887
+
888
+ sage: KRT = crystals.KirillovReshetikhin(['D', 4, 1], 2, 1, model='KR')
889
+ sage: KRT._fill([])
890
+ [[1], [-1]]
891
+ sage: KRT = crystals.KirillovReshetikhin(['D', 14, 1], 12, 7, model='KR')
892
+ sage: KRT._fill([10,10,8,2,2,2])
893
+ [[1, 1, 1, 1, 1, 7, 1], [2, 2, 2, 2, 2, 8, 2], [3, 3, 7, 9, 7, 9, 3], [4, 4, 8, 10, 8, 10, 4], [5, 5, 9, 11, 9, 11, 5], [6, 6, 10, 12, 10, 12, 6], [7, 7, 11, -12, 11, -12, 7], [8, 8, 12, -11, 12, -11, 8], [9, 9, -12, -10, -12, -10, 9], [10, 10, -11, -9, -11, -9, -9], [-12, 11, -10, -8, -10, -8, -8], [-11, 12, -9, -7, -9, -7, -7]]
894
+ sage: KRT._fill([10,10,6,2,2,2])
895
+ [[1, 1, 1, 1, 1, 5, 1], [2, 2, 2, 2, 2, 6, 2], [3, 3, 9, 7, 9, 7, 3], [4, 4, 10, 8, 10, 8, 4], [5, 5, 11, 9, 11, 9, 5], [6, 6, 12, 10, 12, 10, 6], [7, 7, -12, 11, -12, 11, 7], [8, 8, -11, 12, -11, 12, 8], [9, 9, -10, -12, -10, -12, -8], [10, 10, -9, -11, -9, -11, -7], [-12, 11, -8, -10, -8, -10, -6], [-11, 12, -7, -9, -7, -9, -5]]
896
+ """
897
+ # Add zeros until the shape has length s
898
+ weight_list = list(weight) # Make sure we have a list
899
+ while len(weight_list) != self._s:
900
+ weight_list.append(0)
901
+
902
+ tableau = []
903
+ i = 0
904
+ # Step 0 - Fill first columns of height r
905
+ while i < self._s and weight_list[i] == self._r:
906
+ tableau.append([self._r - j for j in range(self._r)])
907
+ i += 1
908
+
909
+ # Step 1 - Add the alternating columns until we hit an odd number of columns
910
+ c = -1
911
+ while i < self._s:
912
+ # If it is an odd number of columns
913
+ if i == self._s - 1 or weight_list[i] != weight_list[i + 1]:
914
+ c = weight_list[i]
915
+ i += 1
916
+ break
917
+ temp_list = [-(weight_list[i] + j + 1) for j in range(self._r - weight_list[i])]
918
+ for j in range(weight_list[i]):
919
+ temp_list.append(weight_list[i] - j)
920
+ tableau.append(temp_list)
921
+ tableau.append([self._r - j for j in range(self._r)])
922
+ i += 2
923
+
924
+ # Step 2 - Add the x dependent columns
925
+ x = c + 1
926
+ while i < self._s:
927
+ temp_list = [-x - j for j in range(self._r - x + 1)] # +1 for indexing
928
+ for j in range(x - weight_list[i] - 1): # +1 for indexing
929
+ temp_list.append(self._r - j)
930
+ x = temp_list[-1] # This is the h+1 entry of the column
931
+ for j in range(weight_list[i]):
932
+ temp_list.append(weight_list[i] - j)
933
+
934
+ tableau.append(temp_list)
935
+ i += 1
936
+
937
+ # Step 3 - Add the final column
938
+ if c > -1:
939
+ val = x - 1
940
+ temp_list = ['E' for j in range(self._r - val)]
941
+ for j in range(val):
942
+ temp_list.append(val - j)
943
+ tableau.append(temp_list)
944
+
945
+ return self.element_class(self, [self.letters(x) for x in flatten(tableau)])
946
+
947
+ def _build_module_generators(self):
948
+ """
949
+ Build the module generators.
950
+
951
+ EXAMPLES::
952
+
953
+ sage: KRT = crystals.KirillovReshetikhin(['A',4,2], 2, 2, model='KR')
954
+ sage: KRT._build_module_generators()
955
+ ([[-2, 1], [-1, 2]], [[2, 1], [-2, E]], [[1, E], [2, E]],
956
+ [[1, 1], [-2, 2]], [[1, 1], [2, E]], [[1, 1], [2, 2]])
957
+ """
958
+ return tuple(self._fill(weight) for weight in partitions_in_box(self._s, self._r))
959
+
960
+
961
+ class KRTableauxSpin(KRTableauxRectangle):
962
+ r"""
963
+ Kirillov-Reshetikhin tableaux `B^{r,s}` of type `D_n^{(1)}` with
964
+ `r = n, n-1`.
965
+
966
+ TESTS::
967
+
968
+ sage: KRT = crystals.KirillovReshetikhin(['D', 4, 1], 3, 2, model='KR')
969
+ sage: TestSuite(KRT).run()
970
+ sage: KRT = crystals.KirillovReshetikhin(['D', 4, 1], 4, 2, model='KR')
971
+ sage: TestSuite(KRT).run()
972
+ """
973
+
974
+ def _build_module_generators(self):
975
+ r"""
976
+ Build the module generators.
977
+
978
+ There is only one module generator which corresponds to a single
979
+ `n \times s` rectangle.
980
+
981
+ EXAMPLES::
982
+
983
+ sage: KRT = crystals.KirillovReshetikhin(['D', 4, 1], 3, 3, model='KR')
984
+ sage: KRT._build_module_generators()
985
+ ([[1, 1, 1], [2, 2, 2], [3, 3, 3], [-4, -4, -4]],)
986
+ sage: KRT = crystals.KirillovReshetikhin(['D', 4, 1], 4, 3, model='KR')
987
+ sage: KRT._build_module_generators()
988
+ ([[1, 1, 1], [2, 2, 2], [3, 3, 3], [4, 4, 4]],)
989
+ """
990
+ n = self.cartan_type().classical().rank()
991
+ if self._r == n:
992
+ return KRTableauxRectangle._build_module_generators(self)
993
+
994
+ tableau = []
995
+ for i in range(self._s):
996
+ tableau.append([-n] + [self._r - j for j in range(self._r)])
997
+
998
+ return (self.element_class(self, [self.letters(x) for x in flatten(tableau)]),)
999
+
1000
+
1001
+ class KRTableauxBn(KRTableauxTypeHorizonal):
1002
+ """
1003
+ Kirillov-Reshetkhin tableaux `B^{n,s}` of type `B_n^{(1)}`.
1004
+
1005
+ TESTS::
1006
+
1007
+ sage: KRT = crystals.KirillovReshetikhin(['B', 2, 1], 2, 3, model='KR')
1008
+ sage: TestSuite(KRT).run()
1009
+ """
1010
+
1011
+ def _build_module_generators(self):
1012
+ """
1013
+ Build the module generators.
1014
+
1015
+ EXAMPLES::
1016
+
1017
+ sage: KRT = crystals.KirillovReshetikhin(['B', 2, 1], 2, 2, model='KR')
1018
+ sage: KRT._build_module_generators()
1019
+ ([[-2, 1], [-1, 2]], [[1, 1], [2, 2]])
1020
+ """
1021
+ odd = int(self._s % 2)
1022
+ shapes = ([int(x * 2 + odd) for x in sh]
1023
+ for sh in vertical_dominoes_removed(self._r, self._s // 2))
1024
+ return tuple(self._fill(sh) for sh in shapes)
1025
+
1026
+ def from_kirillov_reshetikhin_crystal(self, krc):
1027
+ """
1028
+ Construct an element of ``self`` from the Kirillov-Reshetikhin
1029
+ crystal element ``krc``.
1030
+
1031
+ EXAMPLES::
1032
+
1033
+ sage: KR = crystals.KirillovReshetikhin(['B',3,1], 3, 3, model='KR')
1034
+ sage: C = crystals.KirillovReshetikhin(['B',3,1], 3, 3, model='KN')
1035
+ sage: krc = C.module_generators[1].f_string([3,2,3,1,3,3]); krc
1036
+ [++-, [[2], [0], [-3]]]
1037
+ sage: KR.from_kirillov_reshetikhin_crystal(krc)
1038
+ [[1, 1, 2], [2, 2, -3], [-3, -3, -1]]
1039
+ """
1040
+ # To build a KR tableau from a type B_n spinor KR crystal:
1041
+ # 1 - determine a path from the KR crystal to its highest weight
1042
+ # 2 - find the corresponding highest weight KR tableau
1043
+ # 3 - apply the inverse path to the highest weight KR tableau
1044
+ lifted = krc.lift()
1045
+ to_hw = lifted.to_highest_weight()
1046
+ f_str = reversed(to_hw[1])
1047
+ wt = to_hw[0].weight()
1048
+ for x in self.module_generators:
1049
+ if x.classical_weight() == wt:
1050
+ return x.f_string(f_str)
1051
+ raise ValueError("no matching highest weight element found")
1052
+
1053
+
1054
+ class KirillovReshetikhinTableauxElement(TensorProductOfRegularCrystalsElement):
1055
+ r"""
1056
+ A Kirillov-Reshetikhin tableau.
1057
+
1058
+ For more information, see
1059
+ :class:`~sage.combinat.rigged_configurations.kr_tableaux.KirillovReshetikhinTableaux`
1060
+ and
1061
+ :class:`~sage.combinat.rigged_configurations.tensor_product_kr_tableaux.TensorProductOfKirillovReshetikhinTableaux`.
1062
+ """
1063
+
1064
+ def __init__(self, parent, list, **options):
1065
+ r"""
1066
+ Initialize ``self``.
1067
+
1068
+ EXAMPLES::
1069
+
1070
+ sage: KRT = crystals.KirillovReshetikhin(['A', 4, 1], 2, 1, model='KR')
1071
+ sage: elt = KRT(4, 3); elt
1072
+ [[3], [4]]
1073
+ sage: TestSuite(elt).run()
1074
+ """
1075
+ # Make sure we are a list of letters
1076
+ if list and not isinstance(list[0], (parent.letters.element_class, EmptyLetter)):
1077
+ list = [parent.letters(x) for x in list]
1078
+ TensorProductOfRegularCrystalsElement.__init__(self, parent, list)
1079
+
1080
+ def _repr_(self):
1081
+ """
1082
+ Return the string representation of ``self``.
1083
+
1084
+ EXAMPLES::
1085
+
1086
+ sage: KRT = crystals.KirillovReshetikhin(['A', 4, 1], 2, 1, model='KR')
1087
+ sage: KRT(3,2)
1088
+ [[2], [3]]
1089
+ """
1090
+ return repr(self.to_array())
1091
+
1092
+ def _repr_diagram(self):
1093
+ """
1094
+ Return a string representation of ``self`` as a diagram.
1095
+
1096
+ EXAMPLES::
1097
+
1098
+ sage: KRT = crystals.KirillovReshetikhin(['A',4,1], 2, 2, model='KR')
1099
+ sage: elt = KRT(2,1,4,3)
1100
+ sage: print(elt._repr_diagram())
1101
+ 1 3
1102
+ 2 4
1103
+ """
1104
+ return self.to_tableau()._repr_diagram()
1105
+
1106
+ def _latex_(self):
1107
+ r"""
1108
+ Return a latex representation of ``self``.
1109
+
1110
+ EXAMPLES::
1111
+
1112
+ sage: KRT = crystals.KirillovReshetikhin(['A', 4, 1], 2, 3, model='KR')
1113
+ sage: latex(KRT(3,2,4,2,4,3))
1114
+ {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}}
1115
+ \raisebox{-.6ex}{$\begin{array}[b]{*{3}c}\cline{1-3}
1116
+ \lr{2}&\lr{2}&\lr{3}\\\cline{1-3}
1117
+ \lr{3}&\lr{4}&\lr{4}\\\cline{1-3}
1118
+ \end{array}$}
1119
+ }
1120
+ """
1121
+ from sage.combinat.output import tex_from_array
1122
+ return tex_from_array([[val._latex_() for val in row] for row in self.to_array()])
1123
+
1124
+ def _ascii_art_(self):
1125
+ r"""
1126
+ Return an ASCII art representation of ``self``.
1127
+
1128
+ EXAMPLES::
1129
+
1130
+ sage: KRT = crystals.KirillovReshetikhin(['A',4,1], 2, 2, model='KR')
1131
+ sage: ascii_art(KRT(2,1,4,3))
1132
+ 1 3
1133
+ 2 4
1134
+ """
1135
+ from sage.typeset.ascii_art import AsciiArt
1136
+ return AsciiArt(self._repr_diagram().splitlines())
1137
+
1138
+ def _unicode_art_(self):
1139
+ r"""
1140
+ Return a unicode art representation of ``self``.
1141
+
1142
+ EXAMPLES::
1143
+
1144
+ sage: KRT = crystals.KirillovReshetikhin(['D',4,1], 2, 2, model='KR')
1145
+ sage: unicode_art(KRT(2,1,-4,3))
1146
+ ┌───┬───┐
1147
+ │ 1 │ 3 │
1148
+ ├───┼───┤
1149
+ │ 2 │ 4̄ │
1150
+ └───┴───┘
1151
+ """
1152
+ return self.to_tableau()._unicode_art_()
1153
+
1154
+ def to_kirillov_reshetikhin_crystal(self):
1155
+ r"""
1156
+ Construct a
1157
+ :func:`~sage.combinat.crystals.kirillov_reshetihkin.KashiwaraNakashimaTableaux`
1158
+ element from ``self``.
1159
+
1160
+ We construct the Kirillov-Reshetikhin crystal element as follows:
1161
+
1162
+ 1. Determine the shape `\lambda` of the KR crystal from the weight.
1163
+ 2. Determine a path `e_{i_1} e_{i_2} \cdots e_{i_k}` to the highest
1164
+ weight.
1165
+ 3. Apply `f_{i_k} \cdots f_{i_2} f_{i_1}` to a highest weight KR
1166
+ crystal of shape `\lambda`.
1167
+
1168
+ EXAMPLES::
1169
+
1170
+ sage: KRT = crystals.KirillovReshetikhin(['D',4,1], 2, 2, model='KR')
1171
+ sage: elt = KRT(3,2,-1,1); elt
1172
+ [[2, 1], [3, -1]]
1173
+ sage: elt.to_kirillov_reshetikhin_crystal()
1174
+ [[2], [3]]
1175
+
1176
+ TESTS:
1177
+
1178
+ Spinor tests::
1179
+
1180
+ sage: KRT = crystals.KirillovReshetikhin(['D',4,1], 4, 3, model='KR')
1181
+ sage: KRC = crystals.KirillovReshetikhin(['D',4,1], 4, 3, model='KN')
1182
+ sage: elt = KRT(-3,-4,2,1,-3,-4,2,1,-2,-4,3,1); elt
1183
+ [[1, 1, 1], [2, 2, 3], [-4, -4, -4], [-3, -3, -2]]
1184
+ sage: ret = elt.to_kirillov_reshetikhin_crystal(); ret
1185
+ [++--, [[1], [3], [-4], [-3]]]
1186
+ sage: test = KRT(ret); test
1187
+ [[1, 1, 1], [2, 2, 3], [-4, -4, -4], [-3, -3, -2]]
1188
+ sage: test == elt
1189
+ True
1190
+ """
1191
+ return self.parent().kirillov_reshetikhin_crystal()(self)
1192
+
1193
+ @cached_method
1194
+ def to_array(self, rows=True):
1195
+ r"""
1196
+ Return a 2-dimensional array representation of this
1197
+ Kirillov-Reshetikhin element.
1198
+
1199
+ If the output is in rows, then it outputs the top row first (in the
1200
+ English convention) from left to right.
1201
+
1202
+ For example: if the reading word is `[2, 1, 4, 3]`, so as a
1203
+ `2 \times 2` tableau::
1204
+
1205
+ 1 3
1206
+ 2 4
1207
+
1208
+ we output ``[[1, 3], [2, 4]]``.
1209
+
1210
+ If the output is in columns, then it outputs the leftmost column first
1211
+ with the bottom element first. In other words this parses the reading
1212
+ word into its columns.
1213
+
1214
+ Continuing with the previous example, the output would be
1215
+ ``[[2, 1], [4, 3]]``.
1216
+
1217
+ INPUT:
1218
+
1219
+ - ``rows`` -- boolean (default: ``True``); set to ``True`` if the
1220
+ resulting array is by row, otherwise it is by column
1221
+
1222
+ EXAMPLES::
1223
+
1224
+ sage: KRT = crystals.KirillovReshetikhin(['A', 4, 1], 2, 2, model='KR')
1225
+ sage: elt = KRT(2, 1, 4, 3)
1226
+ sage: elt.to_array()
1227
+ [[1, 3], [2, 4]]
1228
+ sage: elt.to_array(False)
1229
+ [[2, 1], [4, 3]]
1230
+ """
1231
+ ret_list = []
1232
+ h = self.parent()._tableau_height
1233
+ s = self.parent()._s
1234
+ if rows:
1235
+ for i in reversed(range(h)):
1236
+ row = []
1237
+ for j in range(s):
1238
+ row.append(self[j * h + i])
1239
+ ret_list.append(row)
1240
+ else:
1241
+ for j in range(s):
1242
+ col = []
1243
+ for i in range(h):
1244
+ col.append(self[j * h + i])
1245
+ ret_list.append(col)
1246
+
1247
+ return ret_list
1248
+
1249
+ @cached_method
1250
+ def to_tableau(self):
1251
+ """
1252
+ Return a :class:`Tableau` object of ``self``.
1253
+
1254
+ EXAMPLES::
1255
+
1256
+ sage: KRT = crystals.KirillovReshetikhin(['A', 4, 1], 2, 2, model='KR')
1257
+ sage: elt = KRT(2, 1, 4, 3); elt
1258
+ [[1, 3], [2, 4]]
1259
+ sage: t = elt.to_tableau(); t
1260
+ [[1, 3], [2, 4]]
1261
+ sage: type(t)
1262
+ <class 'sage.combinat.tableau.Tableaux_all_with_category.element_class'>
1263
+ """
1264
+ return Tableau(self.to_array())
1265
+
1266
+ def pp(self):
1267
+ """
1268
+ Pretty print ``self``.
1269
+
1270
+ EXAMPLES::
1271
+
1272
+ sage: KRT = crystals.KirillovReshetikhin(['A', 4, 1], 2, 2, model='KR')
1273
+ sage: elt = KRT(2, 1, 4, 3); elt
1274
+ [[1, 3], [2, 4]]
1275
+ sage: elt.pp()
1276
+ 1 3
1277
+ 2 4
1278
+ """
1279
+ self.to_tableau().pp()
1280
+
1281
+ def to_classical_highest_weight(self, index_set=None):
1282
+ r"""
1283
+ Return the classical highest weight element corresponding to ``self``.
1284
+
1285
+ INPUT:
1286
+
1287
+ - ``index_set`` -- (default: ``None``) return the highest weight
1288
+ with respect to the index set; if ``None`` is passed in, then this
1289
+ uses the classical index set
1290
+
1291
+ OUTPUT:
1292
+
1293
+ A pair ``[H, f_str]`` where ``H`` is the highest weight element and
1294
+ ``f_str`` is a list of `a_i` of `f_{a_i}` needed to reach ``H``.
1295
+
1296
+ EXAMPLES::
1297
+
1298
+ sage: KRTab = crystals.KirillovReshetikhin(['D',4,1], 2, 2, model='KR')
1299
+ sage: elt = KRTab(3,2,-1,1); elt
1300
+ [[2, 1], [3, -1]]
1301
+ sage: elt.to_classical_highest_weight()
1302
+ [[[1, 1], [2, -1]], [1, 2]]
1303
+ """
1304
+ if index_set is None:
1305
+ index_set = self.parent()._cartan_type.classical().index_set()
1306
+ for i in index_set:
1307
+ next = self.e(i)
1308
+ if next is not None:
1309
+ hw = next.to_classical_highest_weight(index_set=index_set)
1310
+ return [hw[0], [i] + hw[1]]
1311
+ return [self, []]
1312
+
1313
+ def weight(self):
1314
+ """
1315
+ Return the weight of ``self``.
1316
+
1317
+ EXAMPLES::
1318
+
1319
+ sage: KR = crystals.KirillovReshetikhin(['D',4,1], 2, 2, model='KR')
1320
+ sage: KR.module_generators[1].weight()
1321
+ -2*Lambda[0] + Lambda[2]
1322
+ """
1323
+ return self.Phi() - self.Epsilon()
1324
+
1325
+ @cached_method
1326
+ def classical_weight(self):
1327
+ r"""
1328
+ Return the classical weight of ``self``.
1329
+
1330
+ EXAMPLES::
1331
+
1332
+ sage: KRT = crystals.KirillovReshetikhin(['D',4,1], 2, 2, model='KR')
1333
+ sage: elt = KRT(3,2,-1,1); elt
1334
+ [[2, 1], [3, -1]]
1335
+ sage: elt.classical_weight()
1336
+ (0, 1, 1, 0)
1337
+ """
1338
+ F = self.cartan_type().classical().root_system()
1339
+ if F.ambient_space() is None:
1340
+ WLR = F.weight_lattice()
1341
+ else:
1342
+ WLR = F.ambient_space()
1343
+ return sum((self[j].weight() for j in range(len(self))), WLR.zero())
1344
+
1345
+ def e(self, i):
1346
+ """
1347
+ Perform the action of `e_i` on ``self``.
1348
+
1349
+ .. TODO::
1350
+
1351
+ Implement a direct action of `e_0` without moving to KR crystals.
1352
+
1353
+ EXAMPLES::
1354
+
1355
+ sage: KRT = crystals.KirillovReshetikhin(['D',4,1], 2, 2, model='KR')
1356
+ sage: KRT.module_generators[0].e(0)
1357
+ [[-2, 1], [-1, -1]]
1358
+ """
1359
+ if i == self.parent()._cartan_type.special_node():
1360
+ ret = self.to_kirillov_reshetikhin_crystal().e0()
1361
+ if ret is None:
1362
+ return None
1363
+ return ret.to_kirillov_reshetikhin_tableau()
1364
+ return TensorProductOfRegularCrystalsElement.e(self, i)
1365
+
1366
+ def f(self, i):
1367
+ """
1368
+ Perform the action of `f_i` on ``self``.
1369
+
1370
+ .. TODO::
1371
+
1372
+ Implement a direct action of `f_0` without moving to KR crystals.
1373
+
1374
+ EXAMPLES::
1375
+
1376
+ sage: KRT = crystals.KirillovReshetikhin(['D',4,1], 2, 2, model='KR')
1377
+ sage: KRT.module_generators[0].f(0)
1378
+ [[1, 1], [2, -1]]
1379
+ """
1380
+ if i == self.parent()._cartan_type.special_node():
1381
+ ret = self.to_kirillov_reshetikhin_crystal().f0()
1382
+ if ret is None:
1383
+ return None
1384
+ return ret.to_kirillov_reshetikhin_tableau()
1385
+ return TensorProductOfRegularCrystalsElement.f(self, i)
1386
+
1387
+ def epsilon(self, i):
1388
+ r"""
1389
+ Compute `\varepsilon_i` of ``self``.
1390
+
1391
+ .. TODO::
1392
+
1393
+ Implement a direct action of `\varepsilon_0` without moving to
1394
+ KR crystals.
1395
+
1396
+ EXAMPLES::
1397
+
1398
+ sage: KRT = crystals.KirillovReshetikhin(['D',4,1], 2, 2, model='KR')
1399
+ sage: KRT.module_generators[0].epsilon(0)
1400
+ 2
1401
+ """
1402
+ if i == self.parent()._cartan_type.special_node():
1403
+ return self.to_kirillov_reshetikhin_crystal().epsilon0()
1404
+ return TensorProductOfRegularCrystalsElement.epsilon(self, i)
1405
+
1406
+ def phi(self, i):
1407
+ r"""
1408
+ Compute `\varphi_i` of ``self``.
1409
+
1410
+ .. TODO::
1411
+
1412
+ Compute `\varphi_0` without moving to KR crystals.
1413
+
1414
+ EXAMPLES::
1415
+
1416
+ sage: KRT = crystals.KirillovReshetikhin(['D',4,1], 2, 2, model='KR')
1417
+ sage: KRT.module_generators[0].phi(0)
1418
+ 2
1419
+ """
1420
+ if i == self.parent()._cartan_type.special_node():
1421
+ return self.to_kirillov_reshetikhin_crystal().phi0()
1422
+ return TensorProductOfRegularCrystalsElement.phi(self, i)
1423
+
1424
+ def left_split(self):
1425
+ r"""
1426
+ Return the image of ``self`` under the left column splitting map.
1427
+
1428
+ EXAMPLES::
1429
+
1430
+ sage: KRT = crystals.KirillovReshetikhin(['D',4,1], 2, 3, model='KR')
1431
+ sage: mg = KRT.module_generators[1]; mg.pp()
1432
+ 1 -2 1
1433
+ 2 -1 2
1434
+ sage: ls = mg.left_split(); ls.pp()
1435
+ 1 (X) -2 1
1436
+ 2 -1 2
1437
+ sage: ls.parent()
1438
+ Tensor product of Kirillov-Reshetikhin tableaux of type ['D', 4, 1] and factor(s) ((2, 1), (2, 2))
1439
+ """
1440
+ P = self.parent()
1441
+ if P._s == 1:
1442
+ raise ValueError("cannot split a single column")
1443
+ from sage.combinat.rigged_configurations.tensor_product_kr_tableaux import \
1444
+ TensorProductOfKirillovReshetikhinTableaux
1445
+ r = P._r
1446
+ TP = TensorProductOfKirillovReshetikhinTableaux(P._cartan_type, [[r, 1], [r, P._s - 1]])
1447
+ lf = TP.crystals[0](*(self[:r]))
1448
+ rf = TP.crystals[1](*(self[r:]))
1449
+ return TP(lf, rf)
1450
+
1451
+ def right_split(self):
1452
+ r"""
1453
+ Return the image of ``self`` under the right column splitting map.
1454
+
1455
+ Let `\ast` denote the :meth:`Lusztig involution<lusztig_involution>`,
1456
+ and `\mathrm{ls}` as the :meth:`left splitting map<left_split>`.
1457
+ The right splitting map is defined as
1458
+ `\mathrm{rs} := \ast \circ \mathrm{ls} \circ \ast`.
1459
+
1460
+ EXAMPLES::
1461
+
1462
+ sage: KRT = crystals.KirillovReshetikhin(['D',4,1], 2, 3, model='KR')
1463
+ sage: mg = KRT.module_generators[1]; mg.pp()
1464
+ 1 -2 1
1465
+ 2 -1 2
1466
+ sage: ls = mg.right_split(); ls.pp()
1467
+ -2 1 (X) 1
1468
+ -1 2 2
1469
+ sage: ls.parent()
1470
+ Tensor product of Kirillov-Reshetikhin tableaux of type ['D', 4, 1] and factor(s) ((2, 2), (2, 1))
1471
+ """
1472
+ return self.lusztig_involution().left_split().lusztig_involution()
1473
+
1474
+
1475
+ KirillovReshetikhinTableaux.Element = KirillovReshetikhinTableauxElement
1476
+
1477
+
1478
+ class KRTableauxSpinElement(KirillovReshetikhinTableauxElement):
1479
+ r"""
1480
+ Kirillov-Reshetikhin tableau for spinors.
1481
+
1482
+ Here we are in the embedding `B(\Lambda_n) \hookrightarrow
1483
+ B(2 \Lambda_n)`, so `e_i` and `f_i` act by `e_i^2` and `f_i^2`
1484
+ respectively for all `i \neq 0`. We do this so our columns are full
1485
+ width (as opposed to half width and/or uses a `\pm` representation).
1486
+ """
1487
+
1488
+ def e(self, i):
1489
+ r"""
1490
+ Calculate the action of `e_i` on ``self``.
1491
+
1492
+ EXAMPLES::
1493
+
1494
+ sage: KRT = crystals.KirillovReshetikhin(['D',4,1], 4, 1, model='KR')
1495
+ sage: KRT(-1, -4, 3, 2).e(1)
1496
+ [[1], [3], [-4], [-2]]
1497
+ sage: KRT(-1, -4, 3, 2).e(3)
1498
+ """
1499
+ if i == self.parent()._cartan_type.special_node():
1500
+ # Only need to do it once since we pull to the KR crystal
1501
+ return KirillovReshetikhinTableauxElement.e(self, i)
1502
+
1503
+ half = KirillovReshetikhinTableauxElement.e(self, i)
1504
+ if half is None:
1505
+ return None
1506
+ return KirillovReshetikhinTableauxElement.e(half, i)
1507
+
1508
+ def f(self, i):
1509
+ r"""
1510
+ Calculate the action of `f_i` on ``self``.
1511
+
1512
+ EXAMPLES::
1513
+
1514
+ sage: KRT = crystals.KirillovReshetikhin(['D',4,1], 4, 1, model='KR')
1515
+ sage: KRT(-1, -4, 3, 2).f(1)
1516
+ sage: KRT(-1, -4, 3, 2).f(3)
1517
+ [[2], [4], [-3], [-1]]
1518
+ """
1519
+ if i == self.parent()._cartan_type.special_node():
1520
+ # Only need to do it once since we pull to the KR crystal
1521
+ return KirillovReshetikhinTableauxElement.f(self, i)
1522
+
1523
+ half = KirillovReshetikhinTableauxElement.f(self, i)
1524
+ if half is None:
1525
+ return None
1526
+
1527
+ return KirillovReshetikhinTableauxElement.f(half, i)
1528
+
1529
+ def epsilon(self, i):
1530
+ r"""
1531
+ Compute `\varepsilon_i` of ``self``.
1532
+
1533
+ EXAMPLES::
1534
+
1535
+ sage: KRT = crystals.KirillovReshetikhin(['D',4,1], 4, 1, model='KR')
1536
+ sage: KRT(-1, -4, 3, 2).epsilon(1)
1537
+ 1
1538
+ sage: KRT(-1, -4, 3, 2).epsilon(3)
1539
+ 0
1540
+ """
1541
+ if i == self.parent()._cartan_type.special_node():
1542
+ # Don't need to half it since we pull to the KR crystal
1543
+ return KirillovReshetikhinTableauxElement.epsilon(self, i)
1544
+ return KirillovReshetikhinTableauxElement.epsilon(self, i) // 2
1545
+
1546
+ def phi(self, i):
1547
+ r"""
1548
+ Compute `\varphi_i` of ``self``.
1549
+
1550
+ EXAMPLES::
1551
+
1552
+ sage: KRT = crystals.KirillovReshetikhin(['D',4,1], 4, 1, model='KR')
1553
+ sage: KRT(-1, -4, 3, 2).phi(1)
1554
+ 0
1555
+ sage: KRT(-1, -4, 3, 2).phi(3)
1556
+ 1
1557
+ """
1558
+ if i == self.parent()._cartan_type.special_node():
1559
+ # Don't need to half it since we pull to the KR crystal
1560
+ return KirillovReshetikhinTableauxElement.phi(self, i)
1561
+ return KirillovReshetikhinTableauxElement.phi(self, i) // 2
1562
+
1563
+ @cached_method
1564
+ def to_array(self, rows=True):
1565
+ r"""
1566
+ Return a 2-dimensional array representation of this
1567
+ Kirillov-Reshetikhin element.
1568
+
1569
+ If the output is in rows, then it outputs the top row first (in the
1570
+ English convention) from left to right.
1571
+
1572
+ For example: if the reading word is `[2, 1, 4, 3]`, so as a
1573
+ `2 \times 2` tableau::
1574
+
1575
+ 1 3
1576
+ 2 4
1577
+
1578
+ we output ``[[1, 3], [2, 4]]``.
1579
+
1580
+ If the output is in columns, then it outputs the leftmost column first
1581
+ with the bottom element first. In other words this parses the reading
1582
+ word into its columns.
1583
+
1584
+ Continuing with the previous example, the output would be
1585
+ ``[[2, 1], [4, 3]]``.
1586
+
1587
+ INPUT:
1588
+
1589
+ - ``rows`` -- boolean (default: ``True``); set to ``True`` if the
1590
+ resulting array is by row, otherwise it is by column
1591
+
1592
+ EXAMPLES::
1593
+
1594
+ sage: KRT = crystals.KirillovReshetikhin(['D', 4, 1], 4, 3, model='KR')
1595
+ sage: elt = KRT(-3,-4,2,1,-3,-4,2,1,-2,-4,3,1)
1596
+ sage: elt.to_array()
1597
+ [[1, 1, 1], [2, 2, 3], [-4, -4, -4], [-3, -3, -2]]
1598
+ sage: elt.to_array(False)
1599
+ [[-3, -4, 2, 1], [-3, -4, 2, 1], [-2, -4, 3, 1]]
1600
+ """
1601
+ ret_list = []
1602
+ h = self.parent()._cartan_type.classical().rank()
1603
+ s = self.parent()._s
1604
+ if rows:
1605
+ for i in reversed(range(h)):
1606
+ row = []
1607
+ for j in range(s):
1608
+ row.append(self[j * h + i])
1609
+ ret_list.append(row)
1610
+ else:
1611
+ for j in range(s):
1612
+ col = []
1613
+ for i in range(h):
1614
+ col.append(self[j * h + i])
1615
+ ret_list.append(col)
1616
+
1617
+ return ret_list
1618
+
1619
+ def left_split(self):
1620
+ """
1621
+ Return the image of ``self`` under the left column splitting map.
1622
+
1623
+ EXAMPLES::
1624
+
1625
+ sage: KRT = crystals.KirillovReshetikhin(['D', 4, 1], 4, 3, model='KR')
1626
+ sage: elt = KRT(-3,-4,2,1,-3,-4,2,1,-2,-4,3,1); elt.pp()
1627
+ 1 1 1
1628
+ 2 2 3
1629
+ -4 -4 -4
1630
+ -3 -3 -2
1631
+ sage: elt.left_split().pp()
1632
+ 1 (X) 1 1
1633
+ 2 2 3
1634
+ -4 -4 -4
1635
+ -3 -3 -2
1636
+ """
1637
+ P = self.parent()
1638
+ if P._s == 1:
1639
+ raise ValueError("cannot split a single column")
1640
+ from sage.combinat.rigged_configurations.tensor_product_kr_tableaux import \
1641
+ TensorProductOfKirillovReshetikhinTableaux
1642
+ h = P._cartan_type.classical().rank()
1643
+ TP = TensorProductOfKirillovReshetikhinTableaux(P._cartan_type, [[P._r, 1], [P._r, P._s - 1]])
1644
+ lf = TP.crystals[0](*(self[:h]))
1645
+ rf = TP.crystals[1](*(self[h:]))
1646
+ return TP(lf, rf)
1647
+
1648
+ # FIXME: This is a copy of the above classical weight, and cached_method
1649
+ # overwrites this method if it is called via super.
1650
+ @cached_method
1651
+ def classical_weight(self):
1652
+ r"""
1653
+ Return the classical weight of ``self``.
1654
+
1655
+ EXAMPLES::
1656
+
1657
+ sage: KRT = crystals.KirillovReshetikhin(['D', 4, 1], 4, 1, model='KR')
1658
+ sage: KRT.module_generators[0].classical_weight()
1659
+ (1/2, 1/2, 1/2, 1/2)
1660
+ """
1661
+ F = self.cartan_type().classical().root_system()
1662
+ if F.ambient_space() is None:
1663
+ WLR = F.weight_lattice()
1664
+ else:
1665
+ WLR = F.ambient_space()
1666
+ return sum((self[j].weight() for j in range(len(self))), WLR.zero()) / 2
1667
+
1668
+
1669
+ KRTableauxBn.Element = KRTableauxSpinElement
1670
+ KRTableauxSpin.Element = KRTableauxSpinElement
1671
+
1672
+
1673
+ class KRTableauxDTwistedSpin(KRTableauxRectangle):
1674
+ r"""
1675
+ Kirillov-Reshetikhin tableaux `B^{r,s}` of type `D_n^{(2)}` with `r = n`.
1676
+
1677
+ EXAMPLES::
1678
+
1679
+ sage: KRT = crystals.KirillovReshetikhin(['D', 4, 2], 1, 1, model='KR')
1680
+ sage: KRT.cardinality()
1681
+ 8
1682
+ sage: KRC = crystals.KirillovReshetikhin(['D', 4, 2], 1, 1, model='KN')
1683
+ sage: KRT.cardinality() == KRC.cardinality()
1684
+ True
1685
+ """
1686
+ Element = KRTableauxSpinElement
1687
+
1688
+
1689
+ class KRTableauxTypeFromRCElement(KirillovReshetikhinTableauxElement):
1690
+ r"""
1691
+ A Kirillov-Reshetikhin tableau constructed from rigged configurations
1692
+ under the bijection `\Phi`.
1693
+ """
1694
+
1695
+ def e(self, i):
1696
+ """
1697
+ Perform the action of `e_i` on ``self``.
1698
+
1699
+ .. TODO::
1700
+
1701
+ Implement a direct action of `e_0` without moving to
1702
+ rigged configurations.
1703
+
1704
+ EXAMPLES::
1705
+
1706
+ sage: KRT = crystals.KirillovReshetikhin(['D',4,3], 2, 1, model='KR')
1707
+ sage: KRT.module_generators[0].e(0)
1708
+ [[2], [E]]
1709
+ """
1710
+ if i == self.parent().cartan_type().special_node():
1711
+ P = self.parent()
1712
+ from sage.combinat.rigged_configurations.tensor_product_kr_tableaux import TensorProductOfKirillovReshetikhinTableaux
1713
+ K = TensorProductOfKirillovReshetikhinTableaux(P.cartan_type(), [[2, P.s()]])
1714
+ ret = K(self).to_rigged_configuration()
1715
+ RC = ret.parent()
1716
+ ret = ret.to_virtual_configuration().e(0)
1717
+ if ret is None:
1718
+ return None
1719
+ ret = RC.from_virtual(ret)
1720
+ return ret.to_tensor_product_of_kirillov_reshetikhin_tableaux()[0]
1721
+ return TensorProductOfRegularCrystalsElement.e(self, i)
1722
+
1723
+ def f(self, i):
1724
+ """
1725
+ Perform the action of `f_i` on ``self``.
1726
+
1727
+ .. TODO::
1728
+
1729
+ Implement a direct action of `f_0` without moving to
1730
+ rigged configurations.
1731
+
1732
+ EXAMPLES::
1733
+
1734
+ sage: KRT = crystals.KirillovReshetikhin(['D',4,3], 2, 1, model='KR')
1735
+ sage: KRT.module_generators[0].f(0)
1736
+ sage: KRT.module_generators[3].f(0)
1737
+ [[1], [0]]
1738
+ """
1739
+ if i == self.parent().cartan_type().special_node():
1740
+ P = self.parent()
1741
+ from sage.combinat.rigged_configurations.tensor_product_kr_tableaux import TensorProductOfKirillovReshetikhinTableaux
1742
+ K = TensorProductOfKirillovReshetikhinTableaux(P.cartan_type(), [[2, P.s()]])
1743
+ ret = K(self).to_rigged_configuration()
1744
+ RC = ret.parent()
1745
+ ret = ret.to_virtual_configuration().f(0)
1746
+ if ret is None:
1747
+ return None
1748
+ ret = RC.from_virtual(ret)
1749
+ return ret.to_tensor_product_of_kirillov_reshetikhin_tableaux()[0]
1750
+ return TensorProductOfRegularCrystalsElement.f(self, i)
1751
+
1752
+ def epsilon(self, i):
1753
+ r"""
1754
+ Compute `\varepsilon_i` of ``self``.
1755
+
1756
+ .. TODO::
1757
+
1758
+ Implement a direct action of `\epsilon_0` without moving to
1759
+ KR crystals.
1760
+
1761
+ EXAMPLES::
1762
+
1763
+ sage: KRT = crystals.KirillovReshetikhin(['D',4,3], 2, 2, model='KR')
1764
+ sage: KRT.module_generators[0].epsilon(0)
1765
+ 6
1766
+ """
1767
+ if i == self.parent().cartan_type().special_node():
1768
+ P = self.parent()
1769
+ from sage.combinat.rigged_configurations.tensor_product_kr_tableaux import TensorProductOfKirillovReshetikhinTableaux
1770
+ K = TensorProductOfKirillovReshetikhinTableaux(P.cartan_type(), [[2, P.s()]])
1771
+ rc = K(self).to_rigged_configuration().to_virtual_configuration()
1772
+ return rc.epsilon(0)
1773
+ return TensorProductOfRegularCrystalsElement.epsilon(self, i)
1774
+
1775
+ def phi(self, i):
1776
+ r"""
1777
+ Compute `\varphi_i` of ``self``.
1778
+
1779
+ .. TODO::
1780
+
1781
+ Compute `\phi_0` without moving to KR crystals.
1782
+
1783
+ EXAMPLES::
1784
+
1785
+ sage: KRT = crystals.KirillovReshetikhin(['D',4,3], 2, 2, model='KR')
1786
+ sage: KRT.module_generators[0].phi(0)
1787
+ 0
1788
+ """
1789
+ if i == self.parent().cartan_type().special_node():
1790
+ P = self.parent()
1791
+ from sage.combinat.rigged_configurations.tensor_product_kr_tableaux import TensorProductOfKirillovReshetikhinTableaux
1792
+ K = TensorProductOfKirillovReshetikhinTableaux(P.cartan_type(), [[2, P.s()]])
1793
+ rc = K(self).to_rigged_configuration().to_virtual_configuration()
1794
+ return rc.phi(0)
1795
+ return TensorProductOfRegularCrystalsElement.phi(self, i)
1796
+
1797
+
1798
+ class KRTableauxTypeFromRC(KirillovReshetikhinTableaux):
1799
+ r"""
1800
+ Kirillov-Reshetikhin tableaux `B^{r,s}` constructed from rigged
1801
+ configurations under the bijection `\Phi`.
1802
+
1803
+ .. WARNING::
1804
+
1805
+ The Kashiwara-Nakashima version is not implemented due to the
1806
+ non-trivial multiplicities of classical components, so
1807
+ :meth:`classical_decomposition` does not work.
1808
+ """
1809
+
1810
+ def __init__(self, cartan_type, r, s):
1811
+ r"""
1812
+ Initialize ``self``.
1813
+
1814
+ EXAMPLES::
1815
+
1816
+ sage: KRT = crystals.KirillovReshetikhin(['D', 4, 3], 2, 1, model='KR')
1817
+ sage: TestSuite(KRT).run() # long time
1818
+ """
1819
+ # We must modify the constructor of KirillovReshetikhinTableaux
1820
+ self._r = r
1821
+ self._s = s
1822
+ self._cartan_type = cartan_type
1823
+ Parent.__init__(self, category=KirillovReshetikhinCrystals())
1824
+ self.letters = CrystalOfLetters(cartan_type.classical())
1825
+
1826
+ @lazy_attribute
1827
+ def module_generators(self):
1828
+ """
1829
+ The module generators of ``self``.
1830
+
1831
+ EXAMPLES::
1832
+
1833
+ sage: KRT = crystals.KirillovReshetikhin(['D',4,3], 2, 1, model='KR')
1834
+ sage: KRT.module_generators
1835
+ ([[1], [2]], [[1], [0]], [[1], [E]], [[E], [E]])
1836
+ """
1837
+ return self._build_module_generators()
1838
+
1839
+ def _build_module_generators(self):
1840
+ r"""
1841
+ Return the module generators of ``self``.
1842
+
1843
+ EXAMPLES::
1844
+
1845
+ sage: KRT = crystals.KirillovReshetikhin(['D',4,3], 2, 1, model='KR')
1846
+ sage: KRT._build_module_generators()
1847
+ ([[1], [2]], [[1], [0]], [[1], [E]], [[E], [E]])
1848
+ """
1849
+ from sage.combinat.rigged_configurations.rigged_configurations import RiggedConfigurations
1850
+ RC = RiggedConfigurations(self._cartan_type, [[self._r, self._s]])
1851
+ return tuple(mg.to_tensor_product_of_kirillov_reshetikhin_tableaux()[0]
1852
+ for mg in RC.module_generators)
1853
+
1854
+ @lazy_attribute
1855
+ def _tableau_height(self):
1856
+ """
1857
+ The height of the tableaux in ``self``.
1858
+
1859
+ EXAMPLES::
1860
+
1861
+ sage: ct = CartanType(['E',6,1])
1862
+ sage: [crystals.KirillovReshetikhin(ct, r, 1, model='KR')._tableau_height
1863
+ ....: for r in ct.classical().index_set()]
1864
+ [1, 3, 2, 3, 4, 2]
1865
+ """
1866
+ if self._cartan_type.type() == 'E':
1867
+ if self._cartan_type.classical().rank() == 6:
1868
+ # 6 2 - 5
1869
+ # / /
1870
+ # 0 - 1 - 3 - 4
1871
+ if self._r == 1:
1872
+ return 1
1873
+ if self._r == [3, 6]:
1874
+ return 2
1875
+ if self._r in [2, 4]:
1876
+ return 3
1877
+ if self._r == 5:
1878
+ return 4
1879
+ if self._cartan_type.classical().rank() == 7:
1880
+ # 1-2-3
1881
+ # /
1882
+ # 0-7-6-5-4
1883
+ if self._r <= 3:
1884
+ return self._r + 1
1885
+ return 8 - self._r
1886
+ if self._cartan_type.classical().rank() == 8:
1887
+ # 1-2-3
1888
+ # /
1889
+ # 0-8-7-6-5-4
1890
+ if self._r <= 3:
1891
+ return self._r + 1
1892
+ return 9 - self._r
1893
+ if not self._cartan_type.is_untwisted_affine():
1894
+ if self._cartan_type.dual().type() == 'G':
1895
+ return self._r
1896
+ return len(self.module_generators[0]) // self._s
1897
+
1898
+ Element = KRTableauxTypeFromRCElement