@@ -3012,7 +3012,7 @@ def descents(self, final_descent=False, side='right', positive=False,
3012
3012
Check that the original error of :trac:`23891` is fixed::
3013
3013
3014
3014
sage: Permutations(4)([1,4,3,2]).weak_covers()
3015
- [[1, 4, 2, 3 ], [1, 3, 4, 2]]
3015
+ [[1, 3, 4, 2 ], [1, 4, 2, 3 ]]
3016
3016
"""
3017
3017
if index_set is None :
3018
3018
index_set = range (1 , len (self ))
@@ -6200,11 +6200,11 @@ def __init__(self, n, category=None):
6200
6200
"""
6201
6201
TESTS:
6202
6202
6203
- We skip the reduced word method because it does not respect the
6204
- ordering for multiplication::
6203
+ We skip the descent and reduced word methods because they do
6204
+ not respect the ordering for multiplication::
6205
6205
6206
6206
sage: SP = Permutations(3)
6207
- sage: TestSuite(SP).run(skip='_test_reduced_word')
6207
+ sage: TestSuite(SP).run(skip=[ '_test_reduced_word', '_test_has_descent'] )
6208
6208
6209
6209
sage: SP.options.mult='r2l'
6210
6210
sage: TestSuite(SP).run()
@@ -6725,12 +6725,6 @@ def has_left_descent(self, i, mult=None):
6725
6725
descent of `\pi` is an index `i \in \{ 1, 2, \ldots, n-1 \}`
6726
6726
satisfying `\pi^{-1}(i) > \pi^{-1}(i+1)`.
6727
6727
6728
- The optional parameter ``mult`` can be set to ``'l2r'`` or
6729
- ``'r2l'``; if so done, it is used instead of the ``mult``
6730
- variable in :meth:`Permutations.options`. Anyone using
6731
- this method in a non-interactive environment is encouraged to
6732
- do so in order to have code behave reliably.
6733
-
6734
6728
.. WARNING::
6735
6729
6736
6730
The methods :meth:`descents` and :meth:`idescents` behave
@@ -6740,27 +6734,27 @@ def has_left_descent(self, i, mult=None):
6740
6734
6741
6735
.. WARNING::
6742
6736
6743
- The optional input ``mult`` might disappear once :trac:`14881`
6744
- is fixed.
6737
+ This ignores the multiplication convention in order
6738
+ to be consistent with other Coxeter operations in
6739
+ permutations (e.g., computing :meth:`reduced_word`).
6745
6740
6746
6741
EXAMPLES::
6747
6742
6748
6743
sage: P = Permutations(4)
6749
6744
sage: x = P([3, 2, 4, 1])
6750
- sage: x .descents()
6751
- [1, 3 ]
6745
+ sage: (~x) .descents()
6746
+ [1, 2 ]
6752
6747
sage: [i for i in P.index_set() if x.has_left_descent(i)]
6753
- [1, 3]
6754
- sage: [i for i in P.index_set() if x.has_left_descent(i, mult="l2r")]
6755
- [1, 3]
6756
- sage: [i for i in P.index_set() if x.has_left_descent(i, mult="r2l")]
6757
6748
[1, 2]
6758
6749
"""
6759
- if mult is None :
6760
- mult = self .parent ().options .mult
6761
- if mult != 'l2r' :
6762
- self = self .inverse ()
6763
- return self [i - 1 ] > self [i ]
6750
+ if mult is not None :
6751
+ from sage .misc .superseded import deprecation
6752
+ deprecation (27467 , "The mult option is deprecated." )
6753
+ for val in self ._list :
6754
+ if val == i :
6755
+ return False
6756
+ if val == i + 1 :
6757
+ return True
6764
6758
6765
6759
def has_right_descent (self , i , mult = None ):
6766
6760
r"""
@@ -6783,12 +6777,6 @@ def has_right_descent(self, i, mult=None):
6783
6777
descent of `\pi` is an index `i \in \{ 1, 2, \ldots, n-1 \}`
6784
6778
satisfying `\pi(i) > \pi(i+1)`.
6785
6779
6786
- The optional parameter ``mult`` can be set to ``'l2r'`` or
6787
- ``'r2l'``; if so done, it is used instead of the ``mult``
6788
- variable in :meth:`Permutations.options`. Anyone using
6789
- this method in a non-interactive environment is encouraged to
6790
- do so in order to have code behave reliably.
6791
-
6792
6780
.. WARNING::
6793
6781
6794
6782
The methods :meth:`descents` and :meth:`idescents` behave
@@ -6798,26 +6786,22 @@ def has_right_descent(self, i, mult=None):
6798
6786
6799
6787
.. WARNING::
6800
6788
6801
- The optional input ``mult`` might disappear once :trac:`14881`
6802
- is fixed.
6789
+ This ignores the multiplication convention in order
6790
+ to be consistent with other Coxeter operations in
6791
+ permutations (e.g., computing :meth:`reduced_word`).
6803
6792
6804
6793
EXAMPLES::
6805
6794
6806
6795
sage: P = Permutations(4)
6807
6796
sage: x = P([3, 2, 4, 1])
6808
- sage: (~x) .descents()
6809
- [1, 2 ]
6797
+ sage: x .descents()
6798
+ [1, 3 ]
6810
6799
sage: [i for i in P.index_set() if x.has_right_descent(i)]
6811
- [1, 2]
6812
- sage: [i for i in P.index_set() if x.has_right_descent(i, mult="l2r")]
6813
- [1, 2]
6814
- sage: [i for i in P.index_set() if x.has_right_descent(i, mult="r2l")]
6815
6800
[1, 3]
6816
6801
"""
6817
- if mult is None :
6818
- mult = self .parent ().options .mult
6819
- if mult != 'r2l' :
6820
- self = self .inverse ()
6802
+ if mult is not None :
6803
+ from sage .misc .superseded import deprecation
6804
+ deprecation (27467 , "The mult option is deprecated." )
6821
6805
return self [i - 1 ] > self [i ]
6822
6806
6823
6807
def __mul__ (self , other ):
@@ -6887,6 +6871,54 @@ def inverse(self):
6887
6871
6888
6872
__invert__ = inverse
6889
6873
6874
+ def apply_simple_reflection_left (self , i ):
6875
+ r"""
6876
+ Return ``self`` multiplied by the simple reflection ``s[i]``
6877
+ on the left.
6878
+
6879
+ .. WARNING::
6880
+
6881
+ This ignores the multiplication convention in order
6882
+ to be consistent with other Coxeter operations in
6883
+ permutations (e.g., computing :meth:`reduced_word`).
6884
+
6885
+ EXAMPLES::
6886
+
6887
+ sage: W = Permutations(3)
6888
+ sage: w = W([2,3,1])
6889
+ sage: w.apply_simple_reflection_left(1)
6890
+ [1, 3, 2]
6891
+ sage: w.apply_simple_reflection_left(2)
6892
+ [3, 2, 1]
6893
+ """
6894
+ s = self .parent ().simple_reflections ()[i ]
6895
+ p = right_action_same_n (self ._list , s ._list )
6896
+ return self .__class__ (self .parent (), p )
6897
+
6898
+ def apply_simple_reflection_right (self , i ):
6899
+ r"""
6900
+ Return ``self`` multiplied by the simple reflection ``s[i]``
6901
+ on the right.
6902
+
6903
+ .. WARNING::
6904
+
6905
+ This ignores the multiplication convention in order
6906
+ to be consistent with other Coxeter operations in
6907
+ permutations (e.g., computing :meth:`reduced_word`).
6908
+
6909
+ EXAMPLES::
6910
+
6911
+ sage: W = Permutations(3)
6912
+ sage: w = W([2,3,1])
6913
+ sage: w.apply_simple_reflection_right(1)
6914
+ [3, 2, 1]
6915
+ sage: w.apply_simple_reflection_right(2)
6916
+ [2, 1, 3]
6917
+ """
6918
+ s = self .parent ().simple_reflections ()[i ]
6919
+ p = left_action_same_n (self ._list , s ._list )
6920
+ return self .__class__ (self .parent (), p )
6921
+
6890
6922
#############################
6891
6923
# Constructing Permutations #
6892
6924
#############################
0 commit comments