def defect_set(sigma, w):
- w is a reduced word for a permutation
- sigma is the mask, given as a binary word of length l(w)
- the defect set, that is the set of positions j such that
l(w^{\sigma[j-1]} w_j) < l(w^{\sigma[j-1]})
S = Permutations(max(w)+1)
w_S = [S.simple_reflection(e) for e in w]
for j in range(len(w)-1):
w_up_to_j = w_up_to_j.left_action_product(w_S[j])
if (w_up_to_j.left_action_product(w_S[j+1])).length() < w_up_to_j.length():
sage: statistic(Permutation([4,3,5,2,1]))
sage: statistic(Permutation([5,4,2,1,3]))
masks = cartesian_product([[0,1]]*k)
return max([len(defect_set(m, w))
for w in pi.reduced_words()])
parent_initializer = Permutations
for elt in parent_initializer(level):
print('%s => %s' % (element_repr(elt), statistic(elt)))