9951 explained code solutions for 126 technologies


python-numpyGet dot product of arrays/matrices


import numpy as np 

a = np.array([[1,2],[3,4]]) 
b = np.array([[5,6],[7,8]]) 

prod = np.dot(a,b)ctrl + c
import numpy as np

load Numpy module for Python

np.array

declare Numpy array

.dot(

returns dot product of specified arrays

prod

will contain resulting array/matrices