[Numpy-discussion] Kronecker product

Paul F. Dubois paul at pfdubois.com
Wed Jul 18 10:40:41 EDT 2001


Using the outer product you get a matrix that has the right size and
contents but it is m*n by p*q
Was that a misprint in your post?
>>> x
array([1, 2, 3, 4, 5, 6])
>>> x.shape=(3,2)
>>> y = 10*transpose(x)
>>> y
array([[10, 30, 50],
       [20, 40, 60]])
>>> z = outerproduct(x.flat, y.flat)
>>> z
array([[ 10,  30,  50,  20,  40,  60],
       [ 20,  60, 100,  40,  80, 120],
       [ 30,  90, 150,  60, 120, 180],
       [ 40, 120, 200,  80, 160, 240],
       [ 50, 150, 250, 100, 200, 300],
       [ 60, 180, 300, 120, 240, 360]])
>>>

-----Original Message-----
From: numpy-discussion-admin at lists.sourceforge.net
[mailto:numpy-discussion-admin at lists.sourceforge.net]On Behalf Of Nils
Wagner
Sent: Wednesday, July 18, 2001 4:10 AM
To: numpy-discussion at lists.sourceforge.net
Subject: [Numpy-discussion] Kronecker product


Hi,

I would appreciate it, if Numpy could handle the Kronecker-product of
two matrices X, Y.

kron(X,Y) is the Kronecker tensor product of X and Y.
The result is a large matrix formed by taking all possible products
between the elements of X and those of Y. If X is m-by-n
and Y is p-by-q, then kron(X,Y) is m*p-by-n*q.

Nils



_______________________________________________
Numpy-discussion mailing list
Numpy-discussion at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/numpy-discussion





More information about the NumPy-Discussion mailing list