Ask Your Question

Revision history [back]

The first thing you can try is using max with a key function to compare the elements by their length:

sage: G = WeylGroup(['F',4])
sage: %time w_max = max(G, key=lambda w:w.length())
CPU times: user 3.09 s, sys: 18 µs, total: 3.09 s
Wall time: 3.09 s
sage: w_max.length()
24
sage: w_max
[-1  0  0  0]
[ 0 -1  0  0]
[ 0  0 -1  0]
[ 0  0  0 -1]

Is the above 3s is too slow? If yes, it would be interesting to implement a max function in Sage which would do the computation in parallel, maybe using the @parallel decorator?