Hi Marco, On 2012-11-04, mmarco <mma...@unizar.es> wrote: > I don't know if this is the right place and time to ask this: what > about morphisms for Parent with generators? I mean, in some cases, you > can define a morphism just by passing a list with the images of the > generators to .hom() But apparentñy, it has to be done by hand for > each case. Would it be possible to implement it in Parent?
Theoretically it may be possible. Consider, for example, a ZZ[x] module M. You know the images of the generators of M, and you know that you want to have a morphism in the category of ZZ[x]-modules. Hence, from the images of the generators of M, you can construct the images of any elements x of M, provided that either M or x has a method that expresses x in terms of the generators, and provided that there is another method that understands the output of the first method. So, if you want a general framework, I could imagine that the following could work. Provide Parent with a method, say, def to_generator_data(self,x) which by default raises a NotImplementedError. And then, there could be a method def from_generator_data(self, data, gens=None) that constructs an element out of the data returned by to_generator_data, but with an optional argument `gens` that defaults to the list of generators. The specification is: self.from_generator_data(self.to_generator_data(x))==x for all x in self. Such a method could be useful anyway, because it provides copying and pickling of elements. And if R, S are parents and the generators of R are mapped to a list gens_images, then S.from_generator_data(R.from_generator_data(x), gens_images) should return the image of an element x of R under a morphism from R to S given by gens_images. Only problem: Someone needs to implement it. There could be general implementations on the category level, though. Efficiency is a different question... Best regards, Simon -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To post to this group, send email to sage-devel@googlegroups.com. To unsubscribe from this group, send email to sage-devel+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel?hl=en.