passagemath-combinat 10.6.1__cp312-cp312-musllinux_1_2_aarch64.whl → 10.8.1a1__cp312-cp312-musllinux_1_2_aarch64.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 (221) hide show
  1. passagemath_combinat/__init__.py +3 -0
  2. {passagemath_combinat-10.6.1.dist-info → passagemath_combinat-10.8.1a1.dist-info}/METADATA +17 -20
  3. {passagemath_combinat-10.6.1.dist-info → passagemath_combinat-10.8.1a1.dist-info}/RECORD +220 -218
  4. {passagemath_combinat-10.6.1.dist-info → passagemath_combinat-10.8.1a1.dist-info}/WHEEL +1 -1
  5. passagemath_combinat-10.8.1a1.dist-info/top_level.txt +3 -0
  6. sage/algebras/affine_nil_temperley_lieb.py +3 -3
  7. sage/algebras/all.py +0 -1
  8. sage/algebras/askey_wilson.py +1 -1
  9. sage/algebras/associated_graded.py +2 -2
  10. sage/algebras/cellular_basis.py +3 -6
  11. sage/algebras/cluster_algebra.py +2 -3
  12. sage/algebras/down_up_algebra.py +6 -6
  13. sage/algebras/free_algebra.py +3 -32
  14. sage/algebras/free_algebra_element.py +21 -25
  15. sage/algebras/free_algebra_quotient_element.py +9 -38
  16. sage/algebras/free_zinbiel_algebra.py +4 -3
  17. sage/algebras/hall_algebra.py +2 -2
  18. sage/algebras/hecke_algebras/ariki_koike_algebra.py +8 -8
  19. sage/algebras/hecke_algebras/ariki_koike_specht_modules.py +2 -2
  20. sage/algebras/hecke_algebras/cubic_hecke_algebra.py +11 -14
  21. sage/algebras/hecke_algebras/cubic_hecke_base_ring.py +1 -1
  22. sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py +5 -5
  23. sage/algebras/iwahori_hecke_algebra.py +59 -57
  24. sage/algebras/jordan_algebra.py +97 -89
  25. sage/algebras/lie_conformal_algebras/abelian_lie_conformal_algebra.py +6 -6
  26. sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py +14 -12
  27. sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py +6 -6
  28. sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py +4 -4
  29. sage/algebras/lie_conformal_algebras/finitely_freely_generated_lca.py +13 -13
  30. sage/algebras/lie_conformal_algebras/free_bosons_lie_conformal_algebra.py +8 -6
  31. sage/algebras/lie_conformal_algebras/free_fermions_lie_conformal_algebra.py +7 -5
  32. sage/algebras/lie_conformal_algebras/freely_generated_lie_conformal_algebra.py +7 -7
  33. sage/algebras/lie_conformal_algebras/graded_lie_conformal_algebra.py +6 -5
  34. sage/algebras/lie_conformal_algebras/lie_conformal_algebra.py +12 -11
  35. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py +3 -3
  36. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_basis.py +3 -3
  37. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py +11 -11
  38. sage/algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py +3 -3
  39. sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py +8 -7
  40. sage/algebras/lie_conformal_algebras/virasoro_lie_conformal_algebra.py +9 -8
  41. sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py +6 -5
  42. sage/algebras/nil_coxeter_algebra.py +4 -4
  43. sage/algebras/q_commuting_polynomials.py +6 -6
  44. sage/algebras/q_system.py +3 -3
  45. sage/algebras/quantum_clifford.py +8 -8
  46. sage/algebras/quantum_groups/fock_space.py +48 -8
  47. sage/algebras/quantum_groups/quantum_group_gap.py +5 -7
  48. sage/algebras/quantum_matrix_coordinate_algebra.py +7 -7
  49. sage/algebras/quantum_oscillator.py +3 -3
  50. sage/algebras/quaternion_algebra_element.py +5 -3
  51. sage/algebras/schur_algebra.py +3 -3
  52. sage/algebras/shuffle_algebra.py +5 -8
  53. sage/algebras/splitting_algebra.py +129 -85
  54. sage/algebras/tensor_algebra.py +7 -7
  55. sage/algebras/yangian.py +16 -15
  56. sage/algebras/yokonuma_hecke_algebra.py +13 -11
  57. sage/combinat/all.py +9 -0
  58. sage/combinat/all__sagemath_combinat.py +1 -0
  59. sage/combinat/alternating_sign_matrix.py +36 -29
  60. sage/combinat/baxter_permutations.py +32 -12
  61. sage/combinat/bijectionist.py +13 -17
  62. sage/combinat/chas/fsym.py +6 -6
  63. sage/combinat/chas/wqsym.py +23 -29
  64. sage/combinat/colored_permutations.py +9 -11
  65. sage/combinat/colored_permutations_representations.py +13 -12
  66. sage/combinat/composition_tableau.py +2 -2
  67. sage/combinat/constellation.py +57 -30
  68. sage/combinat/crystals/affine_factorization.py +5 -4
  69. sage/combinat/crystals/alcove_path.py +2 -2
  70. sage/combinat/crystals/fully_commutative_stable_grothendieck.py +3 -2
  71. sage/combinat/crystals/infinity_crystals.py +18 -18
  72. sage/combinat/crystals/kac_modules.py +1 -1
  73. sage/combinat/crystals/kirillov_reshetikhin.py +2 -2
  74. sage/combinat/crystals/letters.cpython-312-aarch64-linux-musl.so +0 -0
  75. sage/combinat/crystals/littelmann_path.py +1 -1
  76. sage/combinat/crystals/pbw_datum.cpython-312-aarch64-linux-musl.so +0 -0
  77. sage/combinat/crystals/pbw_datum.pyx +3 -2
  78. sage/combinat/crystals/spins.cpython-312-aarch64-linux-musl.so +0 -0
  79. sage/combinat/crystals/tensor_product.py +7 -5
  80. sage/combinat/crystals/tensor_product_element.cpython-312-aarch64-linux-musl.so +0 -0
  81. sage/combinat/debruijn_sequence.cpython-312-aarch64-linux-musl.so +0 -0
  82. sage/combinat/debruijn_sequence.pyx +1 -2
  83. sage/combinat/degree_sequences.cpython-312-aarch64-linux-musl.so +0 -0
  84. sage/combinat/degree_sequences.pyx +241 -188
  85. sage/combinat/derangements.py +28 -22
  86. sage/combinat/diagram_algebras.py +12 -14
  87. sage/combinat/dyck_word.py +15 -14
  88. sage/combinat/e_one_star.py +1 -1
  89. sage/combinat/expnums.cpython-312-aarch64-linux-musl.so +0 -0
  90. sage/combinat/fast_vector_partitions.cpython-312-aarch64-linux-musl.so +0 -0
  91. sage/combinat/fqsym.py +13 -19
  92. sage/combinat/free_dendriform_algebra.py +2 -2
  93. sage/combinat/free_prelie_algebra.py +2 -2
  94. sage/combinat/fully_commutative_elements.py +8 -8
  95. sage/combinat/fully_packed_loop.py +9 -9
  96. sage/combinat/gelfand_tsetlin_patterns.py +4 -5
  97. sage/combinat/gray_codes.py +3 -4
  98. sage/combinat/grossman_larson_algebras.py +2 -2
  99. sage/combinat/growth.py +13 -13
  100. sage/combinat/hall_polynomial.py +1 -1
  101. sage/combinat/hillman_grassl.py +1 -1
  102. sage/combinat/integer_matrices.py +5 -7
  103. sage/combinat/k_tableau.py +8 -7
  104. sage/combinat/kazhdan_lusztig.py +3 -3
  105. sage/combinat/key_polynomial.py +845 -298
  106. sage/combinat/knutson_tao_puzzles.py +11 -13
  107. sage/combinat/matrices/hadamard_matrix.py +1 -1
  108. sage/combinat/matrices/latin.py +75 -92
  109. sage/combinat/misc.py +3 -3
  110. sage/combinat/multiset_partition_into_sets_ordered.py +27 -10
  111. sage/combinat/ncsf_qsym/generic_basis_code.py +5 -5
  112. sage/combinat/ncsf_qsym/ncsf.py +6 -5
  113. sage/combinat/ncsf_qsym/qsym.py +9 -17
  114. sage/combinat/ncsym/ncsym.py +8 -12
  115. sage/combinat/nu_dyck_word.py +1 -1
  116. sage/combinat/parallelogram_polyomino.py +3 -5
  117. sage/combinat/parking_functions.py +6 -5
  118. sage/combinat/partition_algebra.py +22 -57
  119. sage/combinat/partition_kleshchev.py +4 -4
  120. sage/combinat/partition_tuple.py +12 -10
  121. sage/combinat/plane_partition.py +10 -13
  122. sage/combinat/positive_integer_semigroup_test.py +17 -0
  123. sage/combinat/q_bernoulli.cpython-312-aarch64-linux-musl.so +0 -0
  124. sage/combinat/quickref.py +2 -2
  125. sage/combinat/recognizable_series.py +2 -2
  126. sage/combinat/regular_sequence.py +7 -7
  127. sage/combinat/regular_sequence_bounded.py +15 -21
  128. sage/combinat/restricted_growth.py +3 -3
  129. sage/combinat/ribbon.py +3 -3
  130. sage/combinat/rigged_configurations/bijection.py +3 -3
  131. sage/combinat/rigged_configurations/rigged_partition.cpython-312-aarch64-linux-musl.so +0 -0
  132. sage/combinat/rsk.py +2 -0
  133. sage/combinat/schubert_polynomial.py +11 -2
  134. sage/combinat/set_partition.py +3 -7
  135. sage/combinat/set_partition_iterator.cpython-312-aarch64-linux-musl.so +0 -0
  136. sage/combinat/set_partition_iterator.pyx +0 -1
  137. sage/combinat/set_partition_ordered.py +2 -2
  138. sage/combinat/sf/classical.py +1 -1
  139. sage/combinat/sf/dual.py +4 -8
  140. sage/combinat/sf/elementary.py +13 -7
  141. sage/combinat/sf/hall_littlewood.py +10 -8
  142. sage/combinat/sf/homogeneous.py +6 -3
  143. sage/combinat/sf/jack.py +11 -9
  144. sage/combinat/sf/llt.py +4 -5
  145. sage/combinat/sf/macdonald.py +10 -11
  146. sage/combinat/sf/monomial.py +6 -0
  147. sage/combinat/sf/ns_macdonald.py +92 -51
  148. sage/combinat/sf/powersum.py +9 -14
  149. sage/combinat/sf/schur.py +6 -0
  150. sage/combinat/sf/sf.py +21 -19
  151. sage/combinat/sf/sfa.py +13 -64
  152. sage/combinat/shifted_primed_tableau.py +5 -7
  153. sage/combinat/shuffle.py +1 -1
  154. sage/combinat/sine_gordon.py +18 -38
  155. sage/combinat/skew_partition.py +9 -12
  156. sage/combinat/skew_tableau.py +2 -7
  157. sage/combinat/sloane_functions.py +1 -1
  158. sage/combinat/species/all.py +67 -2
  159. sage/combinat/species/characteristic_species.py +3 -0
  160. sage/combinat/species/composition_species.py +3 -0
  161. sage/combinat/species/cycle_species.py +4 -0
  162. sage/combinat/species/empty_species.py +3 -0
  163. sage/combinat/species/functorial_composition_species.py +3 -0
  164. sage/combinat/species/generating_series.py +3 -0
  165. sage/combinat/species/library.py +3 -0
  166. sage/combinat/species/linear_order_species.py +3 -0
  167. sage/combinat/species/partition_species.py +3 -0
  168. sage/combinat/species/permutation_species.py +4 -0
  169. sage/combinat/species/product_species.py +3 -0
  170. sage/combinat/species/recursive_species.py +3 -0
  171. sage/combinat/species/set_species.py +3 -0
  172. sage/combinat/species/species.py +13 -7
  173. sage/combinat/species/structure.py +8 -9
  174. sage/combinat/species/subset_species.py +3 -0
  175. sage/combinat/species/sum_species.py +3 -0
  176. sage/combinat/subword.py +4 -1
  177. sage/combinat/subword_complex.py +7 -7
  178. sage/combinat/subword_complex_c.cpython-312-aarch64-linux-musl.so +0 -0
  179. sage/combinat/superpartition.py +1 -1
  180. sage/combinat/symmetric_group_algebra.py +9 -9
  181. sage/combinat/symmetric_group_representations.py +5 -5
  182. sage/combinat/t_sequences.py +4 -4
  183. sage/combinat/tableau.py +3 -4
  184. sage/combinat/tableau_tuple.py +2 -2
  185. sage/combinat/tiling.py +39 -42
  186. sage/combinat/triangles_FHM.py +38 -15
  187. sage/combinat/tutorial.py +2 -2
  188. sage/combinat/vector_partition.py +43 -31
  189. sage/combinat/words/abstract_word.py +4 -4
  190. sage/combinat/words/alphabet.py +12 -12
  191. sage/combinat/words/finite_word.py +25 -229
  192. sage/combinat/words/infinite_word.py +1 -1
  193. sage/combinat/words/morphic.py +13 -13
  194. sage/combinat/words/morphism.py +3 -12
  195. sage/combinat/words/paths.py +16 -17
  196. sage/combinat/words/word.py +60 -35
  197. sage/combinat/words/word_char.cpython-312-aarch64-linux-musl.so +0 -0
  198. sage/combinat/words/word_char.pyx +46 -7
  199. sage/combinat/words/word_datatypes.cpython-312-aarch64-linux-musl.so +0 -0
  200. sage/combinat/words/word_generators.py +39 -38
  201. sage/databases/findstat.py +72 -31
  202. sage/databases/oeis.py +125 -25
  203. sage/databases/sloane.py +14 -8
  204. sage/games/sudoku_backtrack.cpython-312-aarch64-linux-musl.so +0 -0
  205. sage/groups/indexed_free_group.py +3 -4
  206. sage/libs/symmetrica/symmetrica.cpython-312-aarch64-linux-musl.so +0 -0
  207. sage/libs/symmetrica/symmetrica.pxi +1 -0
  208. sage/monoids/automatic_semigroup.py +1 -3
  209. sage/monoids/free_abelian_monoid.py +7 -33
  210. sage/monoids/free_abelian_monoid_element.cpython-312-aarch64-linux-musl.so +0 -0
  211. sage/monoids/free_monoid.py +8 -40
  212. sage/monoids/free_monoid_element.py +1 -9
  213. sage/monoids/string_monoid.py +5 -2
  214. sage/monoids/string_monoid_element.py +12 -66
  215. sage/rings/all__sagemath_combinat.py +7 -0
  216. sage/sat/solvers/__init__.py +3 -4
  217. sage/sat/solvers/cryptominisat.py +2 -3
  218. sage/sat/solvers/picosat.py +2 -3
  219. sage/sat/solvers/sat_lp.py +2 -2
  220. sage/sat/solvers/satsolver.cpython-312-aarch64-linux-musl.so +0 -0
  221. passagemath_combinat-10.6.1.dist-info/top_level.txt +0 -2
sage/combinat/tiling.py CHANGED
@@ -313,36 +313,36 @@ def ncube_isometry_group(n, orientation_preserving=True):
313
313
  EXAMPLES::
314
314
 
315
315
  sage: from sage.combinat.tiling import ncube_isometry_group
316
- sage: ncube_isometry_group(2)
316
+ sage: sorted(ncube_isometry_group(2))
317
317
  [
318
- [1 0] [ 0 1] [-1 0] [ 0 -1]
319
- [0 1], [-1 0], [ 0 -1], [ 1 0]
318
+ [-1 0] [ 0 -1] [ 0 1] [1 0]
319
+ [ 0 -1], [ 1 0], [-1 0], [0 1]
320
320
  ]
321
- sage: ncube_isometry_group(2, orientation_preserving=False)
321
+ sage: sorted(ncube_isometry_group(2, orientation_preserving=False))
322
322
  [
323
- [1 0] [ 0 -1] [ 1 0] [ 0 1] [0 1] [-1 0] [ 0 -1] [-1 0]
324
- [0 1], [-1 0], [ 0 -1], [-1 0], [1 0], [ 0 -1], [ 1 0], [ 0 1]
323
+ [-1 0] [-1 0] [ 0 -1] [ 0 -1] [ 0 1] [0 1] [ 1 0] [1 0]
324
+ [ 0 -1], [ 0 1], [-1 0], [ 1 0], [-1 0], [1 0], [ 0 -1], [0 1]
325
325
  ]
326
326
 
327
327
  There are 24 orientation preserving isometries of the 3-cube::
328
328
 
329
- sage: ncube_isometry_group(3)
329
+ sage: sorted(ncube_isometry_group(3))
330
330
  [
331
- [1 0 0] [ 1 0 0] [ 1 0 0] [ 0 1 0] [0 1 0] [ 0 0 1]
332
- [0 1 0] [ 0 0 1] [ 0 0 -1] [-1 0 0] [0 0 1] [ 0 -1 0]
333
- [0 0 1], [ 0 -1 0], [ 0 1 0], [ 0 0 1], [1 0 0], [ 1 0 0],
331
+ [-1 0 0] [-1 0 0] [-1 0 0] [-1 0 0] [ 0 -1 0] [ 0 -1 0]
332
+ [ 0 -1 0] [ 0 0 -1] [ 0 0 1] [ 0 1 0] [-1 0 0] [ 0 0 -1]
333
+ [ 0 0 1], [ 0 -1 0], [ 0 1 0], [ 0 0 -1], [ 0 0 -1], [ 1 0 0],
334
334
  <BLANKLINE>
335
- [-1 0 0] [ 0 -1 0] [-1 0 0] [-1 0 0] [ 0 -1 0] [ 0 0 -1]
336
- [ 0 -1 0] [ 0 0 -1] [ 0 0 -1] [ 0 1 0] [ 0 0 1] [ 1 0 0]
337
- [ 0 0 1], [ 1 0 0], [ 0 -1 0], [ 0 0 -1], [-1 0 0], [ 0 -1 0],
335
+ [ 0 -1 0] [ 0 -1 0] [ 0 0 -1] [ 0 0 -1] [ 0 0 -1] [ 0 0 -1]
336
+ [ 0 0 1] [ 1 0 0] [-1 0 0] [ 0 -1 0] [ 0 1 0] [ 1 0 0]
337
+ [-1 0 0], [ 0 0 1], [ 0 1 0], [-1 0 0], [ 1 0 0], [ 0 -1 0],
338
338
  <BLANKLINE>
339
- [ 0 1 0] [ 0 0 1] [0 0 1] [ 0 -1 0] [ 0 0 -1] [-1 0 0]
340
- [ 1 0 0] [ 0 1 0] [1 0 0] [ 1 0 0] [ 0 1 0] [ 0 0 1]
341
- [ 0 0 -1], [-1 0 0], [0 1 0], [ 0 0 1], [ 1 0 0], [ 0 1 0],
339
+ [ 0 0 1] [ 0 0 1] [ 0 0 1] [0 0 1] [ 0 1 0] [ 0 1 0]
340
+ [-1 0 0] [ 0 -1 0] [ 0 1 0] [1 0 0] [-1 0 0] [ 0 0 -1]
341
+ [ 0 -1 0], [ 1 0 0], [-1 0 0], [0 1 0], [ 0 0 1], [-1 0 0],
342
342
  <BLANKLINE>
343
- [ 0 -1 0] [ 0 0 -1] [ 0 0 1] [ 1 0 0] [ 0 0 -1] [ 0 1 0]
344
- [-1 0 0] [-1 0 0] [-1 0 0] [ 0 -1 0] [ 0 -1 0] [ 0 0 -1]
345
- [ 0 0 -1], [ 0 1 0], [ 0 -1 0], [ 0 0 -1], [-1 0 0], [-1 0 0]
343
+ [0 1 0] [ 0 1 0] [ 1 0 0] [ 1 0 0] [ 1 0 0] [1 0 0]
344
+ [0 0 1] [ 1 0 0] [ 0 -1 0] [ 0 0 -1] [ 0 0 1] [0 1 0]
345
+ [1 0 0], [ 0 0 -1], [ 0 0 -1], [ 0 1 0], [ 0 -1 0], [0 0 1]
346
346
  ]
347
347
 
348
348
  TESTS::
@@ -1067,9 +1067,8 @@ class Polyomino(SageObject):
1067
1067
  minxyz, maxxyz = vector(minxyz), vector(maxxyz)
1068
1068
  size = maxxyz - minxyz
1069
1069
  boxminxyz, boxmaxxyz = box.bounding_box()
1070
- ranges = [range(a, b-c+1) for (a,b,c) in zip(boxminxyz,
1071
- boxmaxxyz,
1072
- size)]
1070
+ ranges = [range(a, b - c + 1)
1071
+ for a, b, c in zip(boxminxyz, boxmaxxyz, size)]
1073
1072
  cano = self.canonical()
1074
1073
  for v in itertools.product(*ranges):
1075
1074
  translated = cano + v
@@ -1121,9 +1120,8 @@ class Polyomino(SageObject):
1121
1120
  minxyz, maxxyz = vector(minxyz), vector(maxxyz)
1122
1121
  size = maxxyz - minxyz
1123
1122
  boxminxyz, boxmaxxyz = box.bounding_box()
1124
- ranges = [range(a-c, b+1) for (a,b,c) in zip(boxminxyz,
1125
- boxmaxxyz,
1126
- size)]
1123
+ ranges = [range(a - c, b + 1)
1124
+ for a, b, c in zip(boxminxyz, boxmaxxyz, size)]
1127
1125
  S = set()
1128
1126
  cano = self.canonical()
1129
1127
  for v in itertools.product(*ranges):
@@ -1134,7 +1132,7 @@ class Polyomino(SageObject):
1134
1132
  return S
1135
1133
 
1136
1134
  def isometric_copies(self, box, orientation_preserving=True,
1137
- mod_box_isometries=False):
1135
+ mod_box_isometries=False):
1138
1136
  r"""
1139
1137
  Return the translated and isometric images of ``self`` that lies in the box.
1140
1138
 
@@ -1453,6 +1451,7 @@ class Polyomino(SageObject):
1453
1451
 
1454
1452
  ::
1455
1453
 
1454
+ sage: # long time
1456
1455
  sage: solution = H.self_surrounding(8, remove_incomplete_copies=False) # needs sage.plot
1457
1456
  sage: G = sum([p.show2d() for p in solution], Graphics()) # needs sage.plot
1458
1457
  """
@@ -1605,7 +1604,7 @@ class TilingSolver(SageObject):
1605
1604
  self._reusable = reusable
1606
1605
  self._outside = outside
1607
1606
 
1608
- def _repr_(self):
1607
+ def _repr_(self) -> str:
1609
1608
  r"""
1610
1609
  String representation.
1611
1610
 
@@ -1628,7 +1627,7 @@ class TilingSolver(SageObject):
1628
1627
  s += "Reusing pieces allowed: %s" % self._reusable
1629
1628
  return s
1630
1629
 
1631
- def is_suitable(self):
1630
+ def is_suitable(self) -> bool:
1632
1631
  r"""
1633
1632
  Return whether the volume of the box is equal to sum of the volume
1634
1633
  of the polyominoes and the number of rows sent to the DLX solver is
@@ -2410,23 +2409,21 @@ class TilingSolver(SageObject):
2410
2409
  sage: a = T.animate('incremental', stop=13); a # not tested # needs sage.plot
2411
2410
  Animation with 13 frames
2412
2411
  """
2412
+ from sage.plot.graphics import Graphics
2413
+ from sage.plot.animate import Animation
2413
2414
  dimension = self._box._dimension
2414
2415
  if dimension == 2:
2415
- from sage.plot.graphics import Graphics
2416
- from sage.plot.animate import Animation
2417
2416
  it = self.solve(partial=partial)
2418
2417
  it = itertools.islice(it, stop)
2419
- L = [sum([piece.show2d(size)
2420
- for piece in solution], Graphics()) for solution in it]
2421
- (xmin,ymin), (xmax,ymax) = self._box.bounding_box()
2422
- xmax = xmax+0.5
2423
- ymax = ymax+0.5
2424
- a = Animation(L, xmin=xmin-0.5, ymin=ymin-0.5,
2425
- xmax=xmax, ymax=ymax, aspect_ratio=1, axes=axes)
2426
- return a
2427
- elif dimension == 3:
2418
+ L = [sum([piece.show2d(size) for piece in solution], Graphics())
2419
+ for solution in it]
2420
+ (xmin, ymin), (xmax, ymax) = self._box.bounding_box()
2421
+ xmax = xmax + 0.5
2422
+ ymax = ymax + 0.5
2423
+ return Animation(L, xmin=xmin - 0.5, ymin=ymin - 0.5,
2424
+ xmax=xmax, ymax=ymax, aspect_ratio=1, axes=axes)
2425
+ if dimension == 3:
2428
2426
  raise NotImplementedError("3d Animation must be implemented "
2429
2427
  "in Jmol first")
2430
- else:
2431
- raise NotImplementedError("Dimension must be 2 or 3 in order "
2432
- "to make an animation")
2428
+ raise NotImplementedError("Dimension must be 2 or 3 in order "
2429
+ "to make an animation")
@@ -1,4 +1,5 @@
1
1
  # sage_setup: distribution = sagemath-combinat
2
+ # sage.doctest: known bug: windows (hangs)
2
3
  """
3
4
  Combinatorial triangles for posets and fans
4
5
 
@@ -47,6 +48,8 @@ The Gamma-triangles are related to the H-triangles by an
47
48
  analog of the relationship between gamma-vectors and h-vectors of flag
48
49
  simplicial complexes.
49
50
  """
51
+ from __future__ import annotations
52
+
50
53
  from sage.misc.lazy_import import lazy_import
51
54
  from sage.rings.integer_ring import ZZ
52
55
  from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
@@ -133,7 +136,7 @@ class Triangle(SageObject):
133
136
  ⎝1 4⎠
134
137
  """
135
138
 
136
- def __init__(self, poly, variables=None):
139
+ def __init__(self, poly, variables=None) -> None:
137
140
  """
138
141
  EXAMPLES::
139
142
 
@@ -195,7 +198,7 @@ class Triangle(SageObject):
195
198
  """
196
199
  return self._prefix + ": " + repr(self._poly)
197
200
 
198
- def _latex_(self):
201
+ def _latex_(self) -> str:
199
202
  r"""
200
203
  Return the LaTeX representation (as a matrix).
201
204
 
@@ -276,7 +279,7 @@ class Triangle(SageObject):
276
279
  """
277
280
  return self._poly.__getitem__(*args)
278
281
 
279
- def __hash__(self):
282
+ def __hash__(self) -> int:
280
283
  """
281
284
  Return the hash value.
282
285
 
@@ -344,6 +347,26 @@ class Triangle(SageObject):
344
347
  p = p.truncate(v, d)
345
348
  return self.__class__(p, self._vars)
346
349
 
350
+ def factor(self) -> list:
351
+ """
352
+ Return the decomposition of ``self`` as a product.
353
+
354
+ This is defined by factoring the underlying polynomial.
355
+
356
+ EXAMPLES::
357
+
358
+ sage: from sage.combinat.triangles_FHM import M_triangle
359
+ sage: x, y = polygens(ZZ, 'x,y')
360
+ sage: p = 3*x^3*y^3 - 7*x^2*y^3 + 5*x^2*y^2
361
+ sage: p += 5*x*y^3 - 8*x*y^2 - y^3 + 3*x*y + 3*y^2 - 3*y + 1
362
+ sage: m = M_triangle(p)
363
+ sage: m.factor()
364
+ [M: x*y - y + 1, M: 3*x^2*y^2 - 4*x*y^2 + 2*x*y + y^2 - 2*y + 1]
365
+ """
366
+ p = self._poly
367
+ return [self.__class__(fac, self._vars)
368
+ for fac, exp in p.factor() for _ in range(exp)]
369
+
347
370
 
348
371
  class M_triangle(Triangle):
349
372
  """
@@ -360,7 +383,7 @@ class M_triangle(Triangle):
360
383
  """
361
384
  _prefix = 'M'
362
385
 
363
- def dual(self):
386
+ def dual(self) -> M_triangle:
364
387
  """
365
388
  Return the dual M-triangle.
366
389
 
@@ -385,7 +408,7 @@ class M_triangle(Triangle):
385
408
  for (dx, dy), coeff in self._poly.monomial_coefficients().items()}
386
409
  return M_triangle(A(dict_dual), variables=(x, y))
387
410
 
388
- def transmute(self):
411
+ def transmute(self) -> M_triangle:
389
412
  """
390
413
  Return the image of ``self`` by an involution.
391
414
 
@@ -407,7 +430,7 @@ class M_triangle(Triangle):
407
430
  """
408
431
  return self.h().transpose().m()
409
432
 
410
- def h(self):
433
+ def h(self) -> H_triangle:
411
434
  """
412
435
  Return the associated H-triangle.
413
436
 
@@ -434,7 +457,7 @@ class M_triangle(Triangle):
434
457
  polyh = step.numerator()
435
458
  return H_triangle(polyh, variables=(x, y))
436
459
 
437
- def f(self):
460
+ def f(self) -> F_triangle:
438
461
  """
439
462
  Return the associated F-triangle.
440
463
 
@@ -462,7 +485,7 @@ class H_triangle(Triangle):
462
485
  """
463
486
  _prefix = 'H'
464
487
 
465
- def transpose(self):
488
+ def transpose(self) -> H_triangle:
466
489
  """
467
490
  Return the transposed H-triangle.
468
491
 
@@ -489,7 +512,7 @@ class H_triangle(Triangle):
489
512
  for (dx, dy), coeff in self._poly.monomial_coefficients().items()}
490
513
  return H_triangle(A(dict_dual), variables=(x, y))
491
514
 
492
- def m(self):
515
+ def m(self) -> M_triangle:
493
516
  """
494
517
  Return the associated M-triangle.
495
518
 
@@ -510,7 +533,7 @@ class H_triangle(Triangle):
510
533
  polym = step.numerator()
511
534
  return M_triangle(polym, variables=(x, y))
512
535
 
513
- def f(self):
536
+ def f(self) -> F_triangle:
514
537
  """
515
538
  Return the associated F-triangle.
516
539
 
@@ -544,7 +567,7 @@ class H_triangle(Triangle):
544
567
  polyf = step2.numerator()
545
568
  return F_triangle(polyf, variables=(x, y))
546
569
 
547
- def gamma(self):
570
+ def gamma(self) -> Gamma_triangle:
548
571
  """
549
572
  Return the associated Gamma-triangle.
550
573
 
@@ -599,7 +622,7 @@ class F_triangle(Triangle):
599
622
  """
600
623
  _prefix = 'F'
601
624
 
602
- def h(self):
625
+ def h(self) -> H_triangle:
603
626
  """
604
627
  Return the associated H-triangle.
605
628
 
@@ -626,7 +649,7 @@ class F_triangle(Triangle):
626
649
  polyh = step.numerator()
627
650
  return H_triangle(polyh, variables=(x, y))
628
651
 
629
- def m(self):
652
+ def m(self) -> M_triangle:
630
653
  """
631
654
  Return the associated M-triangle.
632
655
 
@@ -673,7 +696,7 @@ class F_triangle(Triangle):
673
696
  polym = step.numerator()
674
697
  return M_triangle(polym, variables=(x, y))
675
698
 
676
- def parabolic(self):
699
+ def parabolic(self) -> F_triangle:
677
700
  """
678
701
  Return a parabolic version of the F-triangle.
679
702
 
@@ -726,7 +749,7 @@ class Gamma_triangle(Triangle):
726
749
  """
727
750
  _prefix = 'Γ'
728
751
 
729
- def h(self):
752
+ def h(self) -> H_triangle:
730
753
  r"""
731
754
  Return the associated H-triangle.
732
755
 
sage/combinat/tutorial.py CHANGED
@@ -141,7 +141,7 @@ We will now attempt a little numerical simulation. The following
141
141
  function tests whether a given hand is a flush or not::
142
142
 
143
143
  sage: def is_flush(hand):
144
- ....: return len(set(suit for (val, suit) in hand)) == 1
144
+ ....: return len(set(suit for val, suit in hand)) == 1
145
145
 
146
146
  We now draw 10000 hands at random, and count the number of flushes
147
147
  obtained (this takes about 10 seconds)::
@@ -1636,7 +1636,7 @@ iterator or non-naive counting::
1636
1636
  M(4, 2, 3),
1637
1637
  M(5, 2, 3)
1638
1638
  in 3-d lattice M
1639
- sage: L.npoints() # random # needs palp
1639
+ sage: L.n_points() # random # needs palp
1640
1640
  11
1641
1641
 
1642
1642
  This polytope can be visualized in 3D with ``L.plot3d()`` (see
@@ -21,7 +21,7 @@ AUTHORS:
21
21
  #
22
22
  # The full text of the GPL is available at:
23
23
  #
24
- # http://www.gnu.org/licenses/
24
+ # https://www.gnu.org/licenses/
25
25
  # ****************************************************************************
26
26
 
27
27
  from sage.structure.parent import Parent
@@ -31,9 +31,9 @@ from sage.combinat.combinat import CombinatorialElement
31
31
  from sage.combinat.partition import Partition
32
32
 
33
33
 
34
- def find_min(vect):
34
+ def find_min(vect) -> list[int]:
35
35
  """
36
- Return a string of ``0``'s with one ``1`` at the location where the list
36
+ Return a list of ``0``'s with one ``1`` at the location where the list
37
37
  ``vect`` has its last entry which is not equal to ``0``.
38
38
 
39
39
  INPUT:
@@ -52,13 +52,20 @@ def find_min(vect):
52
52
  [0, 1]
53
53
  sage: find_min([2, 1, 0])
54
54
  [0, 1, 0]
55
+
56
+ TESTS::
57
+
58
+ sage: find_min([])
59
+ []
60
+ sage: find_min([0,0])
61
+ [0, 0]
55
62
  """
56
63
  i = len(vect)
57
- while vect[i-1] == 0 and i > 0:
58
- i = i-1
59
- min = [0]*len(vect)
60
- if i > 0:
61
- min[i-1] = 1
64
+ min = [0] * i
65
+ while i > 0 and vect[i - 1] == 0:
66
+ i -= 1
67
+ if i:
68
+ min[i - 1] = 1
62
69
  return min
63
70
 
64
71
 
@@ -91,17 +98,18 @@ def IntegerVectorsIterator(vect, min=None):
91
98
  vect = list(vect)
92
99
  if not vect:
93
100
  yield []
94
- else:
95
- if min is None:
96
- min = [0] * len(vect)
97
- if vect < min:
98
- return
99
- else:
100
- for vec in IntegerVectorsIterator(vect[1:], min=min[1:]):
101
- yield [min[0]] + vec
102
- for j in range(min[0] + 1, vect[0] + 1):
103
- for vec in IntegerVectorsIterator(vect[1:]):
104
- yield [j] + vec
101
+ return
102
+
103
+ if min is None:
104
+ min = [0] * len(vect)
105
+ if vect < min:
106
+ return
107
+
108
+ for vec in IntegerVectorsIterator(vect[1:], min=min[1:]):
109
+ yield [min[0]] + vec
110
+ for j in range(min[0] + 1, vect[0] + 1):
111
+ for vec in IntegerVectorsIterator(vect[1:]):
112
+ yield [j] + vec
105
113
 
106
114
 
107
115
  class VectorPartition(CombinatorialElement):
@@ -129,7 +137,7 @@ class VectorPartition(CombinatorialElement):
129
137
  P = VectorPartitions(vec)
130
138
  return P(vecpar)
131
139
 
132
- def __init__(self, parent, vecpar):
140
+ def __init__(self, parent, vecpar) -> None:
133
141
  """
134
142
  Initialize ``self``.
135
143
 
@@ -140,7 +148,7 @@ class VectorPartition(CombinatorialElement):
140
148
  """
141
149
  CombinatorialElement.__init__(self, parent, sorted(vecpar))
142
150
 
143
- def sum(self):
151
+ def sum(self) -> list:
144
152
  """
145
153
  Return the sum vector as a list.
146
154
 
@@ -260,17 +268,20 @@ class VectorPartitions(UniqueRepresentation, Parent):
260
268
  min = find_min(vec) # tuple([0 for v in vec[:-1]]+[1])
261
269
  if parts is None:
262
270
  parts = list(IntegerVectorsIterator(vec, min=min))
263
- if [0]*len(vec) in parts:
264
- parts.remove([0]*len(vec))
271
+ full_zero = [0] * len(vec)
272
+ if full_zero in parts:
273
+ parts.remove(full_zero)
265
274
  if min in parts:
266
275
  min_index = parts.index(min)
267
276
  parts = parts[min_index:]
268
277
  parts = list(parts)
269
278
  for part_index in range(len(parts)):
270
279
  parts[part_index] = tuple(parts[part_index])
271
- return super().__classcall__(cls, tuple(vec), tuple(min), tuple(parts), distinct, is_repeatable)
280
+ return super().__classcall__(cls, tuple(vec), tuple(min), tuple(parts),
281
+ distinct, is_repeatable)
272
282
 
273
- def __init__(self, vec, min=None, parts=None, distinct=False, is_repeatable=None):
283
+ def __init__(self, vec, min=None, parts=None, distinct=False,
284
+ is_repeatable=None) -> None:
274
285
  r"""
275
286
  Initialize ``self``.
276
287
 
@@ -313,25 +324,26 @@ class VectorPartitions(UniqueRepresentation, Parent):
313
324
  9
314
325
  """
315
326
  if all(coord == 0 for coord in self._vec):
316
- yield self.element_class(self, []) # the zero vector has only the empty partition
327
+ yield self.element_class(self, []) # the zero vector has only the empty partition
317
328
  else:
318
- for part in self._parts: # choose the first part
329
+ for part in self._parts: # choose the first part
319
330
  if tuple(part) == self._vec:
320
331
  yield self.element_class(self, [list(part)])
321
332
  elif any(part[i] > self._vec[i] for i in range(len(self._vec))):
322
333
  pass
323
- else:# recursively find all possibilities for the rest of the vector partition
324
- new_vec = tuple(self._vec[i]-part[i] for i in range(len(self._vec)))
334
+ else: # recursively find all possibilities for the rest of the vector partition
335
+ new_vec = tuple(self._vec[i] - part[i]
336
+ for i in range(len(self._vec)))
325
337
  i = self._parts.index(part)
326
338
  if self._is_repeatable is None:
327
339
  if self._distinct:
328
- new_parts = self._parts[i+1:]
340
+ new_parts = self._parts[i + 1:]
329
341
  else:
330
342
  new_parts = self._parts[i:]
331
343
  else:
332
344
  if self._is_repeatable(part):
333
345
  new_parts = self._parts[i:]
334
346
  else:
335
- new_parts = self._parts[i+1:]
347
+ new_parts = self._parts[i + 1:]
336
348
  for vecpar in VectorPartitions(new_vec, min=self._min, parts=new_parts, distinct=self._distinct, is_repeatable=self._is_repeatable):
337
349
  yield self.element_class(self, [list(part)] + list(vecpar))
@@ -1618,9 +1618,9 @@ class Word_class(SageObject):
1618
1618
  [0, 2, 8]
1619
1619
  """
1620
1620
  if fact.is_empty():
1621
- raise NotImplementedError("The factor must be non empty")
1621
+ raise NotImplementedError("the factor must be non empty")
1622
1622
  if not fact.is_finite():
1623
- raise ValueError("The factor must be finite")
1623
+ raise ValueError("the factor must be finite")
1624
1624
  p = self.first_occurrence(fact, start=0)
1625
1625
  while p is not None:
1626
1626
  yield p
@@ -1629,7 +1629,7 @@ class Word_class(SageObject):
1629
1629
  def return_words_iterator(self, fact):
1630
1630
  r"""
1631
1631
  Return an iterator over all the return words of fact in self
1632
- (without unicity).
1632
+ (without uniqueness).
1633
1633
 
1634
1634
  INPUT:
1635
1635
 
@@ -1675,7 +1675,7 @@ class Word_class(SageObject):
1675
1675
  def complete_return_words_iterator(self, fact):
1676
1676
  r"""
1677
1677
  Return an iterator over all the complete return words of fact in
1678
- ``self`` (without unicity).
1678
+ ``self`` (without uniqueness).
1679
1679
 
1680
1680
  A complete return words `u` of a factor `v` is a factor starting
1681
1681
  by the given factor `v` and ending just after the next occurrence
@@ -29,7 +29,7 @@ EXAMPLES::
29
29
  # it under the terms of the GNU General Public License as published by
30
30
  # the Free Software Foundation, either version 2 of the License, or
31
31
  # (at your option) any later version.
32
- # http://www.gnu.org/licenses/
32
+ # https://www.gnu.org/licenses/
33
33
  # ****************************************************************************
34
34
 
35
35
  import collections.abc
@@ -43,17 +43,17 @@ from sage.sets.totally_ordered_finite_set import TotallyOrderedFiniteSet
43
43
 
44
44
 
45
45
  set_of_letters = {
46
- 'lower' : "abcdefghijklmnopqrstuvwxyz",
47
- 'upper' : "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
48
- 'space' : " ",
49
- 'underscore' : "_",
50
- 'punctuation' : " ,.;:!?",
51
- 'printable' : "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",
52
- 'binary' : "01",
53
- 'octal' : "01234567",
54
- 'decimal' : "0123456789",
55
- 'hexadecimal' : "0123456789abcdef",
56
- 'radix64' : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"}
46
+ 'lower': "abcdefghijklmnopqrstuvwxyz",
47
+ 'upper': "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
48
+ 'space': " ",
49
+ 'underscore': "_",
50
+ 'punctuation': " ,.;:!?",
51
+ 'printable': "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",
52
+ 'binary': "01",
53
+ 'octal': "01234567",
54
+ 'decimal': "0123456789",
55
+ 'hexadecimal': "0123456789abcdef",
56
+ 'radix64': "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"}
57
57
 
58
58
 
59
59
  def build_alphabet(data=None, names=None, name=None):