Hi Anne, > I do not know much about the poset package, but I also had a lot > of trouble last spring with various comparison functions overwriting > each other (in a not very consistent fashion) when writing code > for crystals. I remember spending a whole day with Nicolas on this. > > Here is a reference: > > http://www.python.org/doc/2.4.4/ref/customization.html > > But it would be a good idea to have clean conventions of which > methods need to be implemented etc.. Right now things do not > seem very consistent in sage.
You are right ! The main problem here is not only a question of convention but also a problem of very bad side effect in Posets: > > sage: p1, p2 = Posets(2).list() > > sage: p2 < p1 > > True > > sage: [[p1.__cmp__(p2) for p1 in Posets(2)] for p2 in Posets(2)] > > [[0, 1], [1, 0]] > > sage: [[p2.__cmp__(p1) for p1 in Posets(2)] for p2 in Posets(2)] > > [[0, 1], [-1, 0]] > > sage: p2 < p1 > > False Doing some comparison shouldn't change whether p1 < p2 or not. Anyway, since at least equality is now working I can test automatically some of my conjecture (I really need to take the time to write in on the paper by the way)... My machine is now writing a *lot* of Cartan matrices. So far, sage (which use my conjecture) agrees with MuPAD which uses my generic algorithm :-) Here is a typical output: ================================================== Poset = [[0, 3], [1, 2], [1, 4], [1, 5], [2, 3]] #monoid = 4 SemiSimple ================================================== Poset = [[0, 1], [0, 2], [0, 5], [1, 4], [2, 3], [3, 4]] #monoid = 10 [1 0 0 0 0 0 0 0] [0 1 0 0 0 0 0 0] [0 0 1 0 0 0 0 0] [0 0 q 1 0 0 0 0] [0 0 0 0 1 0 0 0] [0 0 0 0 q 1 0 0] [0 0 0 0 0 0 1 0] [0 0 0 0 0 0 0 1] 2*q + 8 ================================================== Poset = [[0, 4], [1, 2], [1, 3], [1, 5], [2, 4], [3, 4]] #monoid = 8 SemiSimple ================================================== Poset = [[0, 1], [0, 2], [0, 3], [1, 5], [2, 5], [3, 4], [4, 5]] #monoid = 33 22 x 22 dense matrix over Symbolic Ring 2*q^2 + 9*q + 22 ================================================== Poset = [[0, 5], [1, 2], [1, 3], [1, 4], [2, 5], [3, 5], [4, 5]] #monoid = 30 24 x 24 dense matrix over Symbolic Ring 6*q + 24 ================================================== Poset = [[0, 1], [1, 3], [2, 3], [2, 4], [2, 5]] #monoid = 5 [1 0 0 0] [0 1 0 0] [0 q 1 0] [0 0 0 1] q + 4 But I should probably keep this secret and send this on a private e-mail where it belongs :-) Cheers, Florent -- 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-de...@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.