![]() |
VOOZH | about |
In this article, we will discuss how to do matrix-vector multiplication in NumPy.
For a matrix-vector multiplication, there are certain important points:
# a and b are matrices prod = numpy.matmul(a,b)
For matrix-vector multiplication, we will use np.matmul() function of NumPy, we will define a 4 x 4 matrix and a vector of length 4.
Output:
👁 ImageWe use the dot product to do matrix-matrix multiplication. We will use the same function for this also.
prod = numpy.matmul(a,b) # a and b are matrices
For a matrix-matrix multiplication, there are certain important points:
We will define two 3 x 3 matrix: