This would surely be easy to implement for vectors: if v and w have respective entries v[i] for i in range(m), and w[j] for j in range(n) then v.tensor_product(w) would have m*n entries v[i]*w[j] index by k in range(m*n) where k=n*i+j. The only issue is whether i moves faster than j instead (k=i+m*j I think), which probably corresponds to whether you think of them as rows or columns.
John 2008/4/23 Robert Miller <[EMAIL PROTECTED]>: > > You can do so with matrices (so think of vectors as 1xn or nx1 > matrices...): > > sage: M = matrix(ZZ, [[1,0],[0,1]]) > sage: N = matrix(ZZ, [[1,2],[3,4]]) > sage: M.tensor_product(N) > > [1 2|0 0] > [3 4|0 0] > [---+---] > [0 0|1 2] > [0 0|3 4] > > > > > On Apr 23, 11:14 am, vivek <[EMAIL PROTECTED]> wrote: > > Hi > > > > I was going through a book(on quantum computation) , which uses tensor > > products. I wanted to experiment with these tensor products. Is there > > any function like tensor_product(), which will take 2 or more vectors > > as input and return their tensor product? > > > > I tried to search but I couldn't find any. > > > > Sincerely > > thanking you > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@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-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---