Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
working out the left/right action
Browse files Browse the repository at this point in the history
  • Loading branch information
stumpc5 committed Apr 30, 2016

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 619ba6e commit f0353a5
Showing 5 changed files with 30 additions and 93 deletions.
81 changes: 9 additions & 72 deletions src/sage/combinat/root_system/reflection_group_complex.py
Original file line number Diff line number Diff line change
@@ -1838,14 +1838,11 @@ def reflection_length(self, in_unitary_group=False):
return w.reflection_length(in_unitary_group=in_unitary_group)

#@cached_in_parent_method
def to_matrix(self, side="left", on_space="primal"):
def to_matrix(self, on_space="primal"):
r"""
Return ``self`` as a matrix acting on the underlying vector
space.
- ``side`` -- optional (default: ``"left"``) whether the
action of ``self`` is on the ``"left"`` or on the ``"right"``
- ``on_space`` -- optional (default: ``"primal"``) whether
to act as the reflection representation on the given
basis, or to act on the dual reflection representation
@@ -1875,44 +1872,13 @@ def to_matrix(self, side="left", on_space="primal"):
[1, 2, 1]
[ 0 -1]
[-1 0]
TESTS::
sage: W = ReflectionGroup(4) # optional - gap3
sage: all( w.to_matrix(side="left") == W.from_reduced_word(reversed(w.reduced_word())).to_matrix(side="right").transpose() for w in W ) # optional - gap3
True
sage: all( w.to_matrix(side="right") == W.from_reduced_word(reversed(w.reduced_word())).to_matrix(side="left").transpose() for w in W ) # optional - gap3
True
sage: W = ReflectionGroup(7) # optional - gap3
sage: all( w.to_matrix(side="left") == W.from_reduced_word(reversed(w.reduced_word())).to_matrix(side="right").transpose() for w in W ) # optional - gap3
True
sage: all( w.to_matrix(side="right") == W.from_reduced_word(reversed(w.reduced_word())).to_matrix(side="left").transpose() for w in W ) # optional - gap3
True
"""
W = self.parent()
if W._reflection_representation is None:
is_well_generated = W.is_well_generated()
if side == "left":
if not is_well_generated:
w = W.from_reduced_word(reversed(self.reduced_word()))
else:
w = self
elif side == "right":
w = self
else:
raise ValueError('side must be "left" or "right"')

Delta = W.independent_roots()
Phi = W.roots()
M = Matrix([Phi[w(Phi.index(alpha)+1)-1] for alpha in Delta])
M = Matrix([Phi[self(Phi.index(alpha)+1)-1] for alpha in Delta])
mat = W.base_change_matrix() * M

if side == "left":
if not is_well_generated:
mat = mat.transpose()
else:
mat = mat.inverse().conjugate_transpose()
else:
refl_repr = W._reflection_representation
id_mat = identity_matrix(QQ,refl_repr[W.index_set()[0]].nrows())
@@ -1930,17 +1896,14 @@ def to_matrix(self, side="left", on_space="primal"):

matrix = to_matrix

def action(self, vec, side="left", on_space="primal"):
def action(self, vec, on_space="primal"):
r"""
Return the image of ``vec`` under the action of ``self``.
INPUT:
- ``vec`` -- vector in the basis given by the simple root
- ``side`` -- optional (default: ``"left"``) whether the
action of ``self`` is on the ``"left"`` or on the ``"right"``
- ``on_space`` -- optional (default: ``"primal"``) whether
to act as the reflection representation on the given
basis, or to act on the dual reflection representation
@@ -1951,36 +1914,16 @@ def action(self, vec, side="left", on_space="primal"):
sage: W = ReflectionGroup(['A',2]) # optional - gap3
sage: for w in W: # optional - gap3
....: print("%s %s"%(w.reduced_word(), # optional - gap3
....: [w.action(weight) for weight in W.fundamental_weights()])) # optional - gap3
....: [w.action(weight,side="left") for weight in W.fundamental_weights()])) # optional - gap3
[] [(2/3, 1/3), (1/3, 2/3)]
[2] [(2/3, 1/3), (1/3, -1/3)]
[1] [(-1/3, 1/3), (1/3, 2/3)]
[1, 2] [(-1/3, 1/3), (-2/3, -1/3)]
[2, 1] [(-1/3, -2/3), (1/3, -1/3)]
[1, 2, 1] [(-1/3, -2/3), (-2/3, -1/3)]
TESTS::
sage: W = ReflectionGroup(['B',3]) # optional - gap3
sage: all( w.action(alpha,side="right") == w.action_on_root(alpha,side="right") for w in W for alpha in W.simple_roots() ) # optional - gap3
True
sage: all( w.action(alpha,side="left") == w.action_on_root(alpha,side="left") for w in W for alpha in W.simple_roots() ) # optional - gap3
True
sage: W = ReflectionGroup(4) # optional - gap3
sage: all( w.action(alpha,side="right") == w.action_on_root(alpha,side="right") for w in W for alpha in W.simple_roots() ) # optional - gap3
True
sage: W = ReflectionGroup(4) # optional - gap3
sage: all( w.action(alpha,side="left") == w.action_on_root(alpha,side="left") for w in W for alpha in W.simple_roots() ) # optional - gap3
True
"""
mat = self.matrix(side=side, on_space=on_space)
if side == "right":
return vec*mat
elif side == "left":
return mat*vec
else:
raise ValueError('side must be "left" or "right"')
mat = self.matrix(on_space=on_space)
return vec*mat
# todo: the following could be implemented directly in
# cython to avoid creating the matrix
# direct speedup factor would be 10
@@ -2012,7 +1955,7 @@ def _act_on_(self, vec, self_on_left):
(1, 0) -> (-1, -1), (0, 1) -> (1, 0), (1, 1) -> (0, -1)
"""
if self_on_left:
return self.action(vec,side="left")
pass
else:
return self.action(vec,side="right")

@@ -2045,13 +1988,7 @@ def action_on_root_indices(self, i):
sage: all(sorted([w.action_on_root_indices(i) for i in range(N)]) == range(N) for w in W) # optional - gap3
True
"""
#if side == "right":
#w = self
#elif side == "left":
#w = ~self
#else:
#raise ValueError('side must be "left" or "right"')
return w(i + 1) - 1
return self(i + 1) - 1

def action_on_root(self, root):
r"""
@@ -2071,7 +2008,7 @@ def action_on_root(self, root):
sage: W = ReflectionGroup(['A',2]) # optional - gap3
sage: for w in W: # optional - gap3
....: print("%s %s"%(w.reduced_word(), # optional - gap3
....: [w.action_on_root(beta) for beta in W.positive_roots()])) # optional - gap3
....: [w.action_on_root(beta,side="left") for beta in W.positive_roots()])) # optional - gap3
[] [(1, 0), (0, 1), (1, 1)]
[2] [(1, 1), (0, -1), (1, 0)]
[1] [(-1, 0), (1, 1), (0, 1)]
28 changes: 11 additions & 17 deletions src/sage/combinat/root_system/reflection_group_real.py
Original file line number Diff line number Diff line change
@@ -52,6 +52,7 @@

from sage.misc.cachefunc import cached_method, cached_in_parent_method
from sage.misc.lazy_attribute import lazy_attribute
from sage.misc.misc_c import prod
from sage.combinat.root_system.cartan_type import CartanType, CartanType_abstract
from sage.rings.all import ZZ, QQ
from sage.matrix.matrix import is_Matrix
@@ -63,7 +64,7 @@
from sage.misc.sage_eval import sage_eval
from sage.rings.universal_cyclotomic_field import UniversalCyclotomicField
from sage.combinat.root_system.reflection_group_c import reduced_word_c
from sage.matrix.all import Matrix
from sage.matrix.all import Matrix, identity_matrix

def ReflectionGroup(*args,**kwds):
r"""
@@ -825,7 +826,7 @@ def has_descent(self, i, side="left", positive=False):
else:
raise ValueError('side must be "left" or "right"')

def to_matrix(self, side="left", on_space="primal"):
def to_matrix(self, side="right", on_space="primal"):
r"""
Return ``self`` as a matrix acting on the underlying vector
space.
@@ -905,7 +906,7 @@ def to_matrix(self, side="left", on_space="primal"):

matrix = to_matrix

def action(self, vec, side="left", on_space="primal"):
def action(self, vec, side="right", on_space="primal"):
r"""
Return the image of ``vec`` under the action of ``self``.
@@ -926,7 +927,7 @@ def action(self, vec, side="left", on_space="primal"):
sage: W = ReflectionGroup(['A',2]) # optional - gap3
sage: for w in W: # optional - gap3
....: print("%s %s"%(w.reduced_word(), # optional - gap3
....: [w.action(weight) for weight in W.fundamental_weights()])) # optional - gap3
....: [w.action(weight,side="left") for weight in W.fundamental_weights()])) # optional - gap3
[] [(2/3, 1/3), (1/3, 2/3)]
[2] [(2/3, 1/3), (1/3, -1/3)]
[1] [(-1/3, 1/3), (1/3, 2/3)]
@@ -980,7 +981,7 @@ def _act_on_(self, vec, self_on_left):
else:
return self.action(vec,side="right")

def action_on_root_indices(self, i, side="left"):
def action_on_root_indices(self, i, side="right"):
"""
Return the action on the set of roots.
@@ -994,12 +995,12 @@ def action_on_root_indices(self, i, side="left"):
EXAMPLES::
sage: W = ReflectionGroup(['A',3]); w = W.w0 # optional - gap3
sage: [ w.action_on_root_indices(i) for i in range(len(W.roots())) ] # optional - gap3
sage: [ w.action_on_root_indices(i,side="left") for i in range(len(W.roots())) ] # optional - gap3
[8, 7, 6, 10, 9, 11, 2, 1, 0, 4, 3, 5]
sage: W = ReflectionGroup(['A',2],reflection_index_set=['A','B','C']) # optional - gap3
sage: w = W.w0 # optional - gap3
sage: [ w.action_on_root_indices(i) for i in range(len(W.roots())) ] # optional - gap3
sage: [ w.action_on_root_indices(i,side="left") for i in range(len(W.roots())) ] # optional - gap3
[4, 3, 5, 1, 0, 2]
"""
if side == "right":
@@ -1011,7 +1012,7 @@ def action_on_root_indices(self, i, side="left"):
W = w.parent()
return w(i + 1) - 1

def action_on_root(self, root, side="left"):
def action_on_root(self, root, side="right"):
r"""
Return the root obtained by applying ``self`` to ``root``.
@@ -1027,7 +1028,7 @@ def action_on_root(self, root, side="left"):
sage: W = ReflectionGroup(['A',2]) # optional - gap3
sage: for w in W: # optional - gap3
....: print("%s %s"%(w.reduced_word(), # optional - gap3
....: [w.action_on_root(beta) for beta in W.positive_roots()])) # optional - gap3
....: [w.action_on_root(beta,side="left") for beta in W.positive_roots()])) # optional - gap3
[] [(1, 0), (0, 1), (1, 1)]
[2] [(1, 1), (0, -1), (1, 0)]
[1] [(-1, 0), (1, 1), (0, 1)]
@@ -1072,14 +1073,7 @@ def inversion_set(self, side="right"):
[(0, 1), (1, 1)]
"""
Phi_plus = set(self.parent().positive_roots())
if side == "left":
w = self
elif side == "right":
w = ~self
else:
raise ValueError('side must be "left" or "right"')

return [root for root in Phi_plus if w.action_on_root(root) not in Phi_plus]
return [root for root in Phi_plus if self.action_on_root(root,side=side) not in Phi_plus]

@cached_in_parent_method
def right_coset_representatives(self):
4 changes: 2 additions & 2 deletions src/sage/combinat/subword_complex.py
Original file line number Diff line number Diff line change
@@ -389,7 +389,7 @@ def kappa_preimage(self):
W = self.parent().group()
N = len(W.long_element(as_word=True))
root_conf = self._root_configuration_indices()
return [~w for w in W if all(w.action_on_root_indices(i) < N
return [~w for w in W if all(w.action_on_root_indices(i,side="left") < N
for i in root_conf)]

def is_vertex(self):
@@ -2018,7 +2018,7 @@ def _extended_root_configuration_indices(W, Q, F):
V_roots = []
pi = W.one()
for i, wi in enumerate(Q):
V_roots.append(pi.action_on_root_indices(W.simple_root_index(wi)))
V_roots.append(pi.action_on_root_indices(W.simple_root_index(wi),side="left"))
if i not in F:
pi = pi.apply_simple_reflection_right(wi)
return V_roots
2 changes: 1 addition & 1 deletion src/sage/combinat/subword_complex_c.pyx
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ cpdef int _flip_c(W, set positions, list extended_root_conf_indices,
if j != i:
t = R[min(r, r_minus)]
for k in range(min(i, j) + 1, max(i, j) + 1):
extended_root_conf_indices[k] = t.action_on_root_indices(extended_root_conf_indices[k])
extended_root_conf_indices[k] = t.action_on_root_indices(extended_root_conf_indices[k],side="left")
return j

cpdef list _construct_facets_c(tuple Q, w, int n=-1, int pos=0, int l=-1):
8 changes: 7 additions & 1 deletion src/sage/groups/matrix_gps/coxeter_group.py
Original file line number Diff line number Diff line change
@@ -791,7 +791,7 @@ def canonical_matrix(self):
return self.matrix()

@cached_method
def action_on_root_indices(self, i):
def action_on_root_indices(self, i, side="left"):
"""
Return the action on the set of roots.
@@ -804,6 +804,12 @@ def action_on_root_indices(self, i):
sage: w.action_on_root_indices(0)
11
"""
if side == "left":
w = self
elif side == "right":
w = ~self
else:
raise ValueError('side must be "left" or "right"')
roots = self.parent().roots()
rt = self * roots[i]
return roots.index(rt)

0 comments on commit f0353a5

Please sign in to comment.