In this chapter, we will discuss about NumPy-dot. This function returns the dot product of two arrays. For 2-D vectors, it is the equivalent to matrix multiplication. For 1-D arrays, it is the inner product of the vectors. For N-dimensional arrays, it is a sum product over the last axis of a and the second-last axis of b.
import numpy.matlib import numpy as np a = np.array([[1,2],[3,4]]) b = np.array([[11,12],[13,14]]) np.dot(a,b)
It will produce the following output −
[[37 40] [85 92]]
Note that the calculated as −
[[1*11+2*13, 1*12+2*14],[3*11+4*13, 3*12+4*14]]
Next Topic – Click Here
Pingback: NumPy - Linear Algebra - Adglob Infosystem Pvt Ltd
This is one awesome blog.Really thank you! Want more.