Hi Anne, On Mon, Mar 28, 2011 at 03:55:19PM -0700, Anne Schilling wrote: > On 3/28/11 3:21 PM, Daniel Bump wrote: > > > >The patch contains this: > > > >ind = lambda i: (-w0.action(alpha[i])).support()[0] > > > >This would be called for each element of hw, which > >depends on the distance to the highest weight vector. > >That's not so bad, but if you looped over the crystal and > >computed the involution for every element, it would be > >called many times. Since w0.action is probably a little > >expensive, it would probably be more efficient to implement > >this as a dictionary once and for all when the crystal is > >created. > > Good suggestion! Done and posted on trac.
Sorry to pop up after the fact. An alternative would be to make this a cached method: sage: T = CrystalOfTableaux(...) sage: T.dynkin_diagram_automorphism_w0() {1: 5, 2: 4, 3: 3, 4: 2, 5: 1} This has several advantages: - It documents what it does mathematically (method name + docstring) - It's easier to move around, generalize, ... in fact this method really belongs to the root system. In particular, it's closely related to dynkin_diagram_automorphism_of_alcove_morphism: sage: L = RootSystem(["A",5]).ambient_space() sage: w0 = L.weyl_group().long_element() sage: def f(x): return - w0.action(x) sage: L.dynkin_diagram_automorphism_of_alcove_morphism(f) {1: 5, 2: 4, 3: 3, 4: 2, 5: 1} (Note: I had to cheat a tiny bit, and comment out the "level" check in the code which only makes sens in the affine case) Now if you prefer to keep this method in crystals for the moment to avoid conflicts with the ongoing changes in root systems, that's ok too. Btw: - x.support()[0] -> x.leading_support() Cheers, Nicolas -- Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net> http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.