Reflection groups: auxiliary Cython functions

This contains a few time-critical auxiliary cython functions for finite complex or real reflection groups.

class sage.combinat.root_system.reflection_group_c.Iterator

Bases: object

Iterator class for reflection groups.

iter_breadth()

Iterate over self using breadth-first-search.

EXAMPLES:

sage: from sage.combinat.root_system.reflection_group_c import Iterator
sage: W = CoxeterGroup(['B',2], implementation='permutation')
sage: I = Iterator(W, W.number_of_reflections())
sage: list(I.iter_breadth())
[(),
 (1,3)(2,6)(5,7),
 (1,5)(2,4)(6,8),
 (1,7,5,3)(2,4,6,8),
 (1,3,5,7)(2,8,6,4),
 (2,8)(3,7)(4,6),
 (1,7)(3,5)(4,8),
 (1,5)(2,6)(3,7)(4,8)]
>>> from sage.all import *
>>> from sage.combinat.root_system.reflection_group_c import Iterator
>>> W = CoxeterGroup(['B',Integer(2)], implementation='permutation')
>>> I = Iterator(W, W.number_of_reflections())
>>> list(I.iter_breadth())
[(),
 (1,3)(2,6)(5,7),
 (1,5)(2,4)(6,8),
 (1,7,5,3)(2,4,6,8),
 (1,3,5,7)(2,8,6,4),
 (2,8)(3,7)(4,6),
 (1,7)(3,5)(4,8),
 (1,5)(2,6)(3,7)(4,8)]
iter_depth()

Iterate over self using depth-first-search.

EXAMPLES:

sage: from sage.combinat.root_system.reflection_group_c import Iterator
sage: W = CoxeterGroup(['B',2], implementation='permutation')
sage: I = Iterator(W, W.number_of_reflections())
sage: list(I.iter_depth())
[(),
 (1,3)(2,6)(5,7),
 (1,5)(2,4)(6,8),
 (1,3,5,7)(2,8,6,4),
 (1,7)(3,5)(4,8),
 (1,7,5,3)(2,4,6,8),
 (2,8)(3,7)(4,6),
 (1,5)(2,6)(3,7)(4,8)]
>>> from sage.all import *
>>> from sage.combinat.root_system.reflection_group_c import Iterator
>>> W = CoxeterGroup(['B',Integer(2)], implementation='permutation')
>>> I = Iterator(W, W.number_of_reflections())
>>> list(I.iter_depth())
[(),
 (1,3)(2,6)(5,7),
 (1,5)(2,4)(6,8),
 (1,3,5,7)(2,8,6,4),
 (1,7)(3,5)(4,8),
 (1,7,5,3)(2,4,6,8),
 (2,8)(3,7)(4,6),
 (1,5)(2,6)(3,7)(4,8)]
iter_parabolic()

This algorithm is an alternative to the one in chevie and about 20% faster. It yields indeed all elements in the group rather than applying a given function.

The output order is not deterministic.

EXAMPLES:

sage: from sage.combinat.root_system.reflection_group_c import Iterator
sage: W = CoxeterGroup(['B',2], implementation='permutation')
sage: I = Iterator(W, W.number_of_reflections())
sage: sorted(I.iter_parabolic())
[(),
 (2,8)(3,7)(4,6),
 (1,3)(2,6)(5,7),
 (1,3,5,7)(2,8,6,4),
 (1,5)(2,4)(6,8),
 (1,5)(2,6)(3,7)(4,8),
 (1,7)(3,5)(4,8),
 (1,7,5,3)(2,4,6,8)]
>>> from sage.all import *
>>> from sage.combinat.root_system.reflection_group_c import Iterator
>>> W = CoxeterGroup(['B',Integer(2)], implementation='permutation')
>>> I = Iterator(W, W.number_of_reflections())
>>> sorted(I.iter_parabolic())
[(),
 (2,8)(3,7)(4,6),
 (1,3)(2,6)(5,7),
 (1,3,5,7)(2,8,6,4),
 (1,5)(2,4)(6,8),
 (1,5)(2,6)(3,7)(4,8),
 (1,7)(3,5)(4,8),
 (1,7,5,3)(2,4,6,8)]
iter_words_breadth()

Iterate over self using breadth-first-search and setting the reduced word.

EXAMPLES:

sage: from sage.combinat.root_system.reflection_group_c import Iterator
sage: W = CoxeterGroup(['B',2], implementation='permutation')
sage: I = Iterator(W, W.number_of_reflections())
sage: for w in I.iter_words_breadth(): w._reduced_word
[]
[1]
[0]
[0, 1]
[1, 0]
[1, 0, 1]
[0, 1, 0]
[0, 1, 0, 1]
>>> from sage.all import *
>>> from sage.combinat.root_system.reflection_group_c import Iterator
>>> W = CoxeterGroup(['B',Integer(2)], implementation='permutation')
>>> I = Iterator(W, W.number_of_reflections())
>>> for w in I.iter_words_breadth(): w._reduced_word
[]
[1]
[0]
[0, 1]
[1, 0]
[1, 0, 1]
[0, 1, 0]
[0, 1, 0, 1]
iter_words_depth()

Iterate over self using depth-first-search and setting the reduced word.

EXAMPLES:

sage: from sage.combinat.root_system.reflection_group_c import Iterator
sage: W = CoxeterGroup(['B',2], implementation='permutation')
sage: I = Iterator(W, W.number_of_reflections())
sage: for w in I.iter_words_depth(): w._reduced_word
[]
[1]
[0]
[1, 0]
[0, 1, 0]
[0, 1]
[1, 0, 1]
[0, 1, 0, 1]
>>> from sage.all import *
>>> from sage.combinat.root_system.reflection_group_c import Iterator
>>> W = CoxeterGroup(['B',Integer(2)], implementation='permutation')
>>> I = Iterator(W, W.number_of_reflections())
>>> for w in I.iter_words_depth(): w._reduced_word
[]
[1]
[0]
[1, 0]
[0, 1, 0]
[0, 1]
[1, 0, 1]
[0, 1, 0, 1]
sage.combinat.root_system.reflection_group_c.iterator_tracking_words(W)

Return an iterator through the elements of self together with the words in the simple generators.

The iterator is a breadth first search through the graph of the elements of the group with generators.

EXAMPLES:

sage: from sage.combinat.root_system.reflection_group_c import iterator_tracking_words
sage: W = ReflectionGroup(4)                        # optional - gap3
sage: for w in iterator_tracking_words(W): w        # optional - gap3
((), [])
((1,3,9)(2,4,7)(5,10,18)(6,11,16)(8,12,19)(13,15,20)(14,17,21)(22,23,24), [0])
((1,5,13)(2,6,10)(3,7,14)(4,8,15)(9,16,22)(11,12,17)(18,19,23)(20,21,24), [1])
((1,9,3)(2,7,4)(5,18,10)(6,16,11)(8,19,12)(13,20,15)(14,21,17)(22,24,23), [0, 0])
((1,7,6,12,23,20)(2,8,17,24,9,5)(3,16,10,19,15,21)(4,14,11,22,18,13), [0, 1])
((1,10,4,12,21,22)(2,11,19,24,13,3)(5,15,7,17,16,23)(6,18,8,20,14,9), [1, 0])
((1,13,5)(2,10,6)(3,14,7)(4,15,8)(9,22,16)(11,17,12)(18,23,19)(20,24,21), [1, 1])
((1,16,12,15)(2,14,24,18)(3,5,19,17)(4,6,22,20)(7,8,23,9)(10,13,21,11), [0, 0, 1])
((1,2,12,24)(3,6,19,20)(4,17,22,5)(7,11,23,13)(8,21,9,10)(14,16,18,15), [0, 1, 0])
((1,14,12,18)(2,15,24,16)(3,22,19,4)(5,6,17,20)(7,10,23,21)(8,11,9,13), [0, 1, 1])
((1,18,12,14)(2,16,24,15)(3,4,19,22)(5,20,17,6)(7,21,23,10)(8,13,9,11), [1, 0, 0])
((1,15,12,16)(2,18,24,14)(3,17,19,5)(4,20,22,6)(7,9,23,8)(10,11,21,13), [1, 1, 0])
((1,6,23)(2,17,9)(3,10,15)(4,11,18)(5,8,24)(7,12,20)(13,14,22)(16,19,21), [0, 0, 1, 0])
((1,22,21,12,4,10)(2,3,13,24,19,11)(5,23,16,17,7,15)(6,9,14,20,8,18), [0, 0, 1, 1])
((1,4,21)(2,19,13)(3,11,24)(5,7,16)(6,8,14)(9,18,20)(10,12,22)(15,17,23), [0, 1, 0, 0])
((1,17,13,12,5,11)(2,20,10,24,6,21)(3,23,14,19,7,18)(4,9,15,22,8,16), [0, 1, 1, 0])
((1,19,9,12,3,8)(2,22,7,24,4,23)(5,21,18,17,10,14)(6,13,16,20,11,15), [1, 0, 0, 1])
((1,20,23,12,6,7)(2,5,9,24,17,8)(3,21,15,19,10,16)(4,13,18,22,11,14), [1, 1, 0, 0])
((1,11,5,12,13,17)(2,21,6,24,10,20)(3,18,7,19,14,23)(4,16,8,22,15,9), [0, 0, 1, 0, 0])
((1,23,6)(2,9,17)(3,15,10)(4,18,11)(5,24,8)(7,20,12)(13,22,14)(16,21,19), [0, 0, 1, 1, 0])
((1,8,3,12,9,19)(2,23,4,24,7,22)(5,14,10,17,18,21)(6,15,11,20,16,13), [0, 1, 0, 0, 1])
((1,21,4)(2,13,19)(3,24,11)(5,16,7)(6,14,8)(9,20,18)(10,22,12)(15,23,17), [0, 1, 1, 0, 0])
((1,12)(2,24)(3,19)(4,22)(5,17)(6,20)(7,23)(8,9)(10,21)(11,13)(14,18)(15,16), [0, 0, 1, 0, 0, 1])
((1,24,12,2)(3,20,19,6)(4,5,22,17)(7,13,23,11)(8,10,9,21)(14,15,18,16), [0, 0, 1, 1, 0, 0])
>>> from sage.all import *
>>> from sage.combinat.root_system.reflection_group_c import iterator_tracking_words
>>> W = ReflectionGroup(Integer(4))                        # optional - gap3
>>> for w in iterator_tracking_words(W): w        # optional - gap3
((), [])
((1,3,9)(2,4,7)(5,10,18)(6,11,16)(8,12,19)(13,15,20)(14,17,21)(22,23,24), [0])
((1,5,13)(2,6,10)(3,7,14)(4,8,15)(9,16,22)(11,12,17)(18,19,23)(20,21,24), [1])
((1,9,3)(2,7,4)(5,18,10)(6,16,11)(8,19,12)(13,20,15)(14,21,17)(22,24,23), [0, 0])
((1,7,6,12,23,20)(2,8,17,24,9,5)(3,16,10,19,15,21)(4,14,11,22,18,13), [0, 1])
((1,10,4,12,21,22)(2,11,19,24,13,3)(5,15,7,17,16,23)(6,18,8,20,14,9), [1, 0])
((1,13,5)(2,10,6)(3,14,7)(4,15,8)(9,22,16)(11,17,12)(18,23,19)(20,24,21), [1, 1])
((1,16,12,15)(2,14,24,18)(3,5,19,17)(4,6,22,20)(7,8,23,9)(10,13,21,11), [0, 0, 1])
((1,2,12,24)(3,6,19,20)(4,17,22,5)(7,11,23,13)(8,21,9,10)(14,16,18,15), [0, 1, 0])
((1,14,12,18)(2,15,24,16)(3,22,19,4)(5,6,17,20)(7,10,23,21)(8,11,9,13), [0, 1, 1])
((1,18,12,14)(2,16,24,15)(3,4,19,22)(5,20,17,6)(7,21,23,10)(8,13,9,11), [1, 0, 0])
((1,15,12,16)(2,18,24,14)(3,17,19,5)(4,20,22,6)(7,9,23,8)(10,11,21,13), [1, 1, 0])
((1,6,23)(2,17,9)(3,10,15)(4,11,18)(5,8,24)(7,12,20)(13,14,22)(16,19,21), [0, 0, 1, 0])
((1,22,21,12,4,10)(2,3,13,24,19,11)(5,23,16,17,7,15)(6,9,14,20,8,18), [0, 0, 1, 1])
((1,4,21)(2,19,13)(3,11,24)(5,7,16)(6,8,14)(9,18,20)(10,12,22)(15,17,23), [0, 1, 0, 0])
((1,17,13,12,5,11)(2,20,10,24,6,21)(3,23,14,19,7,18)(4,9,15,22,8,16), [0, 1, 1, 0])
((1,19,9,12,3,8)(2,22,7,24,4,23)(5,21,18,17,10,14)(6,13,16,20,11,15), [1, 0, 0, 1])
((1,20,23,12,6,7)(2,5,9,24,17,8)(3,21,15,19,10,16)(4,13,18,22,11,14), [1, 1, 0, 0])
((1,11,5,12,13,17)(2,21,6,24,10,20)(3,18,7,19,14,23)(4,16,8,22,15,9), [0, 0, 1, 0, 0])
((1,23,6)(2,9,17)(3,15,10)(4,18,11)(5,24,8)(7,20,12)(13,22,14)(16,21,19), [0, 0, 1, 1, 0])
((1,8,3,12,9,19)(2,23,4,24,7,22)(5,14,10,17,18,21)(6,15,11,20,16,13), [0, 1, 0, 0, 1])
((1,21,4)(2,13,19)(3,24,11)(5,16,7)(6,14,8)(9,20,18)(10,22,12)(15,23,17), [0, 1, 1, 0, 0])
((1,12)(2,24)(3,19)(4,22)(5,17)(6,20)(7,23)(8,9)(10,21)(11,13)(14,18)(15,16), [0, 0, 1, 0, 0, 1])
((1,24,12,2)(3,20,19,6)(4,5,22,17)(7,13,23,11)(8,10,9,21)(14,15,18,16), [0, 0, 1, 1, 0, 0])
sage.combinat.root_system.reflection_group_c.parabolic_iteration_application(W, f)

This is the word-for-word translation of the algorithm in chevie.

Note

It keeps all products of elements of the reduced coset representatives in memory.

INPUT:

  • W – a real reflection group

  • f – a function with one argument: an element of W

EXAMPLES:

sage: W = CoxeterGroup(['E',6], implementation='permutation')
sage: from sage.combinat.root_system.reflection_group_c import parabolic_iteration_application
sage: lst = []
sage: def f(x):
....:     lst.append(x)
sage: parabolic_iteration_application(W, f)
sage: len(lst) == W.cardinality()
True
>>> from sage.all import *
>>> W = CoxeterGroup(['E',Integer(6)], implementation='permutation')
>>> from sage.combinat.root_system.reflection_group_c import parabolic_iteration_application
>>> lst = []
>>> def f(x):
...     lst.append(x)
>>> parabolic_iteration_application(W, f)
>>> len(lst) == W.cardinality()
True
sage.combinat.root_system.reflection_group_c.reduce_in_coset(w, S, parabolic, N, right)

Return the minimal length coset representative of w of the parabolic subgroup indexed by parabolic (with indices \(\{0, \ldots, n\}\)).

EXAMPLES:

sage: from sage.combinat.root_system.reflection_group_c import reduce_in_coset
sage: W = CoxeterGroup(['B',3], implementation='permutation')
sage: N = W.number_of_reflections()
sage: s = W.simple_reflections()
sage: w = s[2] * s[1] * s[3]
sage: reduce_in_coset(w, tuple(s), [], N, True).reduced_word()
[2, 1, 3]
sage: reduce_in_coset(w, tuple(s), [], N, False).reduced_word()
[2, 1, 3]
sage: reduce_in_coset(w, tuple(s), [0], N, True).reduced_word()
[2, 1, 3]
sage: reduce_in_coset(w, tuple(s), [0], N, False).reduced_word()
[2, 3]
sage: reduce_in_coset(w, tuple(s), [0,2], N, True).reduced_word()
[2, 1, 3]
sage: reduce_in_coset(w, tuple(s), [0,2], N, False).reduced_word()
[2]
>>> from sage.all import *
>>> from sage.combinat.root_system.reflection_group_c import reduce_in_coset
>>> W = CoxeterGroup(['B',Integer(3)], implementation='permutation')
>>> N = W.number_of_reflections()
>>> s = W.simple_reflections()
>>> w = s[Integer(2)] * s[Integer(1)] * s[Integer(3)]
>>> reduce_in_coset(w, tuple(s), [], N, True).reduced_word()
[2, 1, 3]
>>> reduce_in_coset(w, tuple(s), [], N, False).reduced_word()
[2, 1, 3]
>>> reduce_in_coset(w, tuple(s), [Integer(0)], N, True).reduced_word()
[2, 1, 3]
>>> reduce_in_coset(w, tuple(s), [Integer(0)], N, False).reduced_word()
[2, 3]
>>> reduce_in_coset(w, tuple(s), [Integer(0),Integer(2)], N, True).reduced_word()
[2, 1, 3]
>>> reduce_in_coset(w, tuple(s), [Integer(0),Integer(2)], N, False).reduced_word()
[2]
sage.combinat.root_system.reflection_group_c.reduced_word_c(W, w)

Compute a reduced word for the element w in the reflection group W in the positions range(n).

EXAMPLES:

sage: from sage.combinat.root_system.reflection_group_c import reduced_word_c
sage: W = ReflectionGroup(['B',2])                  # optional - gap3
sage: [ reduced_word_c(W,w) for w in W ]            # optional - gap3
[[], [1], [0], [0, 1], [1, 0], [1, 0, 1], [0, 1, 0], [0, 1, 0, 1]]
>>> from sage.all import *
>>> from sage.combinat.root_system.reflection_group_c import reduced_word_c
>>> W = ReflectionGroup(['B',Integer(2)])                  # optional - gap3
>>> [ reduced_word_c(W,w) for w in W ]            # optional - gap3
[[], [1], [0], [0, 1], [1, 0], [1, 0, 1], [0, 1, 0], [0, 1, 0, 1]]