On Wed, Sep 12, 2012 at 01:44:26AM -0700, Andrew Mathas wrote: > I worked out what is causing my code to take so long to invert these > maps: it is because the inverse map is defined as a linear morphism on > the basis of the codomain (=domain of the inverse) rather than by > recursively stripping off the leading terms.
Ah right: there is even a comment about it in the file ``This should be removed and optimized (the inverse should not be computed on the basis''. That's because, at this point, __invert__ insists on constructing the inverse morphism as a triangular morphism (it's good to keep that mathematical information), and TriangularModuleMorphism inherits from ModuleMorphismByLinearity (for which there are no compelling reasons). We really need to introduce an option in __invert__, as both approaches (calculating on the basis or recursively stripping) can have their advantage depending on the context. It's like when solving linear equations: does one prefer to compute the inverse once for all, or rather use an LU decomposition. Note that for the moment you can compute inverse images by recursively stripping using phi.preimage. And you can build the inverse morphism by hand using what's done in the non invertible case for __invert__: SetMorphism(Hom(self.codomain(), self.domain(), ModulesWithBasis(self.domain().base_ring())), self.preimage) 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.