Hi Jesus, On Wed, Oct 03, 2012 at 12:13:31PM +0200, Florent Hivert wrote: > > When relabelling a Cartan type: > > > > sage: A3 = CartanType("A3") > > sage: A3r = A3.relabel({1:2,2:3,3:1}) > > > > one loses the cartan_matrix method, which is not implemented in > > [...]/combinat/root_system/type_relabel.py. > > > > It would be trivial to create it: just calling the cartan_matrix method of > > the CartanType parent and reordering columns and rows according to the > > relabelling.
Good catch! Thanks for the feedback. Actually, the problem is that ``cartan_matrix`` is implemented for crystalographic cartan types (in the class sage.combinat.root_system.cartan_type.CartanType_crystalographic). However, when constructing a relabeled cartan type, that information is lost; A3r is not put in the right class:: sage: A3.__class__.mro() [<class 'sage.combinat.root_system.type_A.CartanType'>, ... <class 'sage.combinat.root_system.cartan_type.CartanType_finite'>, <class 'sage.combinat.root_system.cartan_type.CartanType_simply_laced'>, <class 'sage.combinat.root_system.cartan_type.CartanType_crystalographic'>, <class 'sage.combinat.root_system.cartan_type.CartanType_simple'>, ... <class 'sage.combinat.root_system.cartan_type.CartanType_abstract'>, ...] sage: A3r.__class__.mro() [<class 'sage.combinat.root_system.type_relabel.CartanType'>, ... <class 'sage.combinat.root_system.cartan_type.CartanType_abstract'>, ...] There is already a hook in the constructor for relabelled cartan types to handle this for affine cartan types. In sage.combinat.root_system.type_relabel.CartanType.__init__, you will find: if type.is_affine(): self._add_abstract_superclass(CartanType_affine) And indeed this works:: sage: C = CartanType(["A",3,1]) sage: Cr = C.relabel({0:0,1:2,2:3,3:1}) sage: Cr.cartan_matrix() [ 2 -1 -1 0] [-1 2 0 -1] [-1 0 2 -1] [ 0 -1 -1 2] So the right fix would be to add similar hooks for finite, simply laced, crystalographic, and simple cartan types. > > May I open a ticket in trac? Please! I'd be happy to review a patch if you would be willing to write one. 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.