On Sun, Jan 08, 2012 at 09:47:51AM -0800, Travis Scrimshaw wrote: > Originally I was thinking the global namespace, but to avoid > breaking code (and apparently to conform more to python coding > practices), I am now thinking for this case we expose only CartanDatum > to the user and have static references to the subsequent classes > (accessed as attributes). For example to access directly the > CartanType class, one would run > > CartanDatum.CartanType(['A', 2])
Having a single entry point in the global namespace is already the main role of CartanType. During the Sage-Combinat/Chevie days, we had discussed the following plan: - Rename CartanType to CartanDatum (with backward compatibility link of course) - Merge CartanDatum and RootSystem. So one would do: - CartanDatum(['A',2]).dynkin_diagram() - CartanDatum(['A',2]).cartan_matrix() - CartanDatum(['A',2]).root_lattice() - CartanDatum(['A',2]).weyl_group() - ... - And then, maybe, deprecate cartan_matrix, dynkin_diagram, DynkinDiagram, and friends being exposed by default in the global namespace. > I was thinking of using this as an initial sample of a design > pattern to implement in math objects with lots of different > representations such as the partitions or matrices (such as if they > are sparse or not). Certainly something that's been though of a lot, and deserves yet more thoughts. Have you explored the related: - http://combinat.sagemath.org/code/file/tip/sage/categories/with_realizations.py - http://combinat.sagemath.org/code/file/tip/sage/categories/examples/realizations.py Finishing the corresponding patch is one of my top priority for the coming week(s). > Right now I just cached the results from the function > cartan_matrix() which seemed like the natural place to do so since we > only need a singleton (a UniqueRepresentation in sage) of each matrix > for each Cartan type. This actually netted a speed increase over > caching CartanType.cartan_matrix() and adding an attribute in > RiggedConfigurations (I removed in influence of KleberTree from my > speed tests by creating it beforehand). Ok. Thanks! A note, just to be pedantic: Singleton is a special case of UniqueRepresentation (when there are no arguments). And by the way, there is an upcoming Singleton class for that special case coming in #11900. > > (And someday someone should implement matrices indexed by anything, > > and upgrade cartan matrices accordingly). > > I concur with this, but I think we should carry this one step further > and have vectors spaces whose basis is indexed by arbitrary lists so > the matrices can act in a natural fashion. Isn't that the (misnamed) CombinatorialFreeModule? 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.