Skip to content

Commit 0b38b3e

Browse files
author
Release Manager
committed
gh-37318: Allowing HeckeAlgebraSymmetricGroupT to accept elements of SymmetricGroup(n) as input <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes #1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> Currently, the following fails in sage: ``` sage: S4 = SymmetricGroup(4) sage: H4 = HeckeAlgebraSymmetricGroupT(ZZ, 4) sage: H4( Permutations(4).an_element() ) T[4, 1, 2, 3] sage: H4( S4.an_element() ) Traceback (most recent call last) ... TypeError: do not know how to make x (= (2,3,4)) an element of self (=Hecke algebra of the symmetric group of order 4 on the T basis over Univariate Polynomial Ring in q over Integer Ring) ``` I view this as a bug because the elements of this algebra are indexed by elements of the symmetric group and `HeckeAlgebraSymmetricGroupT` does accept elements of `Permutations(n)`. This PR makes works work as well as accepting elements of `Permutations(N)`, for `N>n, that fix `n+1,...,N`. Previously, `HeckeAlgebraSymmetricGroupT` contain a `_coerce_start` method. I have renamed this as `_element_constructor_`, which is what I think it should be, and made some minor changes there. Probably, I should deprecate `_coerce_start` but this method does not seem to exist anywhere else in sage, so I suspect that this belongs to some code that was deprecated years ago. <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #37318 Reported by: Andrew Mathas Reviewer(s): Andrew Mathas, Giacomo Pope
2 parents f016b01 + 19ffe6c commit 0b38b3e

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

src/sage/combinat/symmetric_group_algebra.py

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3004,6 +3004,13 @@ def HeckeAlgebraSymmetricGroupT(R, n, q=None):
30043004
[2, 3, 1]
30053005
30063006
sage: TestSuite(H3).run()
3007+
3008+
.. NOTE::
3009+
3010+
:class:`~sage.algebras.iwahori_hecke_algebra.IwahoriHeckeAlgebra` gives
3011+
a different implementation of the Iwahori-Hecke algebras of a Coxeter
3012+
system `(W,S)`. This includes the Hecke algebras of the symmetric group
3013+
as special case.
30073014
"""
30083015
return HeckeAlgebraSymmetricGroup_t(R, n, q)
30093016

@@ -3065,24 +3072,34 @@ def q(self):
30653072
"""
30663073
return self._q
30673074

3068-
def _coerce_start(self, x):
3075+
def _element_constructor_(self, x):
30693076
"""
30703077
EXAMPLES::
30713078
30723079
sage: H3 = HeckeAlgebraSymmetricGroupT(QQ, 3)
3073-
sage: H3._coerce_start([2,1])
3080+
sage: H3([2,1]) # indirect doc test
3081+
T[2, 1, 3]
3082+
sage: H3( Permutations(3).an_element() )
3083+
T[3, 1, 2]
3084+
sage: H3( SymmetricGroup(3).an_element() )
3085+
[1, 3, 2]
3086+
sage: H3( [2, 1, 3, 4, 5, 6] )
30743087
T[2, 1, 3]
30753088
"""
30763089
###################################################
30773090
# Coerce permutations of size smaller that self.n #
30783091
###################################################
30793092
if not x:
30803093
return self.one()
3081-
if len(x) < self.n and x in Permutations():
3082-
return self.monomial(self._indices(list(x) +
3083-
list(range(len(x) + 1,
3084-
self.n + 1))))
3085-
raise TypeError
3094+
if x in Permutations():
3095+
if len(x) < self.n:
3096+
return self.monomial(self._indices(
3097+
list(x) + list(range(len(x) + 1, self.n + 1))
3098+
))
3099+
if all(x[i] == i+1 for i in range(self.n, len(x))):
3100+
return self.monomial(self._indices(x[:self.n]))
3101+
3102+
return self._indices(x)
30863103

30873104

30883105
class HeckeAlgebraSymmetricGroup_t(HeckeAlgebraSymmetricGroup_generic):

0 commit comments

Comments
 (0)