On Feb 9, 2008 4:23 PM, Simon King <[EMAIL PROTECTED]> wrote: > > Dear Sage team, > > in the thread > http://groups.google.com/group/sage-support/browse_thread/thread/6c0b377a37ee32ec/a2e56d5696b8198e?hl=en#a2e56d5696b8198e > i was asking if there is a tensor product for homomorphisms between > free modules over polynomial rings. > > There isn't, and William suggested to implement it myself and send a > patch to him resp. to here. Well, it isn't a patch, but at least it > isn't long... > > I guess the change concerns the class FreeModuleMorphism, and one just > has to > add a method, say, "otimes". The tensor product can be easily formed > using block_matrix: > > {{{ > def otimes(self,g): > "f.otimes(g): return the tensor product of two free module > morphisms" > # or find a better doc string > if not isinstance(g, > sage.modules.free_module_morphism.FreeModuleMorphism): > raise NotImplementedError, "second argument must be a free > module morphism" > if not (self.base_ring()==g.base_ring()): > raise ArithmeticError, "base rings must coincide" > Dom = > self.base_ring()**(self.domain().dimension()*g.domain().dimension()) > Cod = > self.base_ring()**(self.codomain().dimension()*g.codomain().dimension()) > M = sage.matrix.constructor.block_matrix([x*g.matrix() for x in > self.matrix().list()],self.matrix().nrows(),self.matrix().ncols()) > return > sage.modules.free_module_morphism.FreeModuleMorphism(Dom.Hom(Cod),M) > }}} > Disadvantages: > - This only works for homomorphisms between free modules, since domain > and codomain of the output are free by construction (i don't know how > to form the tensor product of non-free modules). > - Domain and codomain of the output are just free modules. They > provide no information about how they and their bases (important for > computations!) are related with the (co)domains of the two input > homomorphisms. >
(1) I think an analogue of the method "otimes" that you propose above should definitely be a method of matrices called "tensor_product" and it should be in the file matrix/matrix2.pyx. Then the above method should *maybe* be defined and be called say "_tensor_product" (note the underscore). (2) Then we need to create a genuine TensorProduct class, etc., etc., That class will call _tensor_product, perhaps. Maybe you could submit a patch that does (1)? -- william --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---