tensor product of matrices in Numpy/python

matrix, product

Solution

I believe what you're looking for is the Kronecker product

http://docs.scipy.org/doc/numpy/reference/generated/numpy.kron.html#numpy.kron

Example:

>>> np.kron(np.eye(2), np.ones((2,2)))
array([[ 1.,  1.,  0.,  0.],
       [ 1.,  1.,  0.,  0.],
       [ 0.,  0.,  1.,  1.],
       [ 0.,  0.,  1.,  1.]])

Problem

Is there a numpy function that does tensor product of two matrices ? That creates a 4x4 product matrix of two 2x2 matrices?

Original source