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
@@ -358,7 +358,7 @@ class AbstractPartitionDiagram(AbstractSetPartition):
358
358
  sage: pd2 = da.AbstractPartitionDiagram(pd, [[[1,2],[-1,-2]]]) # indirect doctest
359
359
  Traceback (most recent call last):
360
360
  ...
361
- TypeError: unhashable type: 'list'
361
+ TypeError: ...unhashable type: 'list'...
362
362
  """
363
363
  if self._base_diagram:
364
364
  tst = frozenset(e for B in self._base_diagram for e in B)
@@ -502,7 +502,7 @@ class AbstractPartitionDiagram(AbstractSetPartition):
502
502
  sage: pd([[1,2],[-1,-2]]).compose(pd([[1,2],[-1,-2]]))
503
503
  ({{-2, -1}, {1, 2}}, 1)
504
504
  """
505
- (composite_diagram, loops_removed) = set_partition_composition(self._base_diagram, other._base_diagram)
505
+ composite_diagram, loops_removed = set_partition_composition(self._base_diagram, other._base_diagram)
506
506
  return (self.__class__(self.parent(), composite_diagram, check=check), loops_removed)
507
507
 
508
508
  def propagating_number(self):
@@ -566,7 +566,7 @@ class AbstractPartitionDiagram(AbstractSetPartition):
566
566
  """
567
567
  return self.parent().order
568
568
 
569
- def is_planar(self):
569
+ def is_planar(self) -> bool:
570
570
  r"""
571
571
  Test if the diagram ``self`` is planar.
572
572
 
@@ -999,7 +999,7 @@ class BrauerDiagram(AbstractPartitionDiagram):
999
999
  sage: bd([[1,4],[6,7], [-2,-6],[-5,-7], [2,-4],[3,-1],[5,-3]])._repr_compact()
1000
1000
  '[14.67/26.57;312]'
1001
1001
  """
1002
- (top, bot, thru) = self.involution_permutation_triple()
1002
+ top, bot, thru = self.involution_permutation_triple()
1003
1003
  bot.reverse()
1004
1004
  s1 = ".".join("".join(str(b) for b in block) for block in top)
1005
1005
  s2 = ".".join("".join(str(abs(k)) for k in sorted(block, reverse=True))
@@ -1109,7 +1109,7 @@ class BrauerDiagram(AbstractPartitionDiagram):
1109
1109
  std[short_form.index(i)] = j
1110
1110
  return std
1111
1111
 
1112
- def is_elementary_symmetric(self):
1112
+ def is_elementary_symmetric(self) -> bool:
1113
1113
  r"""
1114
1114
  Check if is elementary symmetric.
1115
1115
 
@@ -1128,10 +1128,10 @@ class BrauerDiagram(AbstractPartitionDiagram):
1128
1128
  sage: elm2.is_elementary_symmetric()
1129
1129
  False
1130
1130
  """
1131
- (D1,D2,pi) = self.involution_permutation_triple()
1131
+ D1, D2, pi = self.involution_permutation_triple()
1132
1132
  D1 = sorted(sorted(abs(y) for y in x) for x in D1)
1133
1133
  D2 = sorted(sorted(abs(y) for y in x) for x in D2)
1134
- return D1 == D2 and pi == list(range(1,len(pi)+1))
1134
+ return D1 == D2 and pi == list(range(1, len(pi) + 1))
1135
1135
 
1136
1136
 
1137
1137
  class AbstractPartitionDiagrams(Parent, UniqueRepresentation):
@@ -1329,9 +1329,8 @@ class AbstractPartitionDiagrams(Parent, UniqueRepresentation):
1329
1329
  return False
1330
1330
  if obj.base_diagram():
1331
1331
  tst = sorted(flatten(obj.base_diagram()))
1332
- if len(tst) % 2 or tst != list(range(-len(tst)//2,0)) + list(range(1,len(tst)//2+1)):
1333
- return False
1334
- return True
1332
+ ell = len(tst)
1333
+ return not ell % 2 and tst == list(range(-ell // 2, 0)) + list(range(1, ell // 2 + 1))
1335
1334
  return self.order == 0
1336
1335
 
1337
1336
  def _element_constructor_(self, d):
@@ -1617,7 +1616,7 @@ class BrauerDiagrams(AbstractPartitionDiagrams):
1617
1616
  raise NotImplementedError("only implemented for integer order,"
1618
1617
  " not for order %s" % (self.order))
1619
1618
  try:
1620
- (D1,D2,pi) = tuple(D1_D2_pi)
1619
+ D1, D2, pi = tuple(D1_D2_pi)
1621
1620
  except ValueError:
1622
1621
  raise ValueError("argument %s not in correct form; must be a tuple (D1, D2, pi)" % D1_D2_pi)
1623
1622
  D1 = [[abs(x) for x in b] for b in D1 if len(b) == 2] # not needed if argument correctly passed at outset.
@@ -2205,7 +2204,7 @@ class DiagramBasis(DiagramAlgebra):
2205
2204
  d1 = self._indices(d1)
2206
2205
  if not self._indices.is_parent_of(d2):
2207
2206
  d2 = self._indices(d2)
2208
- (composite_diagram, loops_removed) = d1.compose(d2, check=False)
2207
+ composite_diagram, loops_removed = d1.compose(d2, check=False)
2209
2208
  return self.term(composite_diagram, self._q**loops_removed)
2210
2209
 
2211
2210
 
@@ -4493,7 +4492,6 @@ class TemperleyLiebAlgebra(SubPartitionAlgebra, UnitDiagramMixin):
4493
4492
  o o o o o o o o o o o o
4494
4493
  """
4495
4494
  M = x.monomial_coefficients(copy=False)
4496
- I = self._indices
4497
4495
  return self._from_dict({d.dual(): c for d, c in M.items()},
4498
4496
  remove_zeros=False)
4499
4497
 
@@ -5578,7 +5576,7 @@ class PottsRepresentation(CombinatorialFreeModule):
5578
5576
  #########################################################################
5579
5577
 
5580
5578
 
5581
- def is_planar(sp):
5579
+ def is_planar(sp) -> bool:
5582
5580
  r"""
5583
5581
  Return ``True`` if the diagram corresponding to the set partition ``sp``
5584
5582
  is planar; otherwise, return ``False``.
@@ -78,7 +78,6 @@ REFERENCES:
78
78
  # https://www.gnu.org/licenses/
79
79
  # ****************************************************************************
80
80
  from __future__ import annotations
81
- from collections.abc import Iterator
82
81
 
83
82
  from .combinat import CombinatorialElement, catalan_number
84
83
  from sage.combinat.combinatorial_map import combinatorial_map
@@ -98,6 +97,10 @@ from sage.combinat.words.word import Word
98
97
  from sage.combinat.set_partition import SetPartitions
99
98
  from sage.misc.latex import latex
100
99
  from sage.misc.lazy_import import lazy_import
100
+ from typing import TYPE_CHECKING
101
+
102
+ if TYPE_CHECKING:
103
+ from collections.abc import Iterator
101
104
 
102
105
  lazy_import('sage.combinat.alternating_sign_matrix', 'AlternatingSignMatrices')
103
106
 
@@ -927,11 +930,10 @@ class DyckWord(CombinatorialElement):
927
930
  horizontal = "<line x1=\"{}\" y1=\"{}\" x2=\"{}\" y2=\"{}\"/>"
928
931
  hori_lines = []
929
932
  path = ['<polyline points=\"0,0']
930
- x, y = 0, 0
933
+ y = 0
931
934
  max_y = 0
932
935
  last_seen_level = [0]
933
- for e in self:
934
- x += 1
936
+ for x, e in enumerate(self, start=1):
935
937
  if e == open_symbol:
936
938
  y += 1
937
939
  last_seen_level.append(x - 1)
@@ -2060,7 +2062,7 @@ class DyckWord_complete(DyckWord):
2060
2062
  EXAMPLES::
2061
2063
 
2062
2064
  sage: R = QQ['q','t'].fraction_field()
2063
- sage: (q,t) = R.gens()
2065
+ sage: q, t = R.gens()
2064
2066
  sage: f = sum(t**D.area() * D.characteristic_symmetric_function() # needs sage.modules
2065
2067
  ....: for D in DyckWords(3)); f
2066
2068
  (q^3+q^2*t+q*t^2+t^3+q*t)*s[1, 1, 1] + (q^2+q*t+t^2+q+t)*s[2, 1] + s[3]
@@ -2697,7 +2699,7 @@ class DyckWord_complete(DyckWord):
2697
2699
  bseq[bpeak[-i - 1]] - bseq[bpeak[-i - 1] + 1] + 1)
2698
2700
  return out
2699
2701
 
2700
- def tunnels(self):
2702
+ def tunnels(self) -> Iterator[tuple[int, int]]:
2701
2703
  r"""
2702
2704
  Return an iterator of ranges of the matching parentheses in the Dyck
2703
2705
  word ``self``.
@@ -2747,15 +2749,14 @@ class DyckWord_complete(DyckWord):
2747
2749
  n = len(self)
2748
2750
  tunnels = self.tunnels()
2749
2751
  if tunnel_type == 'left':
2750
- return len([1 for (i, j) in tunnels if i + j < n])
2751
- elif tunnel_type == 'centered':
2752
- return len([1 for (i, j) in tunnels if i + j == n])
2753
- elif tunnel_type == 'right':
2754
- return len([1 for (i, j) in tunnels if i + j > n])
2755
- elif tunnel_type == 'all':
2752
+ return len([1 for i, j in tunnels if i + j < n])
2753
+ if tunnel_type == 'centered':
2754
+ return len([1 for i, j in tunnels if i + j == n])
2755
+ if tunnel_type == 'right':
2756
+ return len([1 for i, j in tunnels if i + j > n])
2757
+ if tunnel_type == 'all':
2756
2758
  return len(list(tunnels))
2757
- else:
2758
- raise ValueError("the given tunnel_type is not valid")
2759
+ raise ValueError("the given tunnel_type is not valid")
2759
2760
 
2760
2761
  @combinatorial_map(order=2, name="Reverse path")
2761
2762
  def reverse(self) -> DyckWord:
@@ -849,7 +849,7 @@ class Patch(SageObject):
849
849
  else:
850
850
  return Patch(self._faces.difference(other))
851
851
 
852
- def dimension(self) -> None | int:
852
+ def dimension(self) -> int | None:
853
853
  r"""
854
854
  Return the dimension of the vectors of the faces of ``self``.
855
855
 
sage/combinat/fqsym.py CHANGED
@@ -364,8 +364,14 @@ class FreeQuasisymmetricFunctions(UniqueRepresentation, Parent):
364
364
 
365
365
  sage: F = algebras.FQSym(QQ)
366
366
  sage: TestSuite(F).run() # long time (3s)
367
+
368
+ sage: F = algebras.FQSym(ZZ).F()
369
+ sage: F.is_commutative()
370
+ False
367
371
  """
368
372
  category = HopfAlgebras(R).Graded().Connected()
373
+ if R.is_zero():
374
+ category = category.Commutative()
369
375
  Parent.__init__(self, base=R, category=category.WithRealizations())
370
376
 
371
377
  # Bases
@@ -401,7 +407,7 @@ class FreeQuasisymmetricFunctions(UniqueRepresentation, Parent):
401
407
  """
402
408
  return self.F()
403
409
 
404
- _shorthands = tuple(['F', 'G', 'M'])
410
+ _shorthands = ('F', 'G', 'M')
405
411
 
406
412
  class F(FQSymBasis_abstract):
407
413
  r"""
@@ -689,7 +695,7 @@ class FreeQuasisymmetricFunctions(UniqueRepresentation, Parent):
689
695
  raise ValueError("n must be at least the maximal degree")
690
696
 
691
697
  SGA = SymmetricGroupAlgebra(self.base_ring(), n)
692
- return SGA._from_dict({Permutations(n)(key): c for (key, c) in self})
698
+ return SGA._from_dict({Permutations(n)(key): c for key, c in self})
693
699
 
694
700
  class G(FQSymBasis_abstract):
695
701
  r"""
@@ -1219,7 +1225,7 @@ class FreeQuasisymmetricFunctions(UniqueRepresentation, Parent):
1219
1225
  # See the FQSymBases.ElementMethods.star_involution doc
1220
1226
  # for the formula we're using here.
1221
1227
  M = self.parent()
1222
- return M._from_dict({w.complement().reverse(): c for (w, c) in self},
1228
+ return M._from_dict({w.complement().reverse(): c for w, c in self},
1223
1229
  remove_zeros=False)
1224
1230
 
1225
1231
 
@@ -1351,18 +1357,6 @@ class FQSymBases(Category_realization_of_parent):
1351
1357
  """
1352
1358
  return False
1353
1359
 
1354
- def is_commutative(self):
1355
- """
1356
- Return whether this `FQSym` is commutative.
1357
-
1358
- EXAMPLES::
1359
-
1360
- sage: F = algebras.FQSym(ZZ).F()
1361
- sage: F.is_commutative()
1362
- False
1363
- """
1364
- return self.base_ring().is_zero()
1365
-
1366
1360
  def some_elements(self):
1367
1361
  """
1368
1362
  Return some elements of the free quasi-symmetric functions.
@@ -1523,7 +1517,7 @@ class FQSymBases(Category_realization_of_parent):
1523
1517
  sage: A.from_symmetric_group_algebra(SGA4.zero())
1524
1518
  0
1525
1519
  """
1526
- return self._from_dict({Permutation(key): c for (key, c) in x})
1520
+ return self._from_dict({Permutation(key): c for key, c in x})
1527
1521
 
1528
1522
  class ElementMethods:
1529
1523
  def omega_involution(self):
@@ -1634,7 +1628,7 @@ class FQSymBases(Category_realization_of_parent):
1634
1628
  # componentwise, then convert back.
1635
1629
  parent = self.parent()
1636
1630
  F = parent.realization_of().F()
1637
- dct = {I.reverse(): coeff for (I, coeff) in F(self)}
1631
+ dct = {I.reverse(): coeff for I, coeff in F(self)}
1638
1632
  return parent(F._from_dict(dct, remove_zeros=False))
1639
1633
 
1640
1634
  def psi_involution(self):
@@ -1736,7 +1730,7 @@ class FQSymBases(Category_realization_of_parent):
1736
1730
  # componentwise, then convert back.
1737
1731
  parent = self.parent()
1738
1732
  F = parent.realization_of().F()
1739
- dct = {I.complement(): coeff for (I, coeff) in F(self)}
1733
+ dct = {I.complement(): coeff for I, coeff in F(self)}
1740
1734
  return parent(F._from_dict(dct, remove_zeros=False))
1741
1735
 
1742
1736
  def star_involution(self):
@@ -1856,7 +1850,7 @@ class FQSymBases(Category_realization_of_parent):
1856
1850
  # complement componentwise, then convert back.
1857
1851
  parent = self.parent()
1858
1852
  F = parent.realization_of().F()
1859
- dct = {I.complement().reverse(): coeff for (I, coeff) in F(self)}
1853
+ dct = {I.complement().reverse(): coeff for I, coeff in F(self)}
1860
1854
  return parent(F._from_dict(dct, remove_zeros=False))
1861
1855
 
1862
1856
  def to_symmetric_group_algebra(self, n=None):
@@ -314,7 +314,7 @@ class FreeDendriformAlgebra(CombinatorialFreeModule):
314
314
  sage: A.degree_on_basis(u.over(u))
315
315
  2
316
316
  """
317
- return t.node_number()
317
+ return t.number_of_nodes()
318
318
 
319
319
  def _an_element_(self):
320
320
  """
@@ -628,7 +628,7 @@ class FreeDendriformAlgebra(CombinatorialFreeModule):
628
628
  """
629
629
  B = self.basis()
630
630
  Trees = B.keys()
631
- if not x.node_number():
631
+ if not x.number_of_nodes():
632
632
  return self.one().tensor(self.one())
633
633
  L, R = list(x)
634
634
  try:
@@ -374,7 +374,7 @@ class FreePreLieAlgebra(CombinatorialFreeModule):
374
374
  sage: A.degree_on_basis(RT([RT([])]))
375
375
  2
376
376
  """
377
- return t.node_number()
377
+ return t.number_of_nodes()
378
378
 
379
379
  def _an_element_(self):
380
380
  """
@@ -610,7 +610,7 @@ class FreePreLieAlgebra(CombinatorialFreeModule):
610
610
  resu = self.zero()
611
611
  for k in range(min_deg, N + 1): # total degree of (x ; y, y, y, y)
612
612
  for mx, coef_x in xx:
613
- dx = mx.node_number()
613
+ dx = mx.number_of_nodes()
614
614
  step = self.zero()
615
615
  for pi in IntegerVectors(k - dx, n, min_part=vy, max_part=max_y):
616
616
  for ly in product(*[y_homog[part] for part in pi]):
@@ -29,8 +29,6 @@ Natalie Schoenhals for their contribution to the project and the code.
29
29
  # (at your option) any later version.
30
30
  # https://www.gnu.org/licenses/
31
31
  # ****************************************************************************
32
- from collections import deque
33
-
34
32
  from sage.categories.coxeter_groups import CoxeterGroups
35
33
  from sage.categories.enumerated_sets import EnumeratedSets
36
34
  from sage.misc.lazy_import import lazy_import
@@ -159,7 +157,9 @@ class FullyCommutativeElement(NormalizedClonableList):
159
157
  False
160
158
  """
161
159
  word = list(self)
162
- from sage.combinat.root_system.braid_orbit import is_fully_commutative as is_fully_comm
160
+ from sage.combinat.root_system.braid_orbit import (
161
+ is_fully_commutative as is_fully_comm,
162
+ )
163
163
 
164
164
  group = self.parent().coxeter_group()
165
165
  braid_rels = group.braid_relations()
@@ -272,7 +272,7 @@ class FullyCommutativeElement(NormalizedClonableList):
272
272
  levels = h.level_sets()
273
273
  letters_at_level = [set(self[i] for i in level) for level in levels]
274
274
 
275
- for (level_zero_index, members) in enumerate(levels):
275
+ for level_zero_index, members in enumerate(levels):
276
276
  level = level_zero_index + 1
277
277
  for i in members:
278
278
  x = self[i]
@@ -440,7 +440,7 @@ class FullyCommutativeElement(NormalizedClonableList):
440
440
  view = list(self) if side == 'left' else self[::-1]
441
441
  m = self.parent().coxeter_group().coxeter_matrix()
442
442
  out = set()
443
- for (i, t) in enumerate(view):
443
+ for i, t in enumerate(view):
444
444
  if not any(m[x, t] > 2 for x in view[:i]):
445
445
  out.add(t)
446
446
  return out
@@ -713,9 +713,9 @@ class FullyCommutativeElement(NormalizedClonableList):
713
713
 
714
714
  # Perform the coset decomposition on the specified side:
715
715
  if side == 'left':
716
- (string, remaining) = self.coset_decomposition(J, side=side)
716
+ string, remaining = self.coset_decomposition(J, side=side)
717
717
  elif side == 'right':
718
- (remaining, string) = self.coset_decomposition(J, side=side)
718
+ remaining, string = self.coset_decomposition(J, side=side)
719
719
 
720
720
  cur_string = list(string)
721
721
 
@@ -1012,7 +1012,7 @@ class FullyCommutativeElements(UniqueRepresentation, Parent):
1012
1012
  letters = self.coxeter_group().index_set()
1013
1013
 
1014
1014
  # To make the iterator deterministic, use a dictionary rather than a
1015
- # set, for the keys are then ordered by default by Python 3.7+:
1015
+ # set, for the keys are then ordered by default:
1016
1016
  recent_words = {empty_word: True}
1017
1017
  yield empty_word
1018
1018
  while recent_words:
@@ -307,7 +307,7 @@ class FullyPackedLoop(Element, metaclass=InheritComparisonClasscallMetaclass):
307
307
  sage: ASMs = AlternatingSignMatrices(3).list()
308
308
  sage: ncp = FullyPackedLoop(ASMs[1]).link_pattern() # fpl's gyration orbit size is 2
309
309
  sage: rotated_ncp=[]
310
- sage: for (a,b) in ncp:
310
+ sage: for a, b in ncp:
311
311
  ....: for i in range(5):
312
312
  ....: a,b=a%6+1,b%6+1;
313
313
  ....: rotated_ncp.append((a,b))
@@ -318,7 +318,7 @@ class FullyPackedLoop(Element, metaclass=InheritComparisonClasscallMetaclass):
318
318
  sage: fpl = FullyPackedLoop(ASMs[0])
319
319
  sage: ncp = fpl.link_pattern() # fpl's gyration size is 3
320
320
  sage: rotated_ncp=[]
321
- sage: for (a,b) in ncp:
321
+ sage: for a, b in ncp:
322
322
  ....: for i in range(5):
323
323
  ....: a,b=a%6+1,b%6+1;
324
324
  ....: rotated_ncp.append((a,b))
@@ -331,7 +331,7 @@ class FullyPackedLoop(Element, metaclass=InheritComparisonClasscallMetaclass):
331
331
  sage: fpl = FullyPackedLoop(mat) # n=7
332
332
  sage: ncp = fpl.link_pattern()
333
333
  sage: rotated_ncp=[]
334
- sage: for (a,b) in ncp:
334
+ sage: for a, b in ncp:
335
335
  ....: for i in range(13):
336
336
  ....: a,b=a%14+1,b%14+1;
337
337
  ....: rotated_ncp.append((a,b))
@@ -344,7 +344,7 @@ class FullyPackedLoop(Element, metaclass=InheritComparisonClasscallMetaclass):
344
344
  sage: fpl = FullyPackedLoop(mat) # n =6
345
345
  sage: ncp = fpl.link_pattern()
346
346
  sage: rotated_ncp=[]
347
- sage: for (a,b) in ncp:
347
+ sage: for a, b in ncp:
348
348
  ....: for i in range(11):
349
349
  ....: a,b=a%12+1,b%12+1;
350
350
  ....: rotated_ncp.append((a,b))
@@ -762,7 +762,7 @@ class FullyPackedLoop(Element, metaclass=InheritComparisonClasscallMetaclass):
762
762
  its order. Setting this option to ``True`` makes it unlikely to
763
763
  have two neighboring links with the same color.
764
764
 
765
- - ``loop_fill`` -- (boolean, optional) whether to fill the interior of the loops
765
+ - ``loop_fill`` -- boolean (default: ``False``); whether to fill the interior of the loops
766
766
 
767
767
  EXAMPLES:
768
768
 
@@ -1082,7 +1082,7 @@ class FullyPackedLoop(Element, metaclass=InheritComparisonClasscallMetaclass):
1082
1082
  sage: ASMs = AlternatingSignMatrices(3).list()
1083
1083
  sage: ncp = FullyPackedLoop(ASMs[1]).link_pattern()
1084
1084
  sage: rotated_ncp=[]
1085
- sage: for (a,b) in ncp:
1085
+ sage: for a, b in ncp:
1086
1086
  ....: for i in range(5):
1087
1087
  ....: a,b=a%6+1,b%6+1;
1088
1088
  ....: rotated_ncp.append((a,b))
@@ -1093,7 +1093,7 @@ class FullyPackedLoop(Element, metaclass=InheritComparisonClasscallMetaclass):
1093
1093
  sage: fpl = FullyPackedLoop(ASMs[0])
1094
1094
  sage: ncp = fpl.link_pattern()
1095
1095
  sage: rotated_ncp=[]
1096
- sage: for (a,b) in ncp:
1096
+ sage: for a, b in ncp:
1097
1097
  ....: for i in range(5):
1098
1098
  ....: a,b=a%6+1,b%6+1;
1099
1099
  ....: rotated_ncp.append((a,b))
@@ -1106,7 +1106,7 @@ class FullyPackedLoop(Element, metaclass=InheritComparisonClasscallMetaclass):
1106
1106
  sage: fpl = FullyPackedLoop(mat) # n=7
1107
1107
  sage: ncp = fpl.link_pattern()
1108
1108
  sage: rotated_ncp=[]
1109
- sage: for (a,b) in ncp:
1109
+ sage: for a, b in ncp:
1110
1110
  ....: for i in range(13):
1111
1111
  ....: a,b=a%14+1,b%14+1;
1112
1112
  ....: rotated_ncp.append((a,b))
@@ -1119,7 +1119,7 @@ class FullyPackedLoop(Element, metaclass=InheritComparisonClasscallMetaclass):
1119
1119
  sage: fpl = FullyPackedLoop(mat)
1120
1120
  sage: ncp = fpl.link_pattern()
1121
1121
  sage: rotated_ncp=[]
1122
- sage: for (a,b) in ncp:
1122
+ sage: for a, b in ncp:
1123
1123
  ....: for i in range(11):
1124
1124
  ....: a,b=a%12+1,b%12+1;
1125
1125
  ....: rotated_ncp.append((a,b))
@@ -705,10 +705,9 @@ class GelfandTsetlinPatterns(UniqueRepresentation, Parent):
705
705
  for i in range(1, len(gt)) for j in range(len(gt[i]))):
706
706
  return False
707
707
  # Check if it is strict if applicable
708
- if self._strict and any(gt[i][j] == gt[i][j-1] for i in range(len(gt))
709
- for j in range(1, len(gt[i]))):
710
- return False
711
- return True
708
+ return not (self._strict and any(gt[i][j] == gt[i][j - 1]
709
+ for i in range(len(gt))
710
+ for j in range(1, len(gt[i]))))
712
711
 
713
712
  def _repr_(self):
714
713
  """
@@ -1182,7 +1181,7 @@ class GelfandTsetlinPatterns(UniqueRepresentation, Parent):
1182
1181
  elif self._k < 0:
1183
1182
  raise ValueError('cannot sample from empty set')
1184
1183
  else:
1185
- return self._cftp(0)
1184
+ return self.element_class(self, self._cftp(0))
1186
1185
  else:
1187
1186
  raise ValueError('cannot sample from infinite set')
1188
1187
 
@@ -70,19 +70,18 @@ def product(m):
70
70
  ....: assert sum(1 for _ in product(t)) == prod(t)-1
71
71
  """
72
72
  # n is the length of the element (we ignore sets of size 1)
73
- n = k = 0
73
+ n = 0
74
74
 
75
75
  new_m = [] # will be the set of upper bounds m_i different from 1
76
76
  mm = [] # index of each set (we skip sets of cardinality 1)
77
- for i in m:
77
+ for k, i in enumerate(m):
78
78
  i = int(i)
79
79
  if i <= 0:
80
80
  raise ValueError("accept only positive integers")
81
81
  if i > 1:
82
- new_m.append(i-1)
82
+ new_m.append(i - 1)
83
83
  mm.append(k)
84
84
  n += 1
85
- k += 1
86
85
 
87
86
  m = new_m
88
87
  f = list(range(n + 1)) # focus pointer
@@ -360,7 +360,7 @@ class GrossmanLarsonAlgebra(CombinatorialFreeModule):
360
360
  sage: A.degree_on_basis(RT([RT([])]))
361
361
  1
362
362
  """
363
- return t.node_number() - 1
363
+ return t.number_of_nodes() - 1
364
364
 
365
365
  def _an_element_(self):
366
366
  """
@@ -509,7 +509,7 @@ class GrossmanLarsonAlgebra(CombinatorialFreeModule):
509
509
  sage: A.counit_on_basis(RT([],'#'))
510
510
  1
511
511
  """
512
- if x.node_number() == 1:
512
+ if x.number_of_nodes() == 1:
513
513
  return self.base_ring().one()
514
514
  return self.base_ring().zero()
515
515
 
sage/combinat/growth.py CHANGED
@@ -748,7 +748,7 @@ class GrowthDiagram(SageObject):
748
748
  sage: G.out_labels() == G.conjugate().out_labels()[::-1]
749
749
  True
750
750
  """
751
- F = {(j,i): v for (i,j),v in self._filling.items()}
751
+ F = {(j, i): v for (i, j), v in self._filling.items()}
752
752
  return GrowthDiagram(self.rule,
753
753
  filling=F,
754
754
  shape=self.shape().conjugate(),
@@ -803,7 +803,7 @@ class GrowthDiagram(SageObject):
803
803
  shape_lambda = [l - p for p in self._mu] + [l] * (h - len(self._mu))
804
804
  shape_mu = [l - p for p in self._lambda]
805
805
  shape = SkewPartition([shape_lambda[::-1], shape_mu[::-1]])
806
- F = {(l-i-1, h-j-1): v for (i,j),v in self._filling.items()}
806
+ F = {(l-i-1, h-j-1): v for (i, j), v in self._filling.items()}
807
807
  return GrowthDiagram(self.rule,
808
808
  filling=F,
809
809
  shape=shape)
@@ -996,7 +996,7 @@ class GrowthDiagram(SageObject):
996
996
  if not self.is_rectangular():
997
997
  raise ValueError("can only convert fillings of rectangular shapes to words")
998
998
  w = [0] * self._lambda[0]
999
- for ((i,j), v) in self._filling.items():
999
+ for (i, j), v in self._filling.items():
1000
1000
  if v != 0:
1001
1001
  if v == 1:
1002
1002
  if w[i] == 0:
@@ -1044,7 +1044,7 @@ class GrowthDiagram(SageObject):
1044
1044
  raise ValueError("can only convert fillings of rectangular shapes to words")
1045
1045
  w1 = []
1046
1046
  w2 = []
1047
- for ((i,j), v) in sorted(self._filling.items()):
1047
+ for (i, j), v in sorted(self._filling.items()):
1048
1048
  if v >= 0:
1049
1049
  w1.extend([i+1]*v)
1050
1050
  w2.extend([j+1]*v)
@@ -1410,13 +1410,13 @@ class GrowthDiagram(SageObject):
1410
1410
  if isinstance(v, dict):
1411
1411
  # it is a dict of dicts
1412
1412
  F = dict()
1413
- for (i, row) in filling.items():
1414
- for (j, v) in row.items():
1413
+ for i, row in filling.items():
1414
+ for j, v in row.items():
1415
1415
  if v != 0:
1416
- F[(i,j)] = int(v)
1416
+ F[(i, j)] = int(v)
1417
1417
  else:
1418
1418
  # it is dict of coordinates
1419
- F = {(i,j): v for ((i,j), v) in filling.items()
1419
+ F = {(i, j): v for (i, j), v in filling.items()
1420
1420
  if v != 0}
1421
1421
  except StopIteration:
1422
1422
  # it is an empty dict of coordinates
@@ -3005,7 +3005,7 @@ class RuleSylvester(Rule):
3005
3005
  sage: Sylvester.rank(Sylvester.vertices(3)[0])
3006
3006
  3
3007
3007
  """
3008
- return v.node_number()
3008
+ return v.number_of_nodes()
3009
3009
 
3010
3010
  def is_Q_edge(self, v, w):
3011
3011
  r"""
@@ -3149,7 +3149,7 @@ class RuleSylvester(Rule):
3149
3149
  """
3150
3150
  def add_label(L, S, T, m):
3151
3151
  if L.is_empty():
3152
- assert T.node_number() == 1
3152
+ assert T.number_of_nodes() == 1
3153
3153
  return LabelledBinaryTree([], m)
3154
3154
  l = L.label()
3155
3155
  if T[0] == S[0]:
@@ -4258,9 +4258,9 @@ class RuleDomino(Rule):
4258
4258
  r"""
4259
4259
  Return the union of the two partitions.
4260
4260
  """
4261
- return [max(p,q) for (p,q) in zip_longest(la, mu, fillvalue=0)]
4261
+ return [max(p, q) for p, q in zip_longest(la, mu, fillvalue=0)]
4262
4262
 
4263
- if content not in [0,1,-1]:
4263
+ if content not in [0, 1, -1]:
4264
4264
  raise ValueError("domino: the content of the filling must be in {-1,0,1}")
4265
4265
 
4266
4266
  if content == 1:
@@ -4294,7 +4294,7 @@ class RuleDomino(Rule):
4294
4294
  elif len(diff) == 1:
4295
4295
  z = copy(x)
4296
4296
  # diff is a single cell
4297
- (k,l) = diff.pop()
4297
+ k, l = diff.pop()
4298
4298
  # add (k+1, l+1) to x
4299
4299
  # either (k, l+1) or (k+1, l) must also be added
4300
4300
  if z[k] <= l + 1:
@@ -15,7 +15,7 @@ Hall polynomials
15
15
  #
16
16
  # The full text of the GPL is available at:
17
17
  #
18
- # http://www.gnu.org/licenses/
18
+ # https://www.gnu.org/licenses/
19
19
  # ****************************************************************************
20
20
 
21
21
  from sage.misc.misc_c import prod
@@ -569,7 +569,7 @@ def hillman_grassl(M):
569
569
  col_j_hook_mults += [(r, j)] * entry
570
570
  hook_mults += reversed(col_j_hook_mults)
571
571
  res = [[0] * rowlen for rowlen in lam]
572
- for (r, s) in reversed(hook_mults):
572
+ for r, s in reversed(hook_mults):
573
573
  i = r
574
574
  j = lam[r] - 1
575
575
  while True: