multiply array and create matrix python code example
Example 1: python numpy multiply matrices
a = np.array([[-6, 1], [1, 1]])
b = np.array([[0], [8]])
c = a.dot(b) # multiply matrice a and b
Example 2: how to multiply matrices in python
>>> a = np.ones([9, 5, 7, 4])
>>> c = np.ones([9, 5, 4, 3])
>>> np.dot(a, c).shape
(9, 5, 7, 9, 5, 3)
>>> np.matmul(a, c).shape
(9, 5, 7, 3)
>>> # n is 7, k is 4, m is 3