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

Commit

Permalink
using a cached version self._number_of_reflections to avoid computing…
Browse files Browse the repository at this point in the history
… it again and again, expecially important in has_descent
  • Loading branch information
stumpc5 committed Apr 22, 2016
1 parent 9b0ef92 commit 8d76520
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/sage/combinat/root_system/reflection_group_real.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ def __init__(self, W_types, index_set=None, hyperplane_index_set=None, reflectio
cls.__init__(self, W_types, index_set = index_set,
hyperplane_index_set = hyperplane_index_set,
reflection_index_set = reflection_index_set)
N = self.number_of_reflections()

def _repr_(self):
r"""
Expand Down Expand Up @@ -324,7 +323,7 @@ def iteration(self, algorithm="breadth", tracking_words=True):
(1,5)(2,6)(3,7)(4,8)
"""
from sage.combinat.root_system.reflection_group_c import Iterator
return iter(Iterator(self, N=self.number_of_reflections(),
return iter(Iterator(self, N=self._number_of_reflections,
algorithm=algorithm, tracking_words=tracking_words))

def __iter__(self):
Expand Down Expand Up @@ -425,7 +424,7 @@ def positive_roots(self):
sage: W.positive_roots() # optional - gap3
[(1, 0, 0), (0, 1, 0), (0, 0, 1), (1, 1, 0), (0, 1, 1), (1, 1, 1)]
"""
return self.roots()[:self.number_of_reflections()]
return self.roots()[:self._number_of_reflections]

def almost_positive_roots(self):
r"""
Expand Down Expand Up @@ -772,7 +771,7 @@ def has_left_descent(self, i):
False
"""
W = self.parent()
return self(W._index_set_inverse[i]+1) > W.number_of_reflections()
return self(W._index_set_inverse[i]+1) > W._number_of_reflections

def has_descent(self, i, side='left', positive=False):
r"""
Expand Down

0 comments on commit 8d76520

Please sign in to comment.