diff --git a/src/sage/categories/coxeter_groups.py b/src/sage/categories/coxeter_groups.py index 0b353313517..98fe35a0ab3 100644 --- a/src/sage/categories/coxeter_groups.py +++ b/src/sage/categories/coxeter_groups.py @@ -236,11 +236,11 @@ def braid_group_as_finitely_presented_group(self): sage: W.braid_group_as_finitely_presented_group() Finitely presented group < S1, S2 | (S1*S2)^2*(S1^-1*S2^-1)^2 > - sage: W = ReflectionGroup(['B',3], index_set=["AA","BB",5]) # optional - gap3 - sage: W.braid_group_as_finitely_presented_group() # optional - gap3 + sage: W = ReflectionGroup(['B',3], index_set=["AA","BB","5"]) # optional - gap3 + sage: W.braid_group_as_finitely_presented_group() # optional - gap3 Finitely presented group < SAA, SBB, S5 | - SAA*SBB*SAA*SBB^-1*SAA^-1*SBB^-1, SAA*S5*SAA^-1*S5^-1, - (SBB*S5)^2*(SBB^-1*S5^-1)^2 > + (SAA*SBB)^2*(SAA^-1*SBB^-1)^2, SAA*S5*SAA^-1*S5^-1, + SBB*S5*SBB*S5^-1*SBB^-1*S5^-1 > """ from sage.groups.free_group import FreeGroup from sage.misc.misc_c import prod @@ -285,25 +285,25 @@ def braid_orbit(self, word): sage: sorted(W.braid_orbit([2,1,1,2,1])) [[1, 2, 1, 1, 2], [2, 1, 1, 2, 1], [2, 1, 2, 1, 2], [2, 2, 1, 2, 2]] - sage: W = ReflectionGroup(['A',3], index_set=["AA","BB",5]) # optional - gap3 - sage: w = W.long_element() # optional - gap3 - sage: W.braid_orbit(w.reduced_word()) # optional - gap3 - [['AA', 5, 'BB', 5, 'AA', 'BB'], - ['AA', 'BB', 5, 'BB', 'AA', 'BB'], - [5, 'BB', 'AA', 5, 'BB', 5], - ['BB', 5, 'AA', 'BB', 5, 'AA'], - [5, 'BB', 5, 'AA', 'BB', 5], - ['BB', 5, 'AA', 'BB', 'AA', 5], - [5, 'AA', 'BB', 'AA', 5, 'BB'], - ['BB', 'AA', 5, 'BB', 5, 'AA'], - ['AA', 'BB', 'AA', 5, 'BB', 'AA'], - [5, 'BB', 'AA', 'BB', 5, 'BB'], - ['BB', 'AA', 5, 'BB', 'AA', 5], - [5, 'AA', 'BB', 5, 'AA', 'BB'], - ['AA', 'BB', 5, 'AA', 'BB', 'AA'], - ['BB', 5, 'BB', 'AA', 'BB', 5], - ['AA', 5, 'BB', 'AA', 5, 'BB'], - ['BB', 'AA', 'BB', 5, 'BB', 'AA']] + sage: W = ReflectionGroup(['A',3], index_set=["AA","BB","5"]) # optional - gap3 + sage: w = W.long_element() # optional - gap3 + sage: W.braid_orbit(w.reduced_word()) # optional - gap3 + [['BB', '5', 'AA', 'BB', '5', 'AA'], + ['5', 'BB', '5', 'AA', 'BB', '5'], + ['BB', 'AA', 'BB', '5', 'BB', 'AA'], + ['AA', '5', 'BB', 'AA', '5', 'BB'], + ['5', 'AA', 'BB', 'AA', '5', 'BB'], + ['AA', 'BB', '5', 'AA', 'BB', 'AA'], + ['AA', 'BB', 'AA', '5', 'BB', 'AA'], + ['AA', 'BB', '5', 'BB', 'AA', 'BB'], + ['BB', 'AA', '5', 'BB', 'AA', '5'], + ['BB', '5', 'AA', 'BB', 'AA', '5'], + ['AA', '5', 'BB', '5', 'AA', 'BB'], + ['5', 'BB', 'AA', '5', 'BB', '5'], + ['5', 'BB', 'AA', 'BB', '5', 'BB'], + ['5', 'AA', 'BB', '5', 'AA', 'BB'], + ['BB', '5', 'BB', 'AA', 'BB', '5'], + ['BB', 'AA', '5', 'BB', '5', 'AA']] .. TODO:: @@ -1608,25 +1608,25 @@ def reduced_words(self): sage: sorted(w.reduced_words()) [[2, 3, 4, 2], [3, 2, 4, 2], [3, 4, 2, 4]] - sage: W = ReflectionGroup(['A',3], index_set=["AA","BB",5]) # optional - gap3 - sage: w = W.long_element() # optional - gap3 - sage: w.reduced_words() # optional - gap3 - [['AA', 5, 'BB', 5, 'AA', 'BB'], - ['AA', 'BB', 5, 'BB', 'AA', 'BB'], - [5, 'BB', 'AA', 5, 'BB', 5], - ['BB', 5, 'AA', 'BB', 5, 'AA'], - [5, 'BB', 5, 'AA', 'BB', 5], - ['BB', 5, 'AA', 'BB', 'AA', 5], - [5, 'AA', 'BB', 'AA', 5, 'BB'], - ['BB', 'AA', 5, 'BB', 5, 'AA'], - ['AA', 'BB', 'AA', 5, 'BB', 'AA'], - [5, 'BB', 'AA', 'BB', 5, 'BB'], - ['BB', 'AA', 5, 'BB', 'AA', 5], - [5, 'AA', 'BB', 5, 'AA', 'BB'], - ['AA', 'BB', 5, 'AA', 'BB', 'AA'], - ['BB', 5, 'BB', 'AA', 'BB', 5], - ['AA', 5, 'BB', 'AA', 5, 'BB'], - ['BB', 'AA', 'BB', 5, 'BB', 'AA']] + sage: W = ReflectionGroup(['A',3], index_set=["AA","BB","5"]) # optional - gap3 + sage: w = W.long_element() # optional - gap3 + sage: w.reduced_words() # optional - gap3 + [['BB', '5', 'AA', 'BB', '5', 'AA'], + ['5', 'BB', '5', 'AA', 'BB', '5'], + ['BB', 'AA', 'BB', '5', 'BB', 'AA'], + ['AA', '5', 'BB', 'AA', '5', 'BB'], + ['5', 'AA', 'BB', 'AA', '5', 'BB'], + ['AA', 'BB', '5', 'AA', 'BB', 'AA'], + ['AA', 'BB', 'AA', '5', 'BB', 'AA'], + ['AA', 'BB', '5', 'BB', 'AA', 'BB'], + ['BB', 'AA', '5', 'BB', 'AA', '5'], + ['BB', '5', 'AA', 'BB', 'AA', '5'], + ['AA', '5', 'BB', '5', 'AA', 'BB'], + ['5', 'BB', 'AA', '5', 'BB', '5'], + ['5', 'BB', 'AA', 'BB', '5', 'BB'], + ['5', 'AA', 'BB', '5', 'AA', 'BB'], + ['BB', '5', 'BB', 'AA', 'BB', '5'], + ['BB', 'AA', '5', 'BB', '5', 'AA']] .. TODO:: diff --git a/src/sage/combinat/root_system/reflection_group_complex.py b/src/sage/combinat/root_system/reflection_group_complex.py index 8961b46a1db..0e057dad6bc 100644 --- a/src/sage/combinat/root_system/reflection_group_complex.py +++ b/src/sage/combinat/root_system/reflection_group_complex.py @@ -371,10 +371,11 @@ def _repr_(self): def iteration_tracking_words(self): r""" - Return an iterator going through all elements in ``self`` which tracks the reduced expressions. + Return an iterator going through all elements in ``self`` that + tracks the reduced expressions. - This is much slower than using the iteration as a permutation group with strong - generating set. + This can be much slower than using the iteration as a permutation + group with strong generating set. EXAMPLES:: diff --git a/src/sage/combinat/root_system/reflection_group_element.pxd b/src/sage/combinat/root_system/reflection_group_element.pxd index 290e58e3a2d..04e98fc3fb2 100644 --- a/src/sage/combinat/root_system/reflection_group_element.pxd +++ b/src/sage/combinat/root_system/reflection_group_element.pxd @@ -1,7 +1,6 @@ from sage.groups.perm_gps.permgroup_element cimport PermutationGroupElement cdef class ComplexReflectionGroupElement(PermutationGroupElement): - cpdef test_hash(self) cpdef action(self, vec, on_space=*) cpdef action_on_root_indices(self, i) diff --git a/src/sage/combinat/root_system/reflection_group_element.pyx b/src/sage/combinat/root_system/reflection_group_element.pyx index cc28382237c..acf54867a5d 100644 --- a/src/sage/combinat/root_system/reflection_group_element.pyx +++ b/src/sage/combinat/root_system/reflection_group_element.pyx @@ -71,14 +71,21 @@ cdef class ComplexReflectionGroupElement(PermutationGroupElement): sage: WB_hash.intersection(WC_hash) # optional - gap3 set() - """ - return hash(self._parent) | hash(tuple(self._reduced_word)) - cpdef test_hash(self): - cdef int i - cdef int l = self.parent()._length_of_permutation_representation - cdef tuple perm = tuple([self.perm[i] for i in range(l)]) - return hash(self._parent) | hash(perm) + Check that :trac:`34912` is fixed:: + + sage: G4 = ReflectionGroup(4) # optional - gap3 + sage: g0, g1 = G4.gens() # optional - gap3 + sage: elt = g0^2 * g1 * g0^2 * g1 # optional - gap3 + sage: elt # optional - gap3 + (1,12)(2,24)(3,19)(4,22)(5,17)(6,20)(7,23)(8,9)(10,21)(11,13)(14,18)(15,16) + sage: y = (elt * G4.gen(1)) * G4.gen(1) * G4.gen(1) # optional - gap3 + sage: elt == y # optional - gap3 + True + sage: hash(elt) == hash(y) # optional - gap3 + True + """ + return hash(self._parent) | super().__hash__() def reduced_word(self): r""" @@ -142,7 +149,7 @@ cdef class ComplexReflectionGroupElement(PermutationGroupElement): EXAMPLES:: sage: W = ReflectionGroup(4) # optional - gap3 - sage: for w in W: # optional - gap3 + sage: for w in W.iteration_tracking_words(): # optional - gap3 ....: print("{} {}".format(w.reduced_word(), w.length())) [] 0 [1] 1 @@ -184,9 +191,9 @@ cdef class ComplexReflectionGroupElement(PermutationGroupElement): EXAMPLES:: - sage: W = ReflectionGroup((3,1,2)) # optional - gap3 - sage: for w in W: # optional - gap3 - ....: w.reduced_word() # optional - gap3 + sage: W = ReflectionGroup((3,1,2)) # optional - gap3 + sage: for w in W.iteration_tracking_words(): # optional - gap3 + ....: w.reduced_word() # optional - gap3 ....: [w.to_matrix(), w.to_matrix(on_space="dual")] # optional - gap3 [] [ @@ -531,7 +538,8 @@ cdef class ComplexReflectionGroupElement(PermutationGroupElement): EXAMPLES:: sage: W = ReflectionGroup(4) # optional - gap3 - sage: for w in W: w.reflection_eigenvalues() # optional - gap3 + sage: for w in W.iteration_tracking_words(): # optional - gap3 + ....: w.reflection_eigenvalues() [0, 0] [1/3, 0] [1/3, 0] @@ -567,7 +575,8 @@ cdef class ComplexReflectionGroupElement(PermutationGroupElement): EXAMPLES:: sage: W = ReflectionGroup(4) # optional - gap3 - sage: for w in W: print(w.galois_conjugates()) # optional - gap3 + sage: for w in W.iteration_tracking_words(): # optional - gap3 + ....: print(w.galois_conjugates()) [[1 0] [0 1]] [[ 1 0] diff --git a/src/sage/combinat/root_system/reflection_group_real.py b/src/sage/combinat/root_system/reflection_group_real.py index 7420f03d24a..a8727681b9a 100644 --- a/src/sage/combinat/root_system/reflection_group_real.py +++ b/src/sage/combinat/root_system/reflection_group_real.py @@ -608,7 +608,7 @@ def coxeter_diagram(self): EXAMPLES:: sage: G = ReflectionGroup(['B',3]) # optional - gap3 - sage: sorted(G.coxeter_diagram().edges(labels=True)) # optional - gap3 + sage: G.coxeter_diagram().edges(labels=True, sort=True) # optional - gap3 [(1, 2, 4), (2, 3, 3)] """ from sage.graphs.graph import Graph diff --git a/src/sage/combinat/subword_complex.py b/src/sage/combinat/subword_complex.py index 15af1d67ba0..b5455260aaa 100644 --- a/src/sage/combinat/subword_complex.py +++ b/src/sage/combinat/subword_complex.py @@ -90,7 +90,7 @@ sage: Q = I + W.w0.coxeter_sorting_word(I) sage: S = SubwordComplex(Q,W.w0) sage: S.brick_polytope() - doctest:...: RuntimeWarning: the polytope is build with rational vertices + doctest:...: RuntimeWarning: the polytope is built with rational vertices A 3-dimensional polyhedron in QQ^3 defined as the convex hull of 32 vertices AUTHORS: @@ -768,7 +768,7 @@ def plot(self, list_colors=None, labels=[], thickness=3, fontsize=14, sage: Q = c.reduced_word()*2 + W.w0.coxeter_sorting_word(c) # optional - gap3 sage: SC = SubwordComplex(Q, W.w0) # optional - gap3 sage: F = SC[15]; F.plot() # optional - gap3 - Graphics object consisting of 52 graphics primitives + Graphics object consisting of 53 graphics primitives TESTS:: @@ -1696,7 +1696,7 @@ def minkowski_summand(self, i): else: from sage.rings.cc import CC from warnings import warn - warn("the polytope is build with rational vertices", RuntimeWarning) + warn("the polytope is built with rational vertices", RuntimeWarning) min_sum = [[QQ(CC(v)) for v in F.extended_weight_configuration()[i]] for F in self] return Polyhedron(min_sum) @@ -1737,6 +1737,8 @@ def brick_polytope(self, coefficients=None): sage: c = W.index_set(); Q = c + tuple(W.w0.coxeter_sorting_word(c)) # optional - gap3 sage: SC = SubwordComplex(Q,W.w0) # optional - gap3 sage: SC.brick_polytope() # optional - gap3 + doctest:...: + RuntimeWarning: the polytope is built with rational vertices A 3-dimensional polyhedron in QQ^3 defined as the convex hull of 32 vertices """ BV = self.brick_vectors(coefficients=coefficients) @@ -1747,7 +1749,7 @@ def brick_polytope(self, coefficients=None): else: from sage.rings.cc import CC from warnings import warn - warn("the polytope is build with rational vertices", RuntimeWarning) + warn("the polytope is built with rational vertices", RuntimeWarning) BV = [[QQ(CC(v).real()) for v in V] for V in BV] return Polyhedron(BV)