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
@@ -943,7 +943,7 @@ class PartitionTuple(CombinatorialElement):
943
943
  sage: PartitionTuple([[2,1],[1],[1,1,1]]).cells()
944
944
  [(0, 0, 0), (0, 0, 1), (0, 1, 0), (1, 0, 0), (2, 0, 0), (2, 1, 0), (2, 2, 0)]
945
945
  """
946
- return [(c,a,b) for c in range(len(self)) for (a,b) in self[c].cells()]
946
+ return [(c, a, b) for c in range(len(self)) for a, b in self[c].cells()]
947
947
 
948
948
  def content(self, k, r, c, multicharge):
949
949
  r"""
@@ -1177,9 +1177,9 @@ class PartitionTuple(CombinatorialElement):
1177
1177
  - :meth:`top_garnir_tableau`
1178
1178
  """
1179
1179
  try:
1180
- (comp, row,col) = cell
1180
+ comp, row, col = cell
1181
1181
  except ValueError:
1182
- (comp, row,col) = cell[0]
1182
+ comp, row, col = cell[0]
1183
1183
 
1184
1184
  if comp >= len(self) or row+1 >= len(self[comp]) or col >= self[comp][row+1]:
1185
1185
  raise ValueError('(comp, row+1, col) must be inside the diagram')
@@ -1246,7 +1246,7 @@ class PartitionTuple(CombinatorialElement):
1246
1246
 
1247
1247
  - :meth:`~sage.combinat.partition.Partition_tuple.garnir_tableau`
1248
1248
  """
1249
- (comp,row,col) = cell
1249
+ comp, row, col = cell
1250
1250
  if comp >= len(self) or row+1 >= len(self[comp]) or col >= self[comp][row+1]:
1251
1251
  raise ValueError('(comp, row+1, col) must be inside the diagram')
1252
1252
 
@@ -1393,7 +1393,8 @@ class PartitionTuple(CombinatorialElement):
1393
1393
  sage: PartitionTuple([[1,1],[4,3],[2,1,1]]).removable_cells()
1394
1394
  [(0, 1, 0), (1, 0, 3), (1, 1, 2), (2, 0, 1), (2, 2, 0)]
1395
1395
  """
1396
- return [(k,r,c) for k in range(len(self)) for (r,c) in self[k].removable_cells()]
1396
+ return [(k, r, c) for k in range(len(self))
1397
+ for r, c in self[k].removable_cells()]
1397
1398
 
1398
1399
  corners = removable_cells # for compatibility with partitions
1399
1400
 
@@ -1411,7 +1412,8 @@ class PartitionTuple(CombinatorialElement):
1411
1412
  sage: PartitionTuple([[1,1],[4,3],[2,1,1]]).addable_cells()
1412
1413
  [(0, 0, 1), (0, 2, 0), (1, 0, 4), (1, 1, 3), (1, 2, 0), (2, 0, 2), (2, 1, 1), (2, 3, 0)]
1413
1414
  """
1414
- return [(k,r,c) for k in range(len(self)) for (r,c) in self[k].addable_cells()]
1415
+ return [(k, r, c) for k in range(len(self))
1416
+ for r, c in self[k].addable_cells()]
1415
1417
 
1416
1418
  outside_corners = addable_cells # for compatibility with partitions
1417
1419
 
@@ -1537,9 +1539,9 @@ class PartitionTuple(CombinatorialElement):
1537
1539
  deg = sum(mu._initial_degree(e) for mu in self)
1538
1540
  I = IntegerModRing(e)
1539
1541
  multires = [I(k) for k in multicharge]
1540
- for (k,r,c) in self.cells():
1541
- res = I(multicharge[k]-r+c)
1542
- for l in range(k+1, self.level()):
1542
+ for k, r, c in self.cells():
1543
+ res = I(multicharge[k] - r + c)
1544
+ for l in range(k + 1, self.level()):
1543
1545
  if res == multires[l]:
1544
1546
  deg += 1
1545
1547
  return deg
@@ -1696,7 +1698,7 @@ class PartitionTuple(CombinatorialElement):
1696
1698
  """
1697
1699
  block = {}
1698
1700
  Ie = IntegerModRing(e)
1699
- for (k,r,c) in self.cells():
1701
+ for k, r, c in self.cells():
1700
1702
  i = Ie(multicharge[k] + c - r)
1701
1703
  block[i] = block.get(i, 0) + 1
1702
1704
  return block
@@ -26,8 +26,7 @@ AUTHORS:
26
26
  # ****************************************************************************
27
27
 
28
28
  from __future__ import annotations
29
- from typing import NewType
30
- from collections.abc import Iterator
29
+ from typing import NewType, TYPE_CHECKING
31
30
 
32
31
  from sage.structure.richcmp import richcmp, richcmp_method
33
32
  from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets
@@ -45,6 +44,9 @@ from sage.sets.disjoint_union_enumerated_sets import DisjointUnionEnumeratedSets
45
44
  from sage.sets.family import Family
46
45
  from sage.sets.non_negative_integers import NonNegativeIntegers
47
46
 
47
+ if TYPE_CHECKING:
48
+ from collections.abc import Iterator
49
+
48
50
  lazy_import('sage.modules.free_module_element', 'vector')
49
51
 
50
52
 
@@ -140,7 +142,7 @@ class PlanePartition(ClonableArray,
140
142
  self._max_y = 0
141
143
  self._max_z = 0
142
144
  else:
143
- (self._max_x, self._max_y, self._max_z) = self.parent()._box
145
+ self._max_x, self._max_y, self._max_z = self.parent()._box
144
146
 
145
147
  def __richcmp__(self, other, op):
146
148
  r"""
@@ -913,9 +915,7 @@ class PlanePartition(ClonableArray,
913
915
  sage: PlanePartition([]).is_CSPP()
914
916
  True
915
917
  """
916
- if self.z_tableau() == self.y_tableau():
917
- return True
918
- return False
918
+ return self.z_tableau() == self.y_tableau()
919
919
 
920
920
  def is_TSPP(self) -> bool:
921
921
  r"""
@@ -1101,17 +1101,14 @@ class PlanePartition(ClonableArray,
1101
1101
  [(0, 0, 0), (0, 0, 1), (0, 1, 0), (1, 0, 0), (2, 0, 0)]
1102
1102
  """
1103
1103
  from sage.combinat.posets.poset_examples import posets
1104
- (a, b, c) = (self._max_x, self._max_y, self._max_z)
1105
- Q = posets.ProductOfChains([a, b, c])
1106
- count = 0
1104
+ abc = [self._max_x, self._max_y, self._max_z]
1105
+ Q = posets.ProductOfChains(abc)
1107
1106
  generate = []
1108
1107
  for i, row in enumerate(self):
1109
1108
  for j, val in enumerate(row):
1110
1109
  if val > 0:
1111
- generate.append((i, j, val-1))
1112
- count += 1
1113
- oi = Q.order_ideal(generate)
1114
- return oi
1110
+ generate.append((i, j, val - 1))
1111
+ return Q.order_ideal(generate)
1115
1112
 
1116
1113
  def maximal_boxes(self) -> list:
1117
1114
  r"""
@@ -0,0 +1,17 @@
1
+ # sage_setup: distribution = sagemath-combinat
2
+ import pytest
3
+
4
+
5
+ def test_positive_integer_semigroup():
6
+ r"""
7
+ Run the ``TestSuite()`` for ``PositiveIntegerSemigroup``
8
+ (this can take quite a long time).
9
+ """
10
+ from sage.misc.sage_unittest import TestSuite
11
+ from sage.combinat.backtrack import PositiveIntegerSemigroup
12
+ PP = PositiveIntegerSemigroup()
13
+
14
+ # fewer max_runs since these are kind of slow
15
+ TestSuite(PP).run(verbose=True,
16
+ raise_on_failure=True,
17
+ max_runs=256)
sage/combinat/quickref.py CHANGED
@@ -30,7 +30,7 @@ Combinatorial objects::
30
30
 
31
31
  Constructions and Species::
32
32
 
33
- sage: for (p, s) in cartesian_product([P,S]): print((p, s)) # not tested
33
+ sage: for ps in cartesian_product([P,S]): print(ps) # not tested
34
34
  sage: def IV_3(n):
35
35
  ....: return IntegerVectors(n, 3)
36
36
  sage: DisjointUnionEnumeratedSets(Family(IV_3, NonNegativeIntegers)) # not tested
@@ -49,7 +49,7 @@ Polytopes::
49
49
 
50
50
  sage: points = random_matrix(ZZ, 6, 3, x=7).rows() # needs sage.modules
51
51
  sage: L = LatticePolytope(points) # needs sage.geometry.polyhedron sage.modules
52
- sage: L.npoints(); L.plot3d() # random # needs palp sage.geometry.polyhedron sage.modules sage.plot
52
+ sage: L.n_points(); L.plot3d() # random # needs palp sage.geometry.polyhedron sage.modules sage.plot
53
53
 
54
54
  :ref:`Root systems, Coxeter and Weyl groups <sage.combinat.root_system.all>`::
55
55
 
@@ -1843,8 +1843,8 @@ class RecognizableSeriesSpace(UniqueRepresentation, Parent):
1843
1843
  z = self.coefficient_ring().zero()
1844
1844
  o = self.coefficient_ring().one()
1845
1845
  e = self.coefficient_ring().an_element()
1846
- return self(list(Matrix([[o, z], [i * o, o]])
1847
- for i, _ in enumerate(self.alphabet())),
1846
+ return self([Matrix([[o, z], [i * o, o]])
1847
+ for i, _ in enumerate(self.alphabet())],
1848
1848
  vector([z, e]), right=vector([e, z]))
1849
1849
 
1850
1850
  def some_elements(self, **kwds):
@@ -333,7 +333,7 @@ class RegularSequence(RecognizableSeries):
333
333
  return iter(self[n] for n in count())
334
334
 
335
335
  @cached_method
336
- def is_degenerated(self):
336
+ def is_degenerated(self) -> bool:
337
337
  r"""
338
338
  Return whether this `k`-regular sequence is degenerated,
339
339
  i.e., whether this `k`-regular sequence does not satisfy
@@ -364,7 +364,7 @@ class RegularSequence(RecognizableSeries):
364
364
  False
365
365
  """
366
366
  from sage.rings.integer_ring import ZZ
367
- return (self.mu[ZZ(0)] * self.right) != self.right
367
+ return (self.mu[ZZ.zero()] * self.right) != self.right
368
368
 
369
369
  def _error_if_degenerated_(self):
370
370
  r"""
@@ -1101,10 +1101,10 @@ class RegularSequence(RecognizableSeries):
1101
1101
  Z = zero_matrix(C[0].dimensions()[0])
1102
1102
 
1103
1103
  def blocks(r):
1104
- upper = list([C[s], D[s], Z]
1105
- for s in reversed(srange(max(0, r-2), r+1)))
1106
- lower = list([Z, C[s], D[s]]
1107
- for s in reversed(srange(k-3+len(upper), k)))
1104
+ upper = [[C[s], D[s], Z]
1105
+ for s in reversed(srange(max(0, r-2), r+1))]
1106
+ lower = [[Z, C[s], D[s]]
1107
+ for s in reversed(srange(k-3+len(upper), k))]
1108
1108
  return upper + lower
1109
1109
 
1110
1110
  return {r: Matrix.block(blocks(r)) for r in P.alphabet()}
@@ -1281,7 +1281,7 @@ class RegularSequence(RecognizableSeries):
1281
1281
  return result
1282
1282
 
1283
1283
  @cached_method
1284
- def is_bounded(self):
1284
+ def is_bounded(self) -> bool:
1285
1285
  r"""
1286
1286
  Return whether this `k`-regular sequence is bounded.
1287
1287
 
@@ -28,15 +28,15 @@ ACKNOWLEDGEMENT:
28
28
  - Gabriel Lipnik is supported by the
29
29
  Austrian Science Fund (FWF): P 24644-N26.
30
30
  """
31
- #*****************************************************************************
31
+ # ***************************************************************************
32
32
  # Copyright (C) 2017 Gabriel Lipnik <devel@gabriellipnik.at>
33
33
  #
34
34
  # This program is free software: You can redistribute it and/or modify
35
35
  # it under the terms of the GNU General Public License as published by
36
36
  # the Free Software Foundation, either version 3 of the License, or
37
37
  # (at your option) any later version.
38
- # http://www.gnu.org/licenses/
39
- #*****************************************************************************
38
+ # https://www.gnu.org/licenses/
39
+ # ***************************************************************************
40
40
 
41
41
 
42
42
  def multiply_reduce(A, B):
@@ -77,7 +77,7 @@ def multiply_reduce(A, B):
77
77
  [ -8 -14 -20]
78
78
  [ 2 2 2]
79
79
  """
80
- return (A*B).apply_map(lambda m: min(m, 2))
80
+ return (A * B).apply_map(lambda m: min(m, 2))
81
81
 
82
82
 
83
83
  def construct_phi(matrices):
@@ -146,7 +146,6 @@ def construct_phi(matrices):
146
146
  [2 2 2], [0 2 0], [0 2 2], [1 1 2], [2 0 0], [2 2 2], [1 2 2]
147
147
  ]
148
148
  """
149
- from sage.arith.srange import srange
150
149
  length = len(matrices)
151
150
 
152
151
  def get_immutable(M):
@@ -163,7 +162,7 @@ def construct_phi(matrices):
163
162
  raise RuntimeError('Phi too large.')
164
163
 
165
164
 
166
- def is_integer_valued(matrices):
165
+ def is_integer_valued(matrices) -> bool:
167
166
  r"""
168
167
  Return whether every matrix in ``matrices`` is integer-valued.
169
168
 
@@ -206,7 +205,7 @@ def is_integer_valued(matrices):
206
205
  return all(mat in M for mat in matrices)
207
206
 
208
207
 
209
- def is_non_negative(matrices):
208
+ def is_non_negative(matrices) -> bool:
210
209
  r"""
211
210
  Return whether every matrix in ``matrices`` is non-negative.
212
211
 
@@ -237,10 +236,10 @@ def is_non_negative(matrices):
237
236
  sage: is_non_negative(matrices)
238
237
  True
239
238
  """
240
- return all(min(mat.list()) >= 0 for mat in matrices)
239
+ return all(v >= 0 for mat in matrices for v in mat.list())
241
240
 
242
241
 
243
- def is_bounded_via_mandel_simon_algorithm(matrices):
242
+ def is_bounded_via_mandel_simon_algorithm(matrices) -> bool:
244
243
  r"""
245
244
  Return whether the semigroup generated whether the semigroup of all
246
245
  possible products of ``matrices`` is finite/bounded.
@@ -290,10 +289,10 @@ def is_bounded_via_mandel_simon_algorithm(matrices):
290
289
  sage: is_bounded_via_mandel_simon_algorithm(N)
291
290
  Traceback (most recent call last):
292
291
  ...
293
- ValueError: Not all matrices are integer-valued.
292
+ ValueError: not all matrices are integer-valued
294
293
  """
295
294
  if not is_integer_valued(matrices):
296
- raise ValueError('Not all matrices are integer-valued.')
295
+ raise ValueError('not all matrices are integer-valued')
297
296
 
298
297
  phi = construct_phi(matrices)
299
298
  return not any(multiply_reduce(M, M) == M and not M**2 == M**3
@@ -391,17 +390,15 @@ def make_positive(matrices) -> list:
391
390
  ...
392
391
  ValueError: There is a matrix which is neither non-negative nor non-positive.
393
392
  """
394
- from sage.arith.srange import srange
395
393
 
396
394
  def do(mat):
397
395
  if is_non_negative(mat):
398
396
  return mat
399
- elif is_non_negative(-mat):
397
+ if is_non_negative(-mat):
400
398
  return -mat
401
- else:
402
- raise ValueError('There is a matrix which is neither non-negative nor non-positive.')
399
+ raise ValueError('There is a matrix which is neither non-negative nor non-positive.')
403
400
 
404
- return list(do(mat) for mat in matrices)
401
+ return [do(mat) for mat in matrices]
405
402
 
406
403
 
407
404
  def regular_sequence_is_bounded(S):
@@ -515,10 +512,7 @@ def regular_sequence_is_bounded(S):
515
512
  sage: regular_sequence_is_bounded(S) # needs sage.rings.number_field
516
513
  True
517
514
  """
518
- from sage.arith.srange import srange
519
-
520
515
  matrices = list(S.mu)
521
- length = len(matrices)
522
516
  try:
523
517
  return is_bounded_via_mandel_simon_algorithm(make_positive(matrices))
524
518
  except ValueError:
@@ -528,8 +522,8 @@ def regular_sequence_is_bounded(S):
528
522
  if not has_bounded_matrix_powers(matrices):
529
523
  return False
530
524
 
531
- matricesProd = list(ell*em for ell in matrices for em in matrices
532
- if ell != em)
525
+ matricesProd = [ell * em for ell in matrices for em in matrices
526
+ if ell != em]
533
527
  if not has_bounded_matrix_powers(matricesProd):
534
528
  return False
535
529
 
@@ -4,7 +4,7 @@ Restricted growth arrays
4
4
 
5
5
  These combinatorial objects are in bijection with set partitions.
6
6
  """
7
- #*****************************************************************************
7
+ # ***************************************************************************
8
8
  # Copyright (C) 2008 Mike Hansen <mhansen@gmail.com>,
9
9
  #
10
10
  # Distributed under the terms of the GNU General Public License (GPL)
@@ -16,8 +16,8 @@ These combinatorial objects are in bijection with set partitions.
16
16
  #
17
17
  # The full text of the GPL is available at:
18
18
  #
19
- # http://www.gnu.org/licenses/
20
- #*****************************************************************************
19
+ # https://www.gnu.org/licenses/
20
+ # ***************************************************************************
21
21
  from sage.combinat.combinat import bell_number
22
22
  from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets
23
23
  from sage.structure.parent import Parent
sage/combinat/ribbon.py CHANGED
@@ -2,7 +2,7 @@
2
2
  r"""
3
3
  Ribbons
4
4
  """
5
- #*****************************************************************************
5
+ # ***************************************************************************
6
6
  # Copyright (C) 2007 Mike Hansen <mhansen@gmail.com>,
7
7
  #
8
8
  # Distributed under the terms of the GNU General Public License (GPL)
@@ -14,7 +14,7 @@ Ribbons
14
14
  #
15
15
  # The full text of the GPL is available at:
16
16
  #
17
- # http://www.gnu.org/licenses/
18
- #*****************************************************************************
17
+ # https://www.gnu.org/licenses/
18
+ # ***************************************************************************
19
19
 
20
20
  from .ribbon_shaped_tableau import RibbonShapedTableau, StandardRibbonShapedTableaux
@@ -13,7 +13,7 @@ AUTHORS:
13
13
  - Travis Scrimshaw (2014-09-10): Added type `D_4^{(3)}`
14
14
  """
15
15
 
16
- #*****************************************************************************
16
+ # ***************************************************************************
17
17
  # Copyright (C) 2011-2015 Travis Scrimshaw <tscrim@ucdavis.edu>
18
18
  #
19
19
  # Distributed under the terms of the GNU General Public License (GPL)
@@ -25,8 +25,8 @@ AUTHORS:
25
25
  #
26
26
  # The full text of the GPL is available at:
27
27
  #
28
- # http://www.gnu.org/licenses/
29
- #*****************************************************************************
28
+ # https://www.gnu.org/licenses/
29
+ # ***************************************************************************
30
30
 
31
31
  from sage.combinat.rigged_configurations.bij_type_A import KRTToRCBijectionTypeA
32
32
  from sage.combinat.rigged_configurations.bij_type_A import RCToKRTBijectionTypeA
sage/combinat/rsk.py CHANGED
@@ -2591,6 +2591,8 @@ class RuleStar(Rule):
2591
2591
  sage: FC_tabs = [T for shape in shapes
2592
2592
  ....: for T in SemistandardTableaux(shape, max_entry=4)
2593
2593
  ....: if fc(row_reading(T.conjugate()))]
2594
+ sage: from random import sample
2595
+ sage: FC_tabs = sample(FC_tabs, 25) # verify only a random subset
2594
2596
  sage: Checks = []
2595
2597
  sage: for T in FC_tabs: # long time
2596
2598
  ....: shape = T.shape().conjugate()
@@ -77,7 +77,6 @@ We can also check the properties listed in :wikipedia:`Schubert_polynomial`::
77
77
 
78
78
  from sage.categories.graded_algebras_with_basis import GradedAlgebrasWithBasis
79
79
  from sage.combinat.free_module import CombinatorialFreeModule
80
- from sage.combinat.key_polynomial import KeyPolynomial
81
80
  from sage.combinat.permutation import Permutations, Permutation
82
81
  from sage.misc.cachefunc import cached_method
83
82
  from sage.misc.lazy_import import lazy_import
@@ -87,6 +86,7 @@ from sage.rings.polynomial.infinite_polynomial_element import InfinitePolynomial
87
86
  from sage.rings.polynomial.multi_polynomial import MPolynomial
88
87
  from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
89
88
 
89
+ lazy_import('sage.combinat.key_polynomial', 'OperatorPolynomial')
90
90
  lazy_import('sage.libs.symmetrica', 'all', as_='symmetrica')
91
91
 
92
92
 
@@ -459,6 +459,15 @@ class SchubertPolynomialRing_xbasis(CombinatorialFreeModule):
459
459
  sage: for _ in range(50):
460
460
  ....: P = next(it)
461
461
  ....: assert X(k(X(P))) == X(P), P
462
+
463
+ Check the round trip from atom polynomials::
464
+
465
+ sage: a = AtomPolynomials(ZZ)
466
+ sage: X = SchubertPolynomialRing(ZZ)
467
+ sage: it = iter(Permutations())
468
+ sage: for _ in range(50):
469
+ ....: P = next(it)
470
+ ....: assert X(a(X(P))) == X(P), P
462
471
  """
463
472
  if isinstance(x, list):
464
473
  # checking the input to avoid symmetrica crashing Sage, see trac 12924
@@ -477,7 +486,7 @@ class SchubertPolynomialRing_xbasis(CombinatorialFreeModule):
477
486
  S = PolynomialRing(R.base_ring(),
478
487
  names=list(map(repr, reversed(R.gens()))))
479
488
  return symmetrica.t_POLYNOM_SCHUBERT(S(x.polynomial()))
480
- elif isinstance(x, KeyPolynomial):
489
+ elif isinstance(x, OperatorPolynomial):
481
490
  return self(x.expand())
482
491
  else:
483
492
  raise TypeError
@@ -2097,11 +2097,7 @@ class SetPartitions(UniqueRepresentation, Parent):
2097
2097
  return False
2098
2098
 
2099
2099
  # Check to make sure each element of x is a set
2100
- for s in x:
2101
- if not isinstance(s, (set, frozenset, Set_generic)):
2102
- return False
2103
-
2104
- return True
2100
+ return all(isinstance(s, (set, frozenset, Set_generic)) for s in x)
2105
2101
 
2106
2102
  def _element_constructor_(self, s, check=True):
2107
2103
  """
@@ -2506,7 +2502,7 @@ class SetPartitions(UniqueRepresentation, Parent):
2506
2502
  # Yip draws the diagram as an upper triangular matrix, thus
2507
2503
  # we refer to the cell in row i and column j with (i, j)
2508
2504
  P = []
2509
- rooks_by_column = {j: i for (i, j) in rooks}
2505
+ rooks_by_column = {j: i for i, j in rooks}
2510
2506
  for c in range(1, n + 1):
2511
2507
  # determine the weight of column c
2512
2508
  try:
@@ -2515,7 +2511,7 @@ class SetPartitions(UniqueRepresentation, Parent):
2515
2511
  ne = r - 1 + sum(1 for i, j in rooks if i > r and j < c)
2516
2512
  except KeyError:
2517
2513
  n_rooks = 0
2518
- ne = sum(1 for i, j in rooks if j < c)
2514
+ ne = sum(1 for _, j in rooks if j < c)
2519
2515
 
2520
2516
  b = c - n_rooks - ne
2521
2517
  if len(P) == b - 1:
@@ -1,5 +1,4 @@
1
1
  # sage_setup: distribution = sagemath-combinat
2
- # cython: binding=True
3
2
  r"""
4
3
  Fast set partition iterators
5
4
  """
@@ -454,7 +454,7 @@ class OrderedSetPartition(ClonableArray,
454
454
  return FiniteEnumeratedSet([par(sum((list(i) for i in C), []))
455
455
  for C in product(*[OrderedSetPartitions(X) for X in self])])
456
456
 
457
- def is_finer(self, co2):
457
+ def is_finer(self, co2) -> bool:
458
458
  """
459
459
  Return ``True`` if the ordered set partition ``self`` is finer
460
460
  than the ordered set partition ``co2``; otherwise, return ``False``.
@@ -673,7 +673,7 @@ class OrderedSetPartition(ClonableArray,
673
673
  return FiniteEnumeratedSet([par(sum((list(P) for P in C), []))
674
674
  for C in product(*[[buo(X, comp) for comp in Compositions(len(X))] for X in self])])
675
675
 
676
- def is_strongly_finer(self, co2):
676
+ def is_strongly_finer(self, co2) -> bool:
677
677
  r"""
678
678
  Return ``True`` if the ordered set partition ``self`` is strongly
679
679
  finer than the ordered set partition ``co2``; otherwise, return
@@ -44,7 +44,7 @@ def init():
44
44
  sage: sage.combinat.sf.classical.conversion_functions = {}
45
45
  sage: init()
46
46
  sage: sage.combinat.sf.classical.conversion_functions[('Schur', 'powersum')]
47
- <built-in function t_SCHUR_POWSYM_symmetrica>
47
+ <cyfunction t_SCHUR_POWSYM_symmetrica at ...>
48
48
 
49
49
  The following checks if the bug described in :issue:`15312` is fixed. ::
50
50
 
sage/combinat/sf/dual.py CHANGED
@@ -21,6 +21,7 @@ Generic dual bases symmetric functions
21
21
  import sage.combinat.partition
22
22
  import sage.data_structures.blas_dict as blas
23
23
  from sage.categories.homset import Hom
24
+ from sage.categories.modules_with_basis import ModulesWithBasis
24
25
  from sage.categories.morphism import SetMorphism
25
26
  from sage.matrix.constructor import matrix
26
27
 
@@ -168,7 +169,7 @@ class SymmetricFunctionAlgebra_dual(classical.SymmetricFunctionAlgebra_classical
168
169
  prefix=prefix)
169
170
 
170
171
  # temporary until Hom(GradedHopfAlgebrasWithBasis work better)
171
- category = sage.categories.all.ModulesWithBasis(self.base_ring())
172
+ category = ModulesWithBasis(self.base_ring())
172
173
  self.register_coercion(SetMorphism(Hom(self._dual_basis, self, category), self._dual_to_self))
173
174
  self._dual_basis.register_coercion(SetMorphism(Hom(self, self._dual_basis, category), self._self_to_dual))
174
175
 
@@ -394,16 +395,14 @@ class SymmetricFunctionAlgebra_dual(classical.SymmetricFunctionAlgebra_classical
394
395
 
395
396
  # For every partition p of size n, compute self(p) in
396
397
  # terms of the dual basis using the scalar product.
397
- i = 0
398
- for s_part in partitions_n:
398
+ for i, s_part in enumerate(partitions_n):
399
399
  # s_part corresponds to self(dual_basis(part))
400
400
  # s_mcs corresponds to self(dual_basis(part))._monomial_coefficients
401
401
  s_mcs = {}
402
402
 
403
403
  # We need to compute the scalar product of d[s_part] and
404
404
  # all of the d[p_part]'s
405
- j = 0
406
- for p_part in partitions_n:
405
+ for j, p_part in enumerate(partitions_n):
407
406
  # Compute the scalar product of d[s_part] and d[p_part]
408
407
  sp = zero
409
408
  for ds_part in d[s_part]:
@@ -413,10 +412,7 @@ class SymmetricFunctionAlgebra_dual(classical.SymmetricFunctionAlgebra_classical
413
412
  s_mcs[p_part] = sp
414
413
  transition_matrix_n[i,j] = sp
415
414
 
416
- j += 1
417
-
418
415
  self._to_self_cache[ s_part ] = s_mcs
419
- i += 1
420
416
 
421
417
  else:
422
418
  # Now the other case. Note that just being in this case doesn't
@@ -3,7 +3,7 @@
3
3
  """
4
4
  Elementary symmetric functions
5
5
  """
6
- #*****************************************************************************
6
+ # ***************************************************************************
7
7
  # Copyright (C) 2007 Mike Hansen <mhansen@gmail.com>
8
8
  # 2012 Mike Zabrocki <mike.zabrocki@gmail.com>
9
9
  # 2012 Anne Schilling <anne@math.ucdavis.edu>
@@ -17,8 +17,8 @@ Elementary symmetric functions
17
17
  #
18
18
  # The full text of the GPL is available at:
19
19
  #
20
- # http://www.gnu.org/licenses/
21
- #*****************************************************************************
20
+ # https://www.gnu.org/licenses/
21
+ # ***************************************************************************
22
22
  from sage.arith.misc import binomial, factorial
23
23
  from sage.combinat.partition import Partition
24
24
  from sage.combinat.sf import classical, multiplicative
@@ -96,7 +96,7 @@ class SymmetricFunctionAlgebra_elementary(multiplicative.SymmetricFunctionAlgebr
96
96
  def P(i):
97
97
  return Partition([i]) if i else Partition([])
98
98
  T = self.tensor_square()
99
- return T.sum_of_monomials( (P(j), P(i-j)) for j in range(i+1) )
99
+ return T.sum_of_monomials((P(j), P(i - j)) for j in range(i + 1))
100
100
 
101
101
  def _magma_init_(self, magma):
102
102
  """
@@ -169,7 +169,7 @@ class SymmetricFunctionAlgebra_elementary(multiplicative.SymmetricFunctionAlgebr
169
169
  """
170
170
  e = self.parent()
171
171
  h = e.realization_of().h()
172
- return e( h._from_element(self) )
172
+ return e(h._from_element(self))
173
173
 
174
174
  omega_involution = omega
175
175
 
@@ -282,7 +282,7 @@ class SymmetricFunctionAlgebra_elementary(multiplicative.SymmetricFunctionAlgebr
282
282
  dct = {Partition([i // n for i in lam]):
283
283
  (-1) ** (sum(lam) - (sum(lam) // n)) * coeff
284
284
  for (lam, coeff) in e_coords_of_self
285
- if all( i % n == 0 for i in lam )}
285
+ if all(not i % n for i in lam)}
286
286
  result_in_e_basis = parent._from_dict(dct)
287
287
  return parent(result_in_e_basis)
288
288
 
@@ -395,6 +395,12 @@ class SymmetricFunctionAlgebra_elementary(multiplicative.SymmetricFunctionAlgebr
395
395
  sage: e.zero().principal_specialization(3)
396
396
  0
397
397
  """
398
+ if n == 1:
399
+ R = self.base_ring()
400
+ mc = self.monomial_coefficients(copy=False).items()
401
+ return R.sum(c for partition, c in mc
402
+ if not partition or partition[0] == 1)
403
+
398
404
  from sage.combinat.q_analogues import q_binomial
399
405
 
400
406
  def get_variable(ring, name):
@@ -417,7 +423,7 @@ class SymmetricFunctionAlgebra_elementary(multiplicative.SymmetricFunctionAlgebr
417
423
  f = lambda partition: prod(binomial(n, part) for part in partition)
418
424
  elif n == infinity:
419
425
  f = lambda partition: prod(q**binomial(part, 2)/prod((1-q**i)
420
- for i in range(1,part+1))
426
+ for i in range(1, part+1))
421
427
  for part in partition)
422
428
  else:
423
429
  f = lambda partition: prod(q**binomial(part, 2)*q_binomial(n, part, q=q)