File tree Expand file tree Collapse file tree 1 file changed +15
-18
lines changed Expand file tree Collapse file tree 1 file changed +15
-18
lines changed Original file line number Diff line number Diff line change @@ -1577,26 +1577,23 @@ def is_fully_commutative(self) -> bool:
1577
1577
sage: len([1 for w in W if w.is_fully_commutative()])
1578
1578
24
1579
1579
"""
1580
- matrix = self .parent ().coxeter_matrix ()
1580
+ word = self .reduced_word ()
1581
+ from sage .combinat .root_system .braid_orbit import is_fully_commutative as is_fully_comm
1581
1582
1582
- def contains_long_braid (w ):
1583
- # This detects 'braid' subwords.
1584
- # TODO: optimisation
1585
- if len (w ) <= 2 :
1586
- return False
1587
- for i in range (len (w ) - 2 ):
1588
- a = w [i ]
1589
- b = w [i + 1 ]
1590
- m = matrix [a , b ]
1591
- if m > 2 and i + m <= len (w ):
1592
- ab = [a , b ]
1593
- if all (wj == ab [j % 2 ]
1594
- for j , wj in enumerate (w [i :i + m ])):
1595
- return True
1596
- return False
1583
+ group = self .parent ()
1584
+ braid_rels = group .braid_relations ()
1585
+ I = group .index_set ()
1586
+
1587
+ from sage .rings .integer_ring import ZZ
1588
+ be_careful = any (i not in ZZ for i in I )
1589
+
1590
+ if be_careful :
1591
+ Iinv = {i : j for j , i in enumerate (I )}
1592
+ word = [Iinv [i ] for i in word ]
1593
+ braid_rels = [[[Iinv [i ] for i in l ],
1594
+ [Iinv [i ] for i in r ]] for l , r in braid_rels ]
1597
1595
1598
- return not any (contains_long_braid (word )
1599
- for word in self .reduced_words_iter ())
1596
+ return is_fully_comm (word , braid_rels )
1600
1597
1601
1598
def reduced_word_reverse_iterator (self ):
1602
1599
"""
You can’t perform that action at this time.
0 commit comments