Try this:
a = np.matrix([[1,2], [3,4]])
b = np.matrix([[5,6], [7,8]])
#This would result a 'numpy.ndarray'
result = np.array(a) * np.array(b)
Here, np.array(a)
returns a 2D array of type ndarray
and multiplication of two ndarray
would result element wise multiplication. So the result would be:
result = [[5, 12], [21, 32]]
If you wanna get a matrix, the do it with this:
result = np.mat(result)