To find the matrix (dot) product of two arrays and a1, use the function a2np.dot(.
a1, a2)
>>> a1 = np.array([[1, 2, -4], [3, -1, 5]])
>>> a2 = np.array([[6, -3], [1, -2], [2, 4]])
>>> print a1
[[ 1 2 -4]
[ 3 -1 5]]
>>> print a2
[[ 6 -3]
[ 1 -2]
[ 2 4]]
>>> np.dot(a1, a2)
array([[ 0, -23],
[ 27, 13]])
Similarly, np.cross( returns the
cross-product of vectors x,
y) and x.
y
>>> x = (1, 2, 0) >>> y = (4, 5, 6) >>> print np.cross(x, y) [12 -6 -3]