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.
- passagemath_combinat/__init__.py +3 -0
- {passagemath_combinat-10.6.1.dist-info → passagemath_combinat-10.8.1a1.dist-info}/METADATA +17 -20
- {passagemath_combinat-10.6.1.dist-info → passagemath_combinat-10.8.1a1.dist-info}/RECORD +220 -218
- {passagemath_combinat-10.6.1.dist-info → passagemath_combinat-10.8.1a1.dist-info}/WHEEL +1 -1
- passagemath_combinat-10.8.1a1.dist-info/top_level.txt +3 -0
- sage/algebras/affine_nil_temperley_lieb.py +3 -3
- sage/algebras/all.py +0 -1
- sage/algebras/askey_wilson.py +1 -1
- sage/algebras/associated_graded.py +2 -2
- sage/algebras/cellular_basis.py +3 -6
- sage/algebras/cluster_algebra.py +2 -3
- sage/algebras/down_up_algebra.py +6 -6
- sage/algebras/free_algebra.py +3 -32
- sage/algebras/free_algebra_element.py +21 -25
- sage/algebras/free_algebra_quotient_element.py +9 -38
- sage/algebras/free_zinbiel_algebra.py +4 -3
- sage/algebras/hall_algebra.py +2 -2
- sage/algebras/hecke_algebras/ariki_koike_algebra.py +8 -8
- sage/algebras/hecke_algebras/ariki_koike_specht_modules.py +2 -2
- sage/algebras/hecke_algebras/cubic_hecke_algebra.py +11 -14
- sage/algebras/hecke_algebras/cubic_hecke_base_ring.py +1 -1
- sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py +5 -5
- sage/algebras/iwahori_hecke_algebra.py +59 -57
- sage/algebras/jordan_algebra.py +97 -89
- sage/algebras/lie_conformal_algebras/abelian_lie_conformal_algebra.py +6 -6
- sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py +14 -12
- sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py +6 -6
- sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py +4 -4
- sage/algebras/lie_conformal_algebras/finitely_freely_generated_lca.py +13 -13
- sage/algebras/lie_conformal_algebras/free_bosons_lie_conformal_algebra.py +8 -6
- sage/algebras/lie_conformal_algebras/free_fermions_lie_conformal_algebra.py +7 -5
- sage/algebras/lie_conformal_algebras/freely_generated_lie_conformal_algebra.py +7 -7
- sage/algebras/lie_conformal_algebras/graded_lie_conformal_algebra.py +6 -5
- sage/algebras/lie_conformal_algebras/lie_conformal_algebra.py +12 -11
- sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py +3 -3
- sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_basis.py +3 -3
- sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py +11 -11
- sage/algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py +3 -3
- sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py +8 -7
- sage/algebras/lie_conformal_algebras/virasoro_lie_conformal_algebra.py +9 -8
- sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py +6 -5
- sage/algebras/nil_coxeter_algebra.py +4 -4
- sage/algebras/q_commuting_polynomials.py +6 -6
- sage/algebras/q_system.py +3 -3
- sage/algebras/quantum_clifford.py +8 -8
- sage/algebras/quantum_groups/fock_space.py +48 -8
- sage/algebras/quantum_groups/quantum_group_gap.py +5 -7
- sage/algebras/quantum_matrix_coordinate_algebra.py +7 -7
- sage/algebras/quantum_oscillator.py +3 -3
- sage/algebras/quaternion_algebra_element.py +5 -3
- sage/algebras/schur_algebra.py +3 -3
- sage/algebras/shuffle_algebra.py +5 -8
- sage/algebras/splitting_algebra.py +129 -85
- sage/algebras/tensor_algebra.py +7 -7
- sage/algebras/yangian.py +16 -15
- sage/algebras/yokonuma_hecke_algebra.py +13 -11
- sage/combinat/all.py +9 -0
- sage/combinat/all__sagemath_combinat.py +1 -0
- sage/combinat/alternating_sign_matrix.py +36 -29
- sage/combinat/baxter_permutations.py +32 -12
- sage/combinat/bijectionist.py +13 -17
- sage/combinat/chas/fsym.py +6 -6
- sage/combinat/chas/wqsym.py +23 -29
- sage/combinat/colored_permutations.py +9 -11
- sage/combinat/colored_permutations_representations.py +13 -12
- sage/combinat/composition_tableau.py +2 -2
- sage/combinat/constellation.py +57 -30
- sage/combinat/crystals/affine_factorization.py +5 -4
- sage/combinat/crystals/alcove_path.py +2 -2
- sage/combinat/crystals/fully_commutative_stable_grothendieck.py +3 -2
- sage/combinat/crystals/infinity_crystals.py +18 -18
- sage/combinat/crystals/kac_modules.py +1 -1
- sage/combinat/crystals/kirillov_reshetikhin.py +2 -2
- sage/combinat/crystals/letters.cpython-312-aarch64-linux-musl.so +0 -0
- sage/combinat/crystals/littelmann_path.py +1 -1
- sage/combinat/crystals/pbw_datum.cpython-312-aarch64-linux-musl.so +0 -0
- sage/combinat/crystals/pbw_datum.pyx +3 -2
- sage/combinat/crystals/spins.cpython-312-aarch64-linux-musl.so +0 -0
- sage/combinat/crystals/tensor_product.py +7 -5
- sage/combinat/crystals/tensor_product_element.cpython-312-aarch64-linux-musl.so +0 -0
- sage/combinat/debruijn_sequence.cpython-312-aarch64-linux-musl.so +0 -0
- sage/combinat/debruijn_sequence.pyx +1 -2
- sage/combinat/degree_sequences.cpython-312-aarch64-linux-musl.so +0 -0
- sage/combinat/degree_sequences.pyx +241 -188
- sage/combinat/derangements.py +28 -22
- sage/combinat/diagram_algebras.py +12 -14
- sage/combinat/dyck_word.py +15 -14
- sage/combinat/e_one_star.py +1 -1
- sage/combinat/expnums.cpython-312-aarch64-linux-musl.so +0 -0
- sage/combinat/fast_vector_partitions.cpython-312-aarch64-linux-musl.so +0 -0
- sage/combinat/fqsym.py +13 -19
- sage/combinat/free_dendriform_algebra.py +2 -2
- sage/combinat/free_prelie_algebra.py +2 -2
- sage/combinat/fully_commutative_elements.py +8 -8
- sage/combinat/fully_packed_loop.py +9 -9
- sage/combinat/gelfand_tsetlin_patterns.py +4 -5
- sage/combinat/gray_codes.py +3 -4
- sage/combinat/grossman_larson_algebras.py +2 -2
- sage/combinat/growth.py +13 -13
- sage/combinat/hall_polynomial.py +1 -1
- sage/combinat/hillman_grassl.py +1 -1
- sage/combinat/integer_matrices.py +5 -7
- sage/combinat/k_tableau.py +8 -7
- sage/combinat/kazhdan_lusztig.py +3 -3
- sage/combinat/key_polynomial.py +845 -298
- sage/combinat/knutson_tao_puzzles.py +11 -13
- sage/combinat/matrices/hadamard_matrix.py +1 -1
- sage/combinat/matrices/latin.py +75 -92
- sage/combinat/misc.py +3 -3
- sage/combinat/multiset_partition_into_sets_ordered.py +27 -10
- sage/combinat/ncsf_qsym/generic_basis_code.py +5 -5
- sage/combinat/ncsf_qsym/ncsf.py +6 -5
- sage/combinat/ncsf_qsym/qsym.py +9 -17
- sage/combinat/ncsym/ncsym.py +8 -12
- sage/combinat/nu_dyck_word.py +1 -1
- sage/combinat/parallelogram_polyomino.py +3 -5
- sage/combinat/parking_functions.py +6 -5
- sage/combinat/partition_algebra.py +22 -57
- sage/combinat/partition_kleshchev.py +4 -4
- sage/combinat/partition_tuple.py +12 -10
- sage/combinat/plane_partition.py +10 -13
- sage/combinat/positive_integer_semigroup_test.py +17 -0
- sage/combinat/q_bernoulli.cpython-312-aarch64-linux-musl.so +0 -0
- sage/combinat/quickref.py +2 -2
- sage/combinat/recognizable_series.py +2 -2
- sage/combinat/regular_sequence.py +7 -7
- sage/combinat/regular_sequence_bounded.py +15 -21
- sage/combinat/restricted_growth.py +3 -3
- sage/combinat/ribbon.py +3 -3
- sage/combinat/rigged_configurations/bijection.py +3 -3
- sage/combinat/rigged_configurations/rigged_partition.cpython-312-aarch64-linux-musl.so +0 -0
- sage/combinat/rsk.py +2 -0
- sage/combinat/schubert_polynomial.py +11 -2
- sage/combinat/set_partition.py +3 -7
- sage/combinat/set_partition_iterator.cpython-312-aarch64-linux-musl.so +0 -0
- sage/combinat/set_partition_iterator.pyx +0 -1
- sage/combinat/set_partition_ordered.py +2 -2
- sage/combinat/sf/classical.py +1 -1
- sage/combinat/sf/dual.py +4 -8
- sage/combinat/sf/elementary.py +13 -7
- sage/combinat/sf/hall_littlewood.py +10 -8
- sage/combinat/sf/homogeneous.py +6 -3
- sage/combinat/sf/jack.py +11 -9
- sage/combinat/sf/llt.py +4 -5
- sage/combinat/sf/macdonald.py +10 -11
- sage/combinat/sf/monomial.py +6 -0
- sage/combinat/sf/ns_macdonald.py +92 -51
- sage/combinat/sf/powersum.py +9 -14
- sage/combinat/sf/schur.py +6 -0
- sage/combinat/sf/sf.py +21 -19
- sage/combinat/sf/sfa.py +13 -64
- sage/combinat/shifted_primed_tableau.py +5 -7
- sage/combinat/shuffle.py +1 -1
- sage/combinat/sine_gordon.py +18 -38
- sage/combinat/skew_partition.py +9 -12
- sage/combinat/skew_tableau.py +2 -7
- sage/combinat/sloane_functions.py +1 -1
- sage/combinat/species/all.py +67 -2
- sage/combinat/species/characteristic_species.py +3 -0
- sage/combinat/species/composition_species.py +3 -0
- sage/combinat/species/cycle_species.py +4 -0
- sage/combinat/species/empty_species.py +3 -0
- sage/combinat/species/functorial_composition_species.py +3 -0
- sage/combinat/species/generating_series.py +3 -0
- sage/combinat/species/library.py +3 -0
- sage/combinat/species/linear_order_species.py +3 -0
- sage/combinat/species/partition_species.py +3 -0
- sage/combinat/species/permutation_species.py +4 -0
- sage/combinat/species/product_species.py +3 -0
- sage/combinat/species/recursive_species.py +3 -0
- sage/combinat/species/set_species.py +3 -0
- sage/combinat/species/species.py +13 -7
- sage/combinat/species/structure.py +8 -9
- sage/combinat/species/subset_species.py +3 -0
- sage/combinat/species/sum_species.py +3 -0
- sage/combinat/subword.py +4 -1
- sage/combinat/subword_complex.py +7 -7
- sage/combinat/subword_complex_c.cpython-312-aarch64-linux-musl.so +0 -0
- sage/combinat/superpartition.py +1 -1
- sage/combinat/symmetric_group_algebra.py +9 -9
- sage/combinat/symmetric_group_representations.py +5 -5
- sage/combinat/t_sequences.py +4 -4
- sage/combinat/tableau.py +3 -4
- sage/combinat/tableau_tuple.py +2 -2
- sage/combinat/tiling.py +39 -42
- sage/combinat/triangles_FHM.py +38 -15
- sage/combinat/tutorial.py +2 -2
- sage/combinat/vector_partition.py +43 -31
- sage/combinat/words/abstract_word.py +4 -4
- sage/combinat/words/alphabet.py +12 -12
- sage/combinat/words/finite_word.py +25 -229
- sage/combinat/words/infinite_word.py +1 -1
- sage/combinat/words/morphic.py +13 -13
- sage/combinat/words/morphism.py +3 -12
- sage/combinat/words/paths.py +16 -17
- sage/combinat/words/word.py +60 -35
- sage/combinat/words/word_char.cpython-312-aarch64-linux-musl.so +0 -0
- sage/combinat/words/word_char.pyx +46 -7
- sage/combinat/words/word_datatypes.cpython-312-aarch64-linux-musl.so +0 -0
- sage/combinat/words/word_generators.py +39 -38
- sage/databases/findstat.py +72 -31
- sage/databases/oeis.py +125 -25
- sage/databases/sloane.py +14 -8
- sage/games/sudoku_backtrack.cpython-312-aarch64-linux-musl.so +0 -0
- sage/groups/indexed_free_group.py +3 -4
- sage/libs/symmetrica/symmetrica.cpython-312-aarch64-linux-musl.so +0 -0
- sage/libs/symmetrica/symmetrica.pxi +1 -0
- sage/monoids/automatic_semigroup.py +1 -3
- sage/monoids/free_abelian_monoid.py +7 -33
- sage/monoids/free_abelian_monoid_element.cpython-312-aarch64-linux-musl.so +0 -0
- sage/monoids/free_monoid.py +8 -40
- sage/monoids/free_monoid_element.py +1 -9
- sage/monoids/string_monoid.py +5 -2
- sage/monoids/string_monoid_element.py +12 -66
- sage/rings/all__sagemath_combinat.py +7 -0
- sage/sat/solvers/__init__.py +3 -4
- sage/sat/solvers/cryptominisat.py +2 -3
- sage/sat/solvers/picosat.py +2 -3
- sage/sat/solvers/sat_lp.py +2 -2
- sage/sat/solvers/satsolver.cpython-312-aarch64-linux-musl.so +0 -0
- passagemath_combinat-10.6.1.dist-info/top_level.txt +0 -2
|
@@ -276,11 +276,11 @@ class YokonumaHeckeAlgebraGL(YokonumaHeckeAlgebra):
|
|
|
276
276
|
self._n = n
|
|
277
277
|
W = Permutations(n)
|
|
278
278
|
import itertools
|
|
279
|
-
C = itertools.product(*([range(d)]*n))
|
|
279
|
+
C = itertools.product(*([range(d)] * n))
|
|
280
280
|
indices = list(itertools.product(C, W))
|
|
281
281
|
YokonumaHeckeAlgebra.__init__(self, d, W, q, R, indices)
|
|
282
282
|
|
|
283
|
-
def _repr_(self):
|
|
283
|
+
def _repr_(self) -> str:
|
|
284
284
|
"""
|
|
285
285
|
Return a string representation of ``self``.
|
|
286
286
|
|
|
@@ -293,7 +293,7 @@ class YokonumaHeckeAlgebraGL(YokonumaHeckeAlgebra):
|
|
|
293
293
|
return "Yokonuma-Hecke algebra of rank {} and order {} with q={} over {}".format(
|
|
294
294
|
self._d, self._n, self._q, self.base_ring())
|
|
295
295
|
|
|
296
|
-
def _latex_(self):
|
|
296
|
+
def _latex_(self) -> str:
|
|
297
297
|
r"""
|
|
298
298
|
Return a latex representation of ``self``.
|
|
299
299
|
|
|
@@ -305,7 +305,7 @@ class YokonumaHeckeAlgebraGL(YokonumaHeckeAlgebra):
|
|
|
305
305
|
"""
|
|
306
306
|
return "\\mathcal{Y}_{%s,%s}(%s)" % (self._d, self._n, self._q)
|
|
307
307
|
|
|
308
|
-
def _repr_term(self, m):
|
|
308
|
+
def _repr_term(self, m) -> str:
|
|
309
309
|
"""
|
|
310
310
|
Return a string representation of the basis element indexed by ``m``.
|
|
311
311
|
|
|
@@ -317,7 +317,8 @@ class YokonumaHeckeAlgebraGL(YokonumaHeckeAlgebra):
|
|
|
317
317
|
"""
|
|
318
318
|
def gen_str(e):
|
|
319
319
|
return '' if e == 1 else '^%s' % e
|
|
320
|
-
lhs = '*'.join('t%s' % (j+1) + gen_str(i)
|
|
320
|
+
lhs = '*'.join('t%s' % (j + 1) + gen_str(i)
|
|
321
|
+
for j, i in enumerate(m[0]) if i > 0)
|
|
321
322
|
redword = m[1].reduced_word()
|
|
322
323
|
if not redword:
|
|
323
324
|
if not lhs:
|
|
@@ -328,7 +329,7 @@ class YokonumaHeckeAlgebraGL(YokonumaHeckeAlgebra):
|
|
|
328
329
|
return rhs
|
|
329
330
|
return lhs + '*' + rhs
|
|
330
331
|
|
|
331
|
-
def _latex_term(self, m):
|
|
332
|
+
def _latex_term(self, m) -> str:
|
|
332
333
|
r"""
|
|
333
334
|
Return a latex representation for the basis element indexed by ``m``.
|
|
334
335
|
|
|
@@ -340,7 +341,8 @@ class YokonumaHeckeAlgebraGL(YokonumaHeckeAlgebra):
|
|
|
340
341
|
"""
|
|
341
342
|
def gen_str(e):
|
|
342
343
|
return '' if e == 1 else '^{%s}' % e
|
|
343
|
-
lhs = ' '.join('t_{%s}' % (j+1) + gen_str(i)
|
|
344
|
+
lhs = ' '.join('t_{%s}' % (j + 1) + gen_str(i)
|
|
345
|
+
for j, i in enumerate(m[0]) if i > 0)
|
|
344
346
|
redword = m[1].reduced_word()
|
|
345
347
|
if not redword:
|
|
346
348
|
if not lhs:
|
|
@@ -689,7 +691,7 @@ class YokonumaHeckeAlgebraWeyl(YokonumaHeckeAlgebra):
|
|
|
689
691
|
indices = cartesian_product([self._Q, W])
|
|
690
692
|
YokonumaHeckeAlgebra.__init__(self, d, W, q, R, indices)
|
|
691
693
|
|
|
692
|
-
def _repr_(self):
|
|
694
|
+
def _repr_(self) -> str:
|
|
693
695
|
"""
|
|
694
696
|
Return a string representation of ``self``.
|
|
695
697
|
|
|
@@ -702,7 +704,7 @@ class YokonumaHeckeAlgebraWeyl(YokonumaHeckeAlgebra):
|
|
|
702
704
|
return "Yokonuma-Hecke algebra of rank {} for {} with q={} over {}".format(
|
|
703
705
|
self._d, self._cartan_type, self._q, self.base_ring())
|
|
704
706
|
|
|
705
|
-
def _latex_(self):
|
|
707
|
+
def _latex_(self) -> str:
|
|
706
708
|
r"""
|
|
707
709
|
Return a latex representation of ``self``.
|
|
708
710
|
|
|
@@ -715,7 +717,7 @@ class YokonumaHeckeAlgebraWeyl(YokonumaHeckeAlgebra):
|
|
|
715
717
|
from sage.misc.latex import latex
|
|
716
718
|
return "\\mathcal{Y}_{%s,%s}(%s)" % (self._d, latex(self._cartan_type), self._q)
|
|
717
719
|
|
|
718
|
-
def _repr_term(self, m):
|
|
720
|
+
def _repr_term(self, m) -> str:
|
|
719
721
|
"""
|
|
720
722
|
Return a string representation of the basis element indexed by ``m``.
|
|
721
723
|
|
|
@@ -741,7 +743,7 @@ class YokonumaHeckeAlgebraWeyl(YokonumaHeckeAlgebra):
|
|
|
741
743
|
return rhs
|
|
742
744
|
return lhs + '*' + rhs
|
|
743
745
|
|
|
744
|
-
def _latex_term(self, m):
|
|
746
|
+
def _latex_term(self, m) -> str:
|
|
745
747
|
r"""
|
|
746
748
|
Return a latex representation for the basis element indexed by ``m``.
|
|
747
749
|
|
sage/combinat/all.py
CHANGED
|
@@ -11,6 +11,15 @@ Introduction
|
|
|
11
11
|
Topics
|
|
12
12
|
------
|
|
13
13
|
|
|
14
|
+
- :ref:`sage.combinat.algebraic_combinatorics`
|
|
15
|
+
|
|
16
|
+
- :ref:`sage.combinat.chas.all`
|
|
17
|
+
- :ref:`sage.combinat.cluster_algebra_quiver.all`
|
|
18
|
+
- :ref:`sage.combinat.crystals.all`
|
|
19
|
+
- :ref:`sage.combinat.root_system.all`
|
|
20
|
+
- :ref:`sage.combinat.sf.all`
|
|
21
|
+
- :ref:`sage.combinat.fully_commutative_elements`
|
|
22
|
+
|
|
14
23
|
- :ref:`sage.combinat.counting`
|
|
15
24
|
- :ref:`sage.combinat.enumerated_sets`
|
|
16
25
|
- :ref:`sage.combinat.catalog_partitions`
|
|
@@ -14,6 +14,7 @@ from sage.combinat.debruijn_sequence import DeBruijnSequences
|
|
|
14
14
|
|
|
15
15
|
lazy_import('sage.combinat.schubert_polynomial', 'SchubertPolynomialRing')
|
|
16
16
|
lazy_import('sage.combinat.key_polynomial', 'KeyPolynomialBasis', as_='KeyPolynomials')
|
|
17
|
+
lazy_import('sage.combinat.key_polynomial', 'AtomPolynomialBasis', as_='AtomPolynomials')
|
|
17
18
|
lazy_import('sage.combinat.symmetric_group_algebra', [
|
|
18
19
|
'SymmetricGroupAlgebra', 'HeckeAlgebraSymmetricGroupT'])
|
|
19
20
|
lazy_import('sage.combinat.symmetric_group_representations', [
|
|
@@ -42,6 +42,7 @@ from sage.structure.parent import Parent
|
|
|
42
42
|
from sage.structure.element import Element
|
|
43
43
|
from sage.structure.richcmp import richcmp
|
|
44
44
|
from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets
|
|
45
|
+
from sage.categories.finite_lattice_posets import FiniteLatticePosets
|
|
45
46
|
from sage.matrix.matrix_space import MatrixSpace
|
|
46
47
|
from sage.matrix.constructor import matrix
|
|
47
48
|
from sage.modules.free_module_element import zero_vector
|
|
@@ -61,8 +62,8 @@ lazy_import('sage.combinat.posets.lattices', 'LatticePoset')
|
|
|
61
62
|
|
|
62
63
|
def _inplace_height_function_gyration(hf):
|
|
63
64
|
k = hf.nrows() - 1
|
|
64
|
-
for i in range(1,k):
|
|
65
|
-
for j in range(1,k):
|
|
65
|
+
for i in range(1, k):
|
|
66
|
+
for j in range(1, k):
|
|
66
67
|
if (i+j) % 2 == 0 \
|
|
67
68
|
and hf[i-1,j] == hf[i+1,j] == hf[i,j+1] == hf[i,j-1]:
|
|
68
69
|
if hf[i,j] < hf[i+1,j]:
|
|
@@ -293,7 +294,7 @@ class AlternatingSignMatrix(Element,
|
|
|
293
294
|
li.reverse()
|
|
294
295
|
return AlternatingSignMatrix(li)
|
|
295
296
|
|
|
296
|
-
def
|
|
297
|
+
def number_of_inversions(self):
|
|
297
298
|
r"""
|
|
298
299
|
Return the inversion number of ``self``.
|
|
299
300
|
|
|
@@ -307,27 +308,30 @@ class AlternatingSignMatrix(Element,
|
|
|
307
308
|
EXAMPLES::
|
|
308
309
|
|
|
309
310
|
sage: A = AlternatingSignMatrices(3)
|
|
310
|
-
sage: A([[1, 0, 0],[0, 1, 0],[0, 0, 1]]).
|
|
311
|
+
sage: A([[1, 0, 0],[0, 1, 0],[0, 0, 1]]).number_of_inversions()
|
|
311
312
|
0
|
|
312
313
|
sage: asm = A([[0, 0, 1],[1, 0, 0],[0, 1, 0]])
|
|
313
|
-
sage: asm.
|
|
314
|
+
sage: asm.number_of_inversions()
|
|
314
315
|
2
|
|
315
316
|
sage: asm = A([[0, 1, 0],[1, -1, 1],[0, 1, 0]])
|
|
316
|
-
sage: asm.
|
|
317
|
+
sage: asm.number_of_inversions()
|
|
317
318
|
2
|
|
318
319
|
sage: P = Permutations(5)
|
|
319
|
-
sage:
|
|
320
|
+
sage: A = AlternatingSignMatrix
|
|
321
|
+
sage: all(p.number_of_inversions() == A(p.to_matrix()).number_of_inversions() for p in P)
|
|
320
322
|
True
|
|
321
323
|
"""
|
|
322
324
|
inversion_num = 0
|
|
323
325
|
asm_matrix = self.to_matrix()
|
|
324
326
|
nonzero_cells = asm_matrix.nonzero_positions()
|
|
325
|
-
for
|
|
326
|
-
for
|
|
327
|
+
for i, j in nonzero_cells:
|
|
328
|
+
for k, l in nonzero_cells:
|
|
327
329
|
if i > k and j < l:
|
|
328
330
|
inversion_num += asm_matrix[i][j] * asm_matrix[k][l]
|
|
329
331
|
return inversion_num
|
|
330
332
|
|
|
333
|
+
inversion_number = number_of_inversions
|
|
334
|
+
|
|
331
335
|
@combinatorial_map(name='rotate clockwise')
|
|
332
336
|
def rotate_cw(self):
|
|
333
337
|
r"""
|
|
@@ -801,11 +805,11 @@ class AlternatingSignMatrix(Element,
|
|
|
801
805
|
N = len(output)
|
|
802
806
|
for c in range(N):
|
|
803
807
|
d = copy.copy(output[c])
|
|
804
|
-
output[c][sign[b][0],sign[b][1]] = -output[c][sign[b][0], sign[b][1]]+1
|
|
805
|
-
d[sign[b][0],sign[b][1]] = -d[sign[b][0], sign[b][1]]-3
|
|
808
|
+
output[c][sign[b][0], sign[b][1]] = -output[c][sign[b][0], sign[b][1]]+1
|
|
809
|
+
d[sign[b][0], sign[b][1]] = -d[sign[b][0], sign[b][1]]-3
|
|
806
810
|
output.append(d)
|
|
807
811
|
for k in range(len(output)):
|
|
808
|
-
output[k] = M.from_height_function((output[k]-matrix.ones(n,n))/2)
|
|
812
|
+
output[k] = M.from_height_function((output[k]-matrix.ones(n, n))/2)
|
|
809
813
|
return output
|
|
810
814
|
|
|
811
815
|
@combinatorial_map(name='to Dyck word')
|
|
@@ -871,7 +875,7 @@ class AlternatingSignMatrix(Element,
|
|
|
871
875
|
|
|
872
876
|
raise ValueError("unknown algorithm '%s'" % algorithm)
|
|
873
877
|
|
|
874
|
-
def
|
|
878
|
+
def number_of_negative_ones(self):
|
|
875
879
|
"""
|
|
876
880
|
Return the number of entries in ``self`` equal to -1.
|
|
877
881
|
|
|
@@ -879,16 +883,18 @@ class AlternatingSignMatrix(Element,
|
|
|
879
883
|
|
|
880
884
|
sage: A = AlternatingSignMatrices(3)
|
|
881
885
|
sage: asm = A([[0,1,0],[1,0,0],[0,0,1]])
|
|
882
|
-
sage: asm.
|
|
886
|
+
sage: asm.number_of_negative_ones()
|
|
883
887
|
0
|
|
884
888
|
sage: asm = A([[0,1,0],[1,-1,1],[0,1,0]])
|
|
885
|
-
sage: asm.
|
|
889
|
+
sage: asm.number_of_negative_ones()
|
|
886
890
|
1
|
|
887
891
|
"""
|
|
888
892
|
a = self._matrix
|
|
889
893
|
return ZZ((len(a.nonzero_positions()) - a.nrows()) // 2)
|
|
890
894
|
|
|
891
|
-
|
|
895
|
+
number_negative_ones = number_of_negative_ones
|
|
896
|
+
|
|
897
|
+
def is_permutation(self) -> bool:
|
|
892
898
|
"""
|
|
893
899
|
Return ``True`` if ``self`` is a permutation matrix
|
|
894
900
|
and ``False`` otherwise.
|
|
@@ -903,7 +909,7 @@ class AlternatingSignMatrix(Element,
|
|
|
903
909
|
sage: asm.is_permutation()
|
|
904
910
|
False
|
|
905
911
|
"""
|
|
906
|
-
return self.
|
|
912
|
+
return self.number_of_negative_ones() == 0
|
|
907
913
|
|
|
908
914
|
def to_permutation(self):
|
|
909
915
|
"""
|
|
@@ -927,7 +933,7 @@ class AlternatingSignMatrix(Element,
|
|
|
927
933
|
if not self.is_permutation():
|
|
928
934
|
raise ValueError('not a permutation matrix')
|
|
929
935
|
asm_matrix = self.to_matrix()
|
|
930
|
-
return Permutation([j + 1 for
|
|
936
|
+
return Permutation([j + 1 for _, j in asm_matrix.nonzero_positions()])
|
|
931
937
|
|
|
932
938
|
@combinatorial_map(name='to semistandard tableau')
|
|
933
939
|
def to_semistandard_tableau(self):
|
|
@@ -1044,10 +1050,10 @@ class AlternatingSignMatrices(UniqueRepresentation, Parent):
|
|
|
1044
1050
|
sage: L = A.lattice(); L
|
|
1045
1051
|
Finite lattice containing 7 elements
|
|
1046
1052
|
sage: L.category()
|
|
1047
|
-
Category of facade finite enumerated
|
|
1053
|
+
Category of facade finite enumerated distributive lattices
|
|
1048
1054
|
"""
|
|
1049
1055
|
|
|
1050
|
-
def __init__(self, n):
|
|
1056
|
+
def __init__(self, n) -> None:
|
|
1051
1057
|
r"""
|
|
1052
1058
|
Initialize ``self``.
|
|
1053
1059
|
|
|
@@ -1060,7 +1066,7 @@ class AlternatingSignMatrices(UniqueRepresentation, Parent):
|
|
|
1060
1066
|
self._matrix_space = MatrixSpace(ZZ, n)
|
|
1061
1067
|
Parent.__init__(self, category=FiniteEnumeratedSets())
|
|
1062
1068
|
|
|
1063
|
-
def _repr_(self):
|
|
1069
|
+
def _repr_(self) -> str:
|
|
1064
1070
|
r"""
|
|
1065
1071
|
Return a string representation of ``self``.
|
|
1066
1072
|
|
|
@@ -1085,7 +1091,7 @@ class AlternatingSignMatrices(UniqueRepresentation, Parent):
|
|
|
1085
1091
|
"""
|
|
1086
1092
|
return self._matrix_space._repr_option(key)
|
|
1087
1093
|
|
|
1088
|
-
def __contains__(self, asm):
|
|
1094
|
+
def __contains__(self, asm) -> bool:
|
|
1089
1095
|
"""
|
|
1090
1096
|
Check if ``asm`` is in ``self``.
|
|
1091
1097
|
|
|
@@ -1242,7 +1248,7 @@ class AlternatingSignMatrices(UniqueRepresentation, Parent):
|
|
|
1242
1248
|
[ 0 0 0 1 0 0 0]
|
|
1243
1249
|
[ 0 1 0 0 0 0 0]
|
|
1244
1250
|
sage: a = AlternatingSignMatrices(5).random_element()
|
|
1245
|
-
sage: bool(a.
|
|
1251
|
+
sage: bool(a.number_of_negative_ones()) or a.is_permutation()
|
|
1246
1252
|
True
|
|
1247
1253
|
|
|
1248
1254
|
This is done using a modified version of Propp and Wilson's "coupling
|
|
@@ -1472,7 +1478,7 @@ class AlternatingSignMatrices(UniqueRepresentation, Parent):
|
|
|
1472
1478
|
m.set_immutable()
|
|
1473
1479
|
return self.element_class(self, m)
|
|
1474
1480
|
|
|
1475
|
-
def _lattice_initializer(self):
|
|
1481
|
+
def _lattice_initializer(self) -> tuple:
|
|
1476
1482
|
r"""
|
|
1477
1483
|
Return a 2-tuple to use in argument of ``LatticePoset``.
|
|
1478
1484
|
|
|
@@ -1494,7 +1500,7 @@ class AlternatingSignMatrices(UniqueRepresentation, Parent):
|
|
|
1494
1500
|
"""
|
|
1495
1501
|
mts, rels = MonotoneTriangles(self._n)._lattice_initializer()
|
|
1496
1502
|
bij = {t: self.from_monotone_triangle(t) for t in mts}
|
|
1497
|
-
return (bij.values(), [(bij[a], bij[b]) for
|
|
1503
|
+
return (bij.values(), [(bij[a], bij[b]) for a, b in rels])
|
|
1498
1504
|
|
|
1499
1505
|
def cover_relations(self):
|
|
1500
1506
|
r"""
|
|
@@ -1504,7 +1510,7 @@ class AlternatingSignMatrices(UniqueRepresentation, Parent):
|
|
|
1504
1510
|
EXAMPLES::
|
|
1505
1511
|
|
|
1506
1512
|
sage: A = AlternatingSignMatrices(3)
|
|
1507
|
-
sage: for
|
|
1513
|
+
sage: for a, b in A.cover_relations():
|
|
1508
1514
|
....: eval('a, b')
|
|
1509
1515
|
(
|
|
1510
1516
|
[1 0 0] [0 1 0]
|
|
@@ -1560,8 +1566,9 @@ class AlternatingSignMatrices(UniqueRepresentation, Parent):
|
|
|
1560
1566
|
sage: L = A.lattice(); L # needs sage.graphs
|
|
1561
1567
|
Finite lattice containing 7 elements
|
|
1562
1568
|
"""
|
|
1569
|
+
cat = FiniteLatticePosets().Distributive()
|
|
1563
1570
|
return LatticePoset(self._lattice_initializer(), cover_relations=True,
|
|
1564
|
-
check=False)
|
|
1571
|
+
check=False, category=cat)
|
|
1565
1572
|
|
|
1566
1573
|
@cached_method
|
|
1567
1574
|
def gyration_orbits(self):
|
|
@@ -1736,7 +1743,7 @@ class MonotoneTriangles(GelfandTsetlinPatternsTopRow):
|
|
|
1736
1743
|
EXAMPLES::
|
|
1737
1744
|
|
|
1738
1745
|
sage: M = MonotoneTriangles(3)
|
|
1739
|
-
sage: for
|
|
1746
|
+
sage: for a, b in M.cover_relations():
|
|
1740
1747
|
....: eval('a, b')
|
|
1741
1748
|
([[3, 2, 1], [2, 1], [1]], [[3, 2, 1], [2, 1], [2]])
|
|
1742
1749
|
([[3, 2, 1], [2, 1], [1]], [[3, 2, 1], [3, 1], [1]])
|
|
@@ -1780,7 +1787,7 @@ def _is_a_cover(mt0, mt1):
|
|
|
1780
1787
|
False
|
|
1781
1788
|
"""
|
|
1782
1789
|
diffs = 0
|
|
1783
|
-
for
|
|
1790
|
+
for a, b in zip(flatten(mt0), flatten(mt1)):
|
|
1784
1791
|
if a != b:
|
|
1785
1792
|
if a + 1 == b:
|
|
1786
1793
|
diffs += 1
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
"""
|
|
3
3
|
Baxter permutations
|
|
4
4
|
"""
|
|
5
|
+
from collections.abc import Iterator
|
|
6
|
+
|
|
5
7
|
from sage.combinat.permutation import Permutations
|
|
8
|
+
from sage.combinat.posets.lattices import LatticePoset
|
|
6
9
|
from sage.rings.integer import Integer
|
|
7
10
|
from sage.rings.integer_ring import ZZ
|
|
8
11
|
from sage.sets.disjoint_union_enumerated_sets import DisjointUnionEnumeratedSets
|
|
@@ -69,8 +72,7 @@ class BaxterPermutations_size(BaxterPermutations):
|
|
|
69
72
|
sage: BaxterPermutations_size(5)
|
|
70
73
|
Baxter permutations of size 5
|
|
71
74
|
"""
|
|
72
|
-
|
|
73
|
-
def __init__(self, n):
|
|
75
|
+
def __init__(self, n) -> None:
|
|
74
76
|
"""
|
|
75
77
|
EXAMPLES::
|
|
76
78
|
|
|
@@ -146,7 +148,7 @@ class BaxterPermutations_size(BaxterPermutations):
|
|
|
146
148
|
return False
|
|
147
149
|
return True
|
|
148
150
|
|
|
149
|
-
def __iter__(self):
|
|
151
|
+
def __iter__(self) -> Iterator:
|
|
150
152
|
r"""
|
|
151
153
|
Efficient generation of Baxter permutations.
|
|
152
154
|
|
|
@@ -235,6 +237,24 @@ class BaxterPermutations_size(BaxterPermutations):
|
|
|
235
237
|
n.binomial(k + 2)) // (n * n.binomial(2))
|
|
236
238
|
for k in range(self._n))
|
|
237
239
|
|
|
240
|
+
def lattice(self):
|
|
241
|
+
"""
|
|
242
|
+
Return the lattice of Baxter permutations.
|
|
243
|
+
|
|
244
|
+
This is defined by restriction of the weak order.
|
|
245
|
+
|
|
246
|
+
EXAMPLES::
|
|
247
|
+
|
|
248
|
+
sage: L = BaxterPermutations(4).lattice(); L
|
|
249
|
+
Finite lattice containing 22 elements
|
|
250
|
+
|
|
251
|
+
REFERENCES:
|
|
252
|
+
|
|
253
|
+
- [Law2011]_
|
|
254
|
+
"""
|
|
255
|
+
return LatticePoset([list(self), lambda a, b: a.weak_le(b)],
|
|
256
|
+
check=False)
|
|
257
|
+
|
|
238
258
|
|
|
239
259
|
class BaxterPermutations_all(DisjointUnionEnumeratedSets, BaxterPermutations):
|
|
240
260
|
r"""
|
|
@@ -249,8 +269,7 @@ class BaxterPermutations_all(DisjointUnionEnumeratedSets, BaxterPermutations):
|
|
|
249
269
|
sage: BaxterPermutations_all()
|
|
250
270
|
Baxter permutations
|
|
251
271
|
"""
|
|
252
|
-
|
|
253
|
-
def __init__(self, n=None):
|
|
272
|
+
def __init__(self, n=None) -> None:
|
|
254
273
|
r"""
|
|
255
274
|
EXAMPLES::
|
|
256
275
|
|
|
@@ -259,14 +278,14 @@ class BaxterPermutations_all(DisjointUnionEnumeratedSets, BaxterPermutations):
|
|
|
259
278
|
Baxter permutations
|
|
260
279
|
"""
|
|
261
280
|
self.element_class = Permutations().element_class
|
|
262
|
-
from sage.sets.non_negative_integers import NonNegativeIntegers
|
|
263
281
|
from sage.sets.family import Family
|
|
282
|
+
from sage.sets.non_negative_integers import NonNegativeIntegers
|
|
264
283
|
DisjointUnionEnumeratedSets.__init__(self,
|
|
265
284
|
Family(NonNegativeIntegers(),
|
|
266
285
|
BaxterPermutations_size),
|
|
267
286
|
facade=False, keepkey=False)
|
|
268
287
|
|
|
269
|
-
def _repr_(self):
|
|
288
|
+
def _repr_(self) -> str:
|
|
270
289
|
r"""
|
|
271
290
|
Return a string representation of ``self``.
|
|
272
291
|
|
|
@@ -278,7 +297,7 @@ class BaxterPermutations_all(DisjointUnionEnumeratedSets, BaxterPermutations):
|
|
|
278
297
|
"""
|
|
279
298
|
return "Baxter permutations"
|
|
280
299
|
|
|
281
|
-
def __contains__(self, x):
|
|
300
|
+
def __contains__(self, x) -> bool:
|
|
282
301
|
r"""
|
|
283
302
|
Return ``True`` if and only if ``x`` is a Baxter permutation.
|
|
284
303
|
|
|
@@ -302,7 +321,7 @@ class BaxterPermutations_all(DisjointUnionEnumeratedSets, BaxterPermutations):
|
|
|
302
321
|
return False
|
|
303
322
|
return x in BaxterPermutations(len(x))
|
|
304
323
|
|
|
305
|
-
def to_pair_of_twin_binary_trees(self, p):
|
|
324
|
+
def to_pair_of_twin_binary_trees(self, p) -> tuple:
|
|
306
325
|
r"""
|
|
307
326
|
Apply a bijection between Baxter permutations of size ``self._n``
|
|
308
327
|
and the set of pairs of twin binary trees with ``self._n`` nodes.
|
|
@@ -328,12 +347,13 @@ class BaxterPermutations_all(DisjointUnionEnumeratedSets, BaxterPermutations):
|
|
|
328
347
|
|
|
329
348
|
EXAMPLES::
|
|
330
349
|
|
|
350
|
+
sage: # needs sage.graphs
|
|
331
351
|
sage: BP = BaxterPermutations()
|
|
332
|
-
sage: BP.to_pair_of_twin_binary_trees(Permutation([]))
|
|
352
|
+
sage: BP.to_pair_of_twin_binary_trees(Permutation([]))
|
|
333
353
|
(., .)
|
|
334
|
-
sage: BP.to_pair_of_twin_binary_trees(Permutation([1, 2, 3]))
|
|
354
|
+
sage: BP.to_pair_of_twin_binary_trees(Permutation([1, 2, 3]))
|
|
335
355
|
(1[., 2[., 3[., .]]], 3[2[1[., .], .], .])
|
|
336
|
-
sage: BP.to_pair_of_twin_binary_trees(Permutation([3, 4, 1, 2]))
|
|
356
|
+
sage: BP.to_pair_of_twin_binary_trees(Permutation([3, 4, 1, 2]))
|
|
337
357
|
(3[1[., 2[., .]], 4[., .]], 2[1[., .], 4[3[., .], .]])
|
|
338
358
|
"""
|
|
339
359
|
from sage.combinat.binary_tree import LabelledBinaryTree
|
sage/combinat/bijectionist.py
CHANGED
|
@@ -60,7 +60,7 @@ check this for permutations of size at most `3`::
|
|
|
60
60
|
sage: def alpha1(p): return len(p.weak_excedences())
|
|
61
61
|
sage: def alpha2(p): return len(p.fixed_points())
|
|
62
62
|
sage: def beta1(p): return len(p.descents(final_descent=True)) if p else 0
|
|
63
|
-
sage: def beta2(p): return len([e for
|
|
63
|
+
sage: def beta2(p): return len([e for e, f in zip(p, p[1:]+[0]) if e == f+1])
|
|
64
64
|
sage: tau = Permutation.longest_increasing_subsequence_length
|
|
65
65
|
sage: def rotate_permutation(p):
|
|
66
66
|
....: cycle = Permutation(tuple(range(1, len(p)+1)))
|
|
@@ -157,14 +157,14 @@ following code is equivalent to ``tau = findstat(397)``::
|
|
|
157
157
|
....: else:
|
|
158
158
|
....: return m+1
|
|
159
159
|
sage: bij = Bijectionist(A, B, tau)
|
|
160
|
-
sage: bij.set_statistics((lambda a: a.size(), lambda b: b.
|
|
160
|
+
sage: bij.set_statistics((lambda a: a.size(), lambda b: b.number_of_nodes()-1))
|
|
161
161
|
sage: from sage.combinat.cyclic_sieving_phenomenon import orbit_decomposition
|
|
162
162
|
sage: bij.set_constant_blocks(orbit_decomposition(A, theta))
|
|
163
163
|
sage: list(bij.solutions_iterator())
|
|
164
164
|
[]
|
|
165
165
|
|
|
166
|
-
Next we demonstrate how to search for a bijection,
|
|
167
|
-
|
|
166
|
+
Next we demonstrate how to search for a bijection. To do so, we identify `s`
|
|
167
|
+
and `S`::
|
|
168
168
|
|
|
169
169
|
sage: N = 4
|
|
170
170
|
sage: A = [dyck_word for n in range(1, N) for dyck_word in DyckWords(n)]
|
|
@@ -174,7 +174,7 @@ identifying `s` and `S`::
|
|
|
174
174
|
....: B2.to_dyck_word()).to_binary_tree()
|
|
175
175
|
sage: bij = Bijectionist(A, B)
|
|
176
176
|
sage: bij.set_intertwining_relations((2, concat_path, concat_tree))
|
|
177
|
-
sage: bij.set_statistics((lambda d: d.semilength(), lambda t: t.
|
|
177
|
+
sage: bij.set_statistics((lambda d: d.semilength(), lambda t: t.number_of_nodes()))
|
|
178
178
|
sage: for D in sorted(bij.minimal_subdistributions_iterator(), key=lambda x: (len(x[0][0]), x)):
|
|
179
179
|
....: ascii_art(D)
|
|
180
180
|
( [ /\ ], [ o ] )
|
|
@@ -691,7 +691,7 @@ class Bijectionist(SageObject):
|
|
|
691
691
|
sage: def wex(p): return len(p.weak_excedences())
|
|
692
692
|
sage: def fix(p): return len(p.fixed_points())
|
|
693
693
|
sage: def des(p): return len(p.descents(final_descent=True)) if p else 0
|
|
694
|
-
sage: def adj(p): return len([e for
|
|
694
|
+
sage: def adj(p): return len([e for e, f in zip(p, p[1:]+[0]) if e == f+1])
|
|
695
695
|
sage: bij = Bijectionist(A, B, fix)
|
|
696
696
|
sage: bij.set_statistics((wex, des), (len, len))
|
|
697
697
|
sage: for solution in sorted(list(bij.solutions_iterator()), key=lambda d: tuple(sorted(d.items()))):
|
|
@@ -801,7 +801,7 @@ class Bijectionist(SageObject):
|
|
|
801
801
|
sage: def wex(p): return len(p.weak_excedences())
|
|
802
802
|
sage: def fix(p): return len(p.fixed_points())
|
|
803
803
|
sage: def des(p): return len(p.descents(final_descent=True)) if p else 0
|
|
804
|
-
sage: def adj(p): return len([e for
|
|
804
|
+
sage: def adj(p): return len([e for e, f in zip(p, p[1:]+[0]) if e == f+1])
|
|
805
805
|
sage: bij = Bijectionist(A, B, tau)
|
|
806
806
|
sage: bij.set_statistics((len, len), (wex, des), (fix, adj))
|
|
807
807
|
sage: table([[key, AB[0], AB[1]] for key, AB in bij.statistics_fibers().items()])
|
|
@@ -845,7 +845,7 @@ class Bijectionist(SageObject):
|
|
|
845
845
|
sage: def wex(p): return len(p.weak_excedences())
|
|
846
846
|
sage: def fix(p): return len(p.fixed_points())
|
|
847
847
|
sage: def des(p): return len(p.descents(final_descent=True)) if p else 0
|
|
848
|
-
sage: def adj(p): return len([e for
|
|
848
|
+
sage: def adj(p): return len([e for e, f in zip(p, p[1:]+[0]) if e == f+1])
|
|
849
849
|
sage: bij = Bijectionist(A, B, tau)
|
|
850
850
|
sage: bij.set_statistics((wex, des), (fix, adj))
|
|
851
851
|
sage: a, b = bij.statistics_table()
|
|
@@ -1554,7 +1554,7 @@ class Bijectionist(SageObject):
|
|
|
1554
1554
|
sage: def alpha1(p): return len(p.weak_excedences())
|
|
1555
1555
|
sage: def alpha2(p): return len(p.fixed_points())
|
|
1556
1556
|
sage: def beta1(p): return len(p.descents(final_descent=True)) if p else 0
|
|
1557
|
-
sage: def beta2(p): return len([e for
|
|
1557
|
+
sage: def beta2(p): return len([e for e, f in zip(p, p[1:] + [0]) if e == f + 1])
|
|
1558
1558
|
sage: tau = Permutation.longest_increasing_subsequence_length
|
|
1559
1559
|
sage: def rotate_permutation(p):
|
|
1560
1560
|
....: cycle = Permutation(tuple(range(1, len(p) + 1)))
|
|
@@ -2763,13 +2763,9 @@ class _BijectionistMILP:
|
|
|
2763
2763
|
coeff * values[index_block_value_dict[index]]
|
|
2764
2764
|
for index, coeff in f.dict().items())
|
|
2765
2765
|
|
|
2766
|
-
for lhs, rhs in constraint.equations():
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
for lhs, rhs in constraint.inequalities():
|
|
2770
|
-
if evaluate(lhs - rhs) > 0:
|
|
2771
|
-
return False
|
|
2772
|
-
return True
|
|
2766
|
+
if any(evaluate(lhs - rhs) for lhs, rhs in constraint.equations()):
|
|
2767
|
+
return False
|
|
2768
|
+
return all(evaluate(lhs - rhs) <= 0 for lhs, rhs in constraint.inequalities())
|
|
2773
2769
|
|
|
2774
2770
|
def add_alpha_beta_constraints(self):
|
|
2775
2771
|
r"""
|
|
@@ -3174,7 +3170,7 @@ Our benchmark example::
|
|
|
3174
3170
|
sage: def alpha1(p): return len(p.weak_excedences())
|
|
3175
3171
|
sage: def alpha2(p): return len(p.fixed_points())
|
|
3176
3172
|
sage: def beta1(p): return len(p.descents(final_descent=True)) if p else 0
|
|
3177
|
-
sage: def beta2(p): return len([e for
|
|
3173
|
+
sage: def beta2(p): return len([e for e, f in zip(p, p[1:]+[0]) if e == f+1])
|
|
3178
3174
|
sage: gamma = Permutation.longest_increasing_subsequence_length
|
|
3179
3175
|
sage: def rotate_permutation(p):
|
|
3180
3176
|
....: cycle = Permutation(tuple(range(1, len(p)+1)))
|
sage/combinat/chas/fsym.py
CHANGED
|
@@ -328,7 +328,7 @@ class FSymBases(Category_realization_of_parent):
|
|
|
328
328
|
|
|
329
329
|
sage: z = G[[1,3,5],[2,4]]
|
|
330
330
|
sage: all(F.duality_pairing(F[p1] * F[p2], z) == c
|
|
331
|
-
....: for (
|
|
331
|
+
....: for (p1, p2), c in z.coproduct())
|
|
332
332
|
True
|
|
333
333
|
|
|
334
334
|
TESTS:
|
|
@@ -342,7 +342,7 @@ class FSymBases(Category_realization_of_parent):
|
|
|
342
342
|
Rational Field
|
|
343
343
|
"""
|
|
344
344
|
y = self.dual_basis()(y)
|
|
345
|
-
return self.base_ring().sum(coeff * y[t] for
|
|
345
|
+
return self.base_ring().sum(coeff * y[t] for t, coeff in x)
|
|
346
346
|
|
|
347
347
|
def duality_pairing_matrix(self, basis, degree):
|
|
348
348
|
r"""
|
|
@@ -496,7 +496,7 @@ class FreeSymmetricFunctions(UniqueRepresentation, Parent):
|
|
|
496
496
|
cat = HopfAlgebras(base_ring).Graded().Connected()
|
|
497
497
|
Parent.__init__(self, base=base_ring, category=cat.WithRealizations())
|
|
498
498
|
|
|
499
|
-
_shorthands =
|
|
499
|
+
_shorthands = ('G',)
|
|
500
500
|
|
|
501
501
|
def a_realization(self):
|
|
502
502
|
r"""
|
|
@@ -791,7 +791,7 @@ class FreeSymmetricFunctions_Dual(UniqueRepresentation, Parent):
|
|
|
791
791
|
sage: TF(F[[5, 1, 4, 2, 3]])
|
|
792
792
|
F[135|2|4]
|
|
793
793
|
"""
|
|
794
|
-
def __init__(self, base_ring):
|
|
794
|
+
def __init__(self, base_ring) -> None:
|
|
795
795
|
r"""
|
|
796
796
|
Initialize ``self``.
|
|
797
797
|
|
|
@@ -803,7 +803,7 @@ class FreeSymmetricFunctions_Dual(UniqueRepresentation, Parent):
|
|
|
803
803
|
cat = HopfAlgebras(base_ring).Graded().Connected()
|
|
804
804
|
Parent.__init__(self, base=base_ring, category=cat.WithRealizations())
|
|
805
805
|
|
|
806
|
-
_shorthands =
|
|
806
|
+
_shorthands = ('F',)
|
|
807
807
|
|
|
808
808
|
def a_realization(self):
|
|
809
809
|
r"""
|
|
@@ -1114,7 +1114,7 @@ def ascent_set(t):
|
|
|
1114
1114
|
[2, 4, 5]
|
|
1115
1115
|
"""
|
|
1116
1116
|
row_locations = {}
|
|
1117
|
-
for
|
|
1117
|
+
for i, row in enumerate(t):
|
|
1118
1118
|
for entry in row:
|
|
1119
1119
|
row_locations[entry] = i
|
|
1120
1120
|
n = len(row_locations)
|