Skip to content

Commit 421821f

Browse files
committed
Extending _element_constructor_ in symmetric_group_algebra to accept elements of SymmetricGroup
1 parent 0c390a0 commit 421821f

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/sage/combinat/symmetric_group_algebra.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3065,23 +3065,32 @@ def q(self):
30653065
"""
30663066
return self._q
30673067

3068-
def _coerce_start(self, x):
3068+
def _element_constructor_(self, x):
30693069
"""
30703070
EXAMPLES::
30713071
30723072
sage: H3 = HeckeAlgebraSymmetricGroupT(QQ, 3)
3073-
sage: H3._coerce_start([2,1])
3073+
sage: H3([2,1]) # indirect doc test
30743074
T[2, 1, 3]
3075+
sage: H3( SymmetricGroup(3).an_element() )
3076+
[1, 3, 2]
3077+
sage: H3( [2, 1] )
30753078
"""
30763079
###################################################
30773080
# Coerce permutations of size smaller that self.n #
30783081
###################################################
30793082
if not x:
30803083
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))))
3084+
if x in Permutations():
3085+
if len(x) < self.n:
3086+
return self.monomial(self._indices(
3087+
list(x) + list(range(len(x) + 1, self.n + 1))
3088+
))
3089+
if all(x[i] == i for i in range(self.n+1, len(x))):
3090+
return self.monomial(self._indices(x[:self.n]))
3091+
3092+
return self._indices(x)
3093+
30853094
raise TypeError
30863095

30873096

0 commit comments

Comments
 (0)