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
@@ -290,7 +290,7 @@ class qCommutingPolynomials(qCommutingPolynomials_generic):
290
290
  indices = FreeAbelianMonoid(len(names), names)
291
291
  qCommutingPolynomials_generic.__init__(self, q, B, indices, indices.variable_names())
292
292
 
293
- def _repr_(self):
293
+ def _repr_(self) -> str:
294
294
  r"""
295
295
  Return a string representation of ``self``.
296
296
 
@@ -308,7 +308,7 @@ class qCommutingPolynomials(qCommutingPolynomials_generic):
308
308
  names = ", ".join(self.variable_names())
309
309
  return "{}-commuting polynomial ring in {} over {} with matrix:\n{}".format(self._q, names, self.base_ring(), self._B)
310
310
 
311
- def _latex_(self):
311
+ def _latex_(self) -> str:
312
312
  r"""
313
313
  Return a latex representation of ``self``.
314
314
 
@@ -467,7 +467,7 @@ class qCommutingLaurentPolynomials(qCommutingPolynomials_generic):
467
467
  self._display_group = FreeGroup(names=names, abelian=True, bracket=False)
468
468
  qCommutingPolynomials_generic.__init__(self, q, B, indices, names)
469
469
 
470
- def _repr_(self):
470
+ def _repr_(self) -> str:
471
471
  r"""
472
472
  Return a string representation of ``self``.
473
473
 
@@ -485,7 +485,7 @@ class qCommutingLaurentPolynomials(qCommutingPolynomials_generic):
485
485
  names = ", ".join(self.variable_names())
486
486
  return "{}-commuting Laurent polynomial ring in {} over {} with matrix:\n{}".format(self._q, names, self.base_ring(), self._B)
487
487
 
488
- def _latex_(self):
488
+ def _latex_(self) -> str:
489
489
  r"""
490
490
  Return a latex representation of ``self``.
491
491
 
@@ -500,7 +500,7 @@ class qCommutingLaurentPolynomials(qCommutingPolynomials_generic):
500
500
  names = ", ".join(r"{}^{{\pm}}".format(v) for v in self.variable_names())
501
501
  return "{}[{}]_{{{}}}".format(latex(self.base_ring()), names, self._q)
502
502
 
503
- def _repr_term(self, m):
503
+ def _repr_term(self, m) -> str:
504
504
  r"""
505
505
  Return a latex representation of the basis element indexed by ``m``.
506
506
 
@@ -520,7 +520,7 @@ class qCommutingLaurentPolynomials(qCommutingPolynomials_generic):
520
520
  G = self._display_group
521
521
  return repr(G.prod(g ** val for g, val in zip(G.gens(), m) if val != 0))
522
522
 
523
- def _latex_term(self, m):
523
+ def _latex_term(self, m) -> str:
524
524
  r"""
525
525
  Return a latex representation of the basis element indexed by ``m``.
526
526
 
sage/algebras/q_system.py CHANGED
@@ -181,7 +181,7 @@ class QSystem(CombinatorialFreeModule):
181
181
  CombinatorialFreeModule.__init__(self, base_ring, basis,
182
182
  prefix='Q', category=category)
183
183
 
184
- def _repr_(self):
184
+ def _repr_(self) -> str:
185
185
  r"""
186
186
  Return a string representation of ``self``.
187
187
 
@@ -201,7 +201,7 @@ class QSystem(CombinatorialFreeModule):
201
201
  res += "Twisted "
202
202
  return "{}Q-system of type {} over {}".format(res, self._cartan_type, self.base_ring())
203
203
 
204
- def _repr_term(self, t):
204
+ def _repr_term(self, t) -> str:
205
205
  """
206
206
  Return a string representation of the basis element indexed by ``t``.
207
207
 
@@ -222,7 +222,7 @@ class QSystem(CombinatorialFreeModule):
222
222
  return ret
223
223
  return '*'.join(repr_gen(x) for x in t._sorted_items())
224
224
 
225
- def _latex_term(self, t):
225
+ def _latex_term(self, t) -> str:
226
226
  r"""
227
227
  Return a `\LaTeX` representation of the basis element indexed
228
228
  by ``t``.
@@ -8,7 +8,7 @@ AUTHORS:
8
8
  - Travis Scrimshaw (2021-05): initial version
9
9
  """
10
10
 
11
- #*****************************************************************************
11
+ # ***************************************************************************
12
12
  # Copyright (C) 2021 Travis Scrimshaw <tcscrims at gmail.com>
13
13
  #
14
14
  # This program is free software: you can redistribute it and/or modify
@@ -16,7 +16,7 @@ AUTHORS:
16
16
  # the Free Software Foundation, either version 2 of the License, or
17
17
  # (at your option) any later version.
18
18
  # https://www.gnu.org/licenses/
19
- #*****************************************************************************
19
+ # ***************************************************************************
20
20
 
21
21
  from sage.misc.cachefunc import cached_method
22
22
  from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
@@ -191,7 +191,7 @@ class QuantumCliffordAlgebra(CombinatorialFreeModule):
191
191
  CombinatorialFreeModule.__init__(self, F, indices, category=cat)
192
192
  self._assign_names(self.algebra_generators().keys())
193
193
 
194
- def _repr_(self):
194
+ def _repr_(self) -> str:
195
195
  r"""
196
196
  Return a string representation of ``self``.
197
197
 
@@ -204,7 +204,7 @@ class QuantumCliffordAlgebra(CombinatorialFreeModule):
204
204
  return "Quantum Clifford algebra of rank {} and twist {} with q={} over {}".format(
205
205
  self._n, self._k, self._q, self.base_ring())
206
206
 
207
- def _latex_(self):
207
+ def _latex_(self) -> str:
208
208
  r"""
209
209
  Return a latex representation of ``self``.
210
210
 
@@ -381,7 +381,7 @@ class QuantumCliffordAlgebraGeneric(QuantumCliffordAlgebra):
381
381
  for w in product(*[list(range((4-2*abs(p[i]))*k)) for i in range(n)])]
382
382
  super().__init__(n, k, q, F, psi, indices)
383
383
 
384
- def _repr_term(self, m):
384
+ def _repr_term(self, m) -> str:
385
385
  r"""
386
386
  Return a string representation of the basis element indexed by ``m``.
387
387
 
@@ -413,7 +413,7 @@ class QuantumCliffordAlgebraGeneric(QuantumCliffordAlgebra):
413
413
  return rv
414
414
  return '1'
415
415
 
416
- def _latex_term(self, m):
416
+ def _latex_term(self, m) -> str:
417
417
  r"""
418
418
  Return a latex representation for the basis element indexed by ``m``.
419
419
 
@@ -681,7 +681,7 @@ class QuantumCliffordAlgebraRootUnity(QuantumCliffordAlgebra):
681
681
  for w in product(list(range(2*k)), repeat=n)]
682
682
  super().__init__(n, k, q, F, psi, indices)
683
683
 
684
- def _repr_term(self, m):
684
+ def _repr_term(self, m) -> str:
685
685
  r"""
686
686
  Return a string representation of the basis element indexed by ``m``.
687
687
 
@@ -722,7 +722,7 @@ class QuantumCliffordAlgebraRootUnity(QuantumCliffordAlgebra):
722
722
  return rv
723
723
  return '1'
724
724
 
725
- def _latex_term(self, m):
725
+ def _latex_term(self, m) -> str:
726
726
  r"""
727
727
  Return a latex representation for the basis element indexed by ``m``.
728
728
 
@@ -1326,6 +1326,20 @@ class FockSpace(Parent, UniqueRepresentation):
1326
1326
  |3> + q*|2, 1>
1327
1327
  sage: G._G_to_fock_basis(Partition([2,1]))
1328
1328
  |2, 1> + q*|1, 1, 1>
1329
+
1330
+ TESTS:
1331
+
1332
+ Check that :issue:`41408` is fixed::
1333
+
1334
+ sage: Fock = FockSpace(3, [0, 1])
1335
+ sage: G = Fock.G()
1336
+ sage: la = PartitionTuple([[6], [5,5,1]])
1337
+ sage: v = G._G_to_fock_basis(la)
1338
+ sage: len(v.support())
1339
+ 261
1340
+ sage: v
1341
+ |[6], [5, 5, 1]> + q*|[6], [5, 4, 1, 1]> + q*|[6], [5, 3, 3]>
1342
+ + ... + q^7*|[], [3, 3, 3, 2, 1, 1, 1, 1, 1, 1]>
1329
1343
  """
1330
1344
  # Special case for the empty partition
1331
1345
  if la.size() == 0:
@@ -1355,13 +1369,40 @@ class FockSpace(Parent, UniqueRepresentation):
1355
1369
  return fock.sum_of_terms((fock._indices([[]]*k + list(pt)), c) for pt,c in cur)
1356
1370
 
1357
1371
  cur = R.A()._A_to_fock_basis(la)
1358
- s = sorted(cur.support()) # Sort lex, which respects dominance order
1359
- s.pop() # Remove the largest
1372
+
1373
+ def domorder_insertion(data, elt):
1374
+ """
1375
+ Add ``elt`` at the largest position of ``data`` such that
1376
+ it dominants all larger entries.
1377
+ """
1378
+ for i in range(len(data)-1, -1, -1):
1379
+ if not data[i].dominates(elt):
1380
+ data.insert(i+1, elt)
1381
+ return
1382
+ data.insert(0, elt)
1383
+
1384
+ # Build the elimination list s so that whenever y.dominates(x),
1385
+ # y appears after x.
1386
+ if len(R._multicharge) == 1:
1387
+ s = [x for x in cur.support() if x in self._indices]
1388
+ s.sort() # Sort lex, which respects dominance order
1389
+ s.pop() # Remove the largest
1390
+ else:
1391
+ # In level > 1, the default comparison on PartitionTuples is lexicographic
1392
+ # and does not necessarily refine dominance order.
1393
+ s = []
1394
+ for x in cur.support():
1395
+ if x == la or x not in self._indices:
1396
+ continue
1397
+ domorder_insertion(s, x)
1360
1398
 
1361
1399
  q = R._q
1400
+
1362
1401
  while s:
1363
1402
  mu = s.pop()
1403
+ # assert mu in self._indices
1364
1404
  d = cur[mu].denominator()
1405
+
1365
1406
  k = d.degree()
1366
1407
  n = cur[mu].numerator()
1367
1408
  if k != 0 or n.constant_coefficient() != 0:
@@ -1370,14 +1411,13 @@ class FockSpace(Parent, UniqueRepresentation):
1370
1411
  gamma += n[k]
1371
1412
  cur -= gamma * self._G_to_fock_basis(mu)
1372
1413
 
1373
- # Add any new support elements
1374
1414
  for x in cur.support():
1375
- if x == mu or not mu.dominates(x): # Add only things (strictly) dominated by mu
1415
+ # Add only new support elements that are (strictly) dominanted by mu
1416
+ # and correspond to crystal basis elements.
1417
+ if x == mu or x in s or not mu.dominates(x) or x not in self._indices:
1376
1418
  continue
1377
- for i in reversed(range(len(s))):
1378
- if not s[i].dominates(x):
1379
- s.insert(i+1, x)
1380
- break
1419
+ domorder_insertion(s, x)
1420
+
1381
1421
  return cur
1382
1422
 
1383
1423
  lower_global_crystal = G
@@ -199,7 +199,7 @@ class QuaGroupModuleElement(Element):
199
199
  """
200
200
  return self._libgap
201
201
 
202
- _libgap_ = _gap_ = gap
202
+ _libgap_ = gap
203
203
 
204
204
  def _add_(self, other):
205
205
  r"""
@@ -433,7 +433,7 @@ class QuantumGroup(UniqueRepresentation, Parent):
433
433
  """
434
434
  return self._libgap
435
435
 
436
- _libgap_ = _gap_ = gap
436
+ _libgap_ = gap
437
437
 
438
438
  def cartan_type(self):
439
439
  """
@@ -1603,7 +1603,7 @@ class QuantumGroupModule(Parent, UniqueRepresentation):
1603
1603
  """
1604
1604
  return self._libgap
1605
1605
 
1606
- _libgap_ = _gap_ = gap
1606
+ _libgap_ = gap
1607
1607
 
1608
1608
  def _element_constructor_(self, elt):
1609
1609
  """
@@ -2355,8 +2355,7 @@ class LowerHalfQuantumGroup(Parent, UniqueRepresentation):
2355
2355
  sage: Q = QuantumGroup(['A',2])
2356
2356
  sage: B = Q.lower_half()
2357
2357
  sage: basis = B.basis(); basis
2358
- Lazy family (monomial(i))_{i in The Cartesian product of
2359
- (Non negative integers, Non negative integers, Non negative integers)}
2358
+ Lazy family (monomial(i))_{i in The Cartesian product of 3 copies of Non negative integers}
2360
2359
  sage: basis[1,2,1]
2361
2360
  F[a1]*F[a1+a2]^(2)*F[a2]
2362
2361
  sage: basis[1,2,4]
@@ -2391,8 +2390,7 @@ class LowerHalfQuantumGroup(Parent, UniqueRepresentation):
2391
2390
  sage: Q = QuantumGroup(['A',2])
2392
2391
  sage: B = Q.lower_half()
2393
2392
  sage: C = B.canonical_basis_elements(); C
2394
- Lazy family (Canonical basis(i))_{i in The Cartesian product of
2395
- (Non negative integers, Non negative integers)}
2393
+ Lazy family (Canonical basis(i))_{i in The Cartesian product of 2 copies of Non negative integers}
2396
2394
  sage: C[2,1]
2397
2395
  [F[a1]^(2)*F[a2], F[a1]*F[a1+a2] + (q^2)*F[a1]^(2)*F[a2]]
2398
2396
  sage: C[1,2]
@@ -84,7 +84,7 @@ class QuantumMatrixCoordinateAlgebra_abstract(CombinatorialFreeModule):
84
84
  indices = IndexedFreeAbelianMonoid(gp_indices, sorting_key=indices_key)
85
85
  CombinatorialFreeModule.__init__(self, R, indices, category=category)
86
86
 
87
- def _repr_term(self, m):
87
+ def _repr_term(self, m) -> str:
88
88
  r"""
89
89
  Return a string representation of the term indexed by ``m``.
90
90
 
@@ -110,7 +110,7 @@ class QuantumMatrixCoordinateAlgebra_abstract(CombinatorialFreeModule):
110
110
  return '*'.join(('x[{},{}]'.format(*k) if k != 'c' else 'c') + exp(e)
111
111
  for k, e in m._sorted_items())
112
112
 
113
- def _latex_term(self, m):
113
+ def _latex_term(self, m) -> str:
114
114
  r"""
115
115
  Return a latex representation of the term indexed by ``m``.
116
116
 
@@ -283,7 +283,7 @@ class QuantumMatrixCoordinateAlgebra_abstract(CombinatorialFreeModule):
283
283
  if ax[0] < bx[0]:
284
284
  # In order, so nothing more to do
285
285
  break
286
- elif ax[0] == bx[0]:
286
+ if ax[0] == bx[0]:
287
287
  if ax[1] > bx[1]:
288
288
  # x_{it} x_{ij} = q^{-1} x_{ij} x_{it} if t < j
289
289
  coeff *= qi ** (ae * be)
@@ -542,7 +542,7 @@ class QuantumMatrixCoordinateAlgebra(QuantumMatrixCoordinateAlgebra_abstract):
542
542
  names = [base.format(*k) for k in gp_indices]
543
543
  self._assign_names(names)
544
544
 
545
- def _repr_(self):
545
+ def _repr_(self) -> str:
546
546
  r"""
547
547
  Return a string representation of ``self``.
548
548
 
@@ -559,7 +559,7 @@ class QuantumMatrixCoordinateAlgebra(QuantumMatrixCoordinateAlgebra_abstract):
559
559
  txt = "Quantized coordinate algebra of M({}, {}) with q={} over {}"
560
560
  return txt.format(self._m, self._n, self._q, self.base_ring())
561
561
 
562
- def _latex_(self):
562
+ def _latex_(self) -> str:
563
563
  r"""
564
564
  Return a latex representation of ``self``.
565
565
 
@@ -764,7 +764,7 @@ class QuantumGL(QuantumMatrixCoordinateAlgebra_abstract):
764
764
  names.append('c')
765
765
  self._assign_names(names)
766
766
 
767
- def _repr_(self):
767
+ def _repr_(self) -> str:
768
768
  r"""
769
769
  Return a string representation of ``self``.
770
770
 
@@ -777,7 +777,7 @@ class QuantumGL(QuantumMatrixCoordinateAlgebra_abstract):
777
777
  txt = "Quantized coordinate algebra of GL({}) with q={} over {}"
778
778
  return txt.format(self._n, self._q, self.base_ring())
779
779
 
780
- def _latex_(self):
780
+ def _latex_(self) -> str:
781
781
  r"""
782
782
  Return a latex representation of ``self``.
783
783
 
@@ -175,7 +175,7 @@ class QuantumOscillatorAlgebra(CombinatorialFreeModule):
175
175
  return "Quantum oscillator algebra with q={} over {}".format(
176
176
  self._q, self.base_ring())
177
177
 
178
- def _latex_(self):
178
+ def _latex_(self) -> str:
179
179
  r"""
180
180
  Return a latex representation of ``self``.
181
181
 
@@ -327,7 +327,7 @@ class QuantumOscillatorAlgebra(CombinatorialFreeModule):
327
327
  return kstr
328
328
  return '1'
329
329
 
330
- def _latex_term(self, m):
330
+ def _latex_term(self, m) -> str:
331
331
  r"""
332
332
  Return a latex representation for the basis element indexed by ``m``.
333
333
 
@@ -533,7 +533,7 @@ class FockSpaceRepresentation(CombinatorialFreeModule):
533
533
  """
534
534
  return "Fock space representation of {}".format(self._O)
535
535
 
536
- def _latex_(self):
536
+ def _latex_(self) -> str:
537
537
  r"""
538
538
  Return a latex representation of ``self``.
539
539
 
@@ -5,9 +5,11 @@
5
5
  # Backward compatible unpickle functions
6
6
  #######################################################################
7
7
 
8
- from .quatalg.quaternion_algebra_element import (QuaternionAlgebraElement_generic,
9
- QuaternionAlgebraElement_rational_field,
10
- QuaternionAlgebraElement_number_field)
8
+ from sage.algebras.quatalg.quaternion_algebra_element import (
9
+ QuaternionAlgebraElement_generic,
10
+ QuaternionAlgebraElement_number_field,
11
+ QuaternionAlgebraElement_rational_field,
12
+ )
11
13
 
12
14
 
13
15
  def unpickle_QuaternionAlgebraElement_generic_v0(*args):
@@ -245,7 +245,7 @@ class SchurAlgebra(CombinatorialFreeModule):
245
245
  prefix='S', bracket=False,
246
246
  category=AlgebrasWithBasis(R).FiniteDimensional())
247
247
 
248
- def _repr_(self):
248
+ def _repr_(self) -> str:
249
249
  """
250
250
  Return the string representation of ``self``.
251
251
 
@@ -432,7 +432,7 @@ class SchurTensorModule(CombinatorialFreeModule_Tensor):
432
432
  g = self._schur.module_morphism(self._monomial_product, codomain=self)
433
433
  self._schur_action = self.module_morphism(g, codomain=self, position=1)
434
434
 
435
- def _repr_(self):
435
+ def _repr_(self) -> str:
436
436
  """
437
437
  Return the string representation of ``self``.
438
438
 
@@ -457,7 +457,7 @@ class SchurTensorModule(CombinatorialFreeModule_Tensor):
457
457
  sage: T = SchurTensorModule(QQ, 2, 3)
458
458
  sage: T.construction()
459
459
  """
460
- return None
460
+ return
461
461
 
462
462
  def _monomial_product(self, xi, v):
463
463
  """
@@ -187,7 +187,7 @@ class ShuffleAlgebra(CombinatorialFreeModule):
187
187
  """
188
188
  return self._alphabet
189
189
 
190
- def _repr_term(self, t):
190
+ def _repr_term(self, t) -> str:
191
191
  """
192
192
  Return a string representation of the basis element indexed by ``t``.
193
193
 
@@ -199,7 +199,7 @@ class ShuffleAlgebra(CombinatorialFreeModule):
199
199
  """
200
200
  return "{!s}[{!s}]".format(self._print_options['prefix'], repr(t)[6:])
201
201
 
202
- def _repr_(self):
202
+ def _repr_(self) -> str:
203
203
  r"""
204
204
  Text representation of this shuffle algebra.
205
205
 
@@ -540,10 +540,7 @@ class ShuffleAlgebra(CombinatorialFreeModule):
540
540
  # shuffle algebras in the same variable over any base that coerces in:
541
541
  if isinstance(R, ShuffleAlgebra):
542
542
  if R.variable_names() == self.variable_names():
543
- if self.base_ring().has_coerce_map_from(R.base_ring()):
544
- return True
545
- else:
546
- return False
543
+ return self.base_ring().has_coerce_map_from(R.base_ring())
547
544
 
548
545
  if isinstance(R, DualPBWBasis):
549
546
  return self.has_coerce_map_from(R._alg)
@@ -691,7 +688,7 @@ class DualPBWBasis(CombinatorialFreeModule):
691
688
  CombinatorialFreeModule.__init__(self, R, Words(names), prefix='S',
692
689
  category=cat)
693
690
 
694
- def _repr_term(self, t):
691
+ def _repr_term(self, t) -> str:
695
692
  """
696
693
  Return a string representation of the basis element indexed by ``t``.
697
694
 
@@ -703,7 +700,7 @@ class DualPBWBasis(CombinatorialFreeModule):
703
700
  """
704
701
  return "{!s}[{!s}]".format(self._print_options['prefix'], repr(t)[6:])
705
702
 
706
- def _repr_(self):
703
+ def _repr_(self) -> str:
707
704
  """
708
705
  Return a string representation of ``self``.
709
706