Skip to content

Commit

Permalink
Trac #30237: Make .coxeter_matrix() return a CoxeterMatrix for coxete…
Browse files Browse the repository at this point in the history
…r3-implemented groups

This patch fixes all of the following, which currently throw errors:

{{{#!python
W = CoxeterGroup(['B', 3], implementation='coxeter3')
W.coxeter_type()
# AttributeError:
'sage.matrix.matrix_integer_dense.Matrix_integer_dense' object has no
attribute 'coxeter_type'
W([1,2,1]).reduced_words()
# IndexError: matrix index out of range
R.<v> = LaurentPolynomialRing(ZZ)
IwahoriHeckeAlgebra(W, v, -1/v)
# AttributeError:
'sage.matrix.matrix_integer_dense.Matrix_integer_dense' object has no
attribute 'coxeter_type'
}}}

The underlying problem in all cases is that `W.coxeter_matrix()` does
not return a `CoxeterMatrix`; I've altered this to return the (correctly
indexed) coxeter matrix and added a test.

This also removes a completely unused function `CoxeterGroup.m(i, j)`
which seemingly existed only to workaround the fact that
`.coxeter_matrix()` was incorrectly indexed (and in fact is ill-founded,
it would cause an error on a group with affine Cartan type). This
removal breaks no tests in `libs/coxeter3`.

URL: https://trac.sagemath.org/30237
Reported by: gh-cemulate
Ticket author(s): Chase Meadors
Reviewer(s): Travis Scrimshaw
  • Loading branch information
Release Manager committed Aug 9, 2020
2 parents 075edbb + bd9b5c6 commit f148ee5
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/sage/libs/coxeter3/coxeter_group.py
Expand Up @@ -18,6 +18,8 @@
from sage.categories.all import CoxeterGroups
from sage.structure.parent import Parent

from sage.combinat.root_system.coxeter_matrix import CoxeterMatrix

from sage.rings.integer_ring import ZZ
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing

Expand Down Expand Up @@ -214,13 +216,15 @@ def coxeter_matrix(self):
EXAMPLES::
sage: W = CoxeterGroup(['A', 3], implementation='coxeter3') # optional - coxeter3
sage: W.coxeter_matrix() # optional - coxeter3
sage: m = W.coxeter_matrix(); m # optional - coxeter3
[1 3 2]
[3 1 3]
[2 3 1]
sage: m.index_set() == W.index_set() # optional - coxeter3
True
"""
return self._coxgroup.coxeter_matrix()
return CoxeterMatrix(self._coxgroup.coxeter_matrix(), self.index_set())

def root_system(self):
"""
Expand Down Expand Up @@ -251,19 +255,21 @@ def _an_element_(self):
return self.element_class(self, [])

def m(self, i, j):
"""
Return the entry in the Coxeter matrix between the generator
with label ``i`` and the generator with label ``j``.
r"""
This is deprecated, use ``self.coxeter_matrix()[i,j]`` instead.
EXAMPLES::
TESTS::
sage: W = CoxeterGroup(['A', 3], implementation='coxeter3') # optional - coxeter3
sage: W.m(1,1) # optional - coxeter3
sage: W = CoxeterGroup(['A', 3], implementation='coxeter3') # optional - coxeter3
sage: W.m(1, 1) # optional - coxeter3
doctest:warning...:
DeprecationWarning: the .m(i, j) method has been deprecated; use .coxeter_matrix()[i,j] instead.
See https://trac.sagemath.org/30237 for details.
1
sage: W.m(1,0) # optional - coxeter3
2
"""
return self.coxeter_matrix()[i-1,j-1]
from sage.misc.superseded import deprecation
deprecation(30237, "the .m(i, j) method has been deprecated; use .coxeter_matrix()[i,j] instead.")
return self.coxeter_matrix()[i,j]

def kazhdan_lusztig_polynomial(self, u, v, constant_term_one=True):
r"""
Expand Down

0 comments on commit f148ee5

Please sign in to comment.