Python | Numpy matrix.dot ()



Using the Numpy matrix.dot () method, we can find the product of two given matrices and output them as a new dimensional matrix.

Syntax: matrix.dot()

Return: Return product of two matrix

Example # 1:
In this example, we see that using the matrix.dot method () we can find the product of two given matrices.

# import important module into python

import numpy as np

 
# make a matrix with NumPy

gfg1 = np.matrix ( `[6, 2, 3]` )

gfg2 = np.matrix ( `[4; five; 9] ` )

  
# using the matrix.dot () method

geeks = gfg1.dot (gfg2)

 

print (geeks)

Output:

 [[61]] 

Example # 2:

# import an important module into python

import numpy as np

 
# make a matrix with NumPy

gfg1 = np.matrix ( ` [1, 2, 3; 4, 5, 6; 7, 8, 9] ` )

gfg2 = np.matrix ( ` [1, 2, 3; 4, 5, 6; 7, 8, 9 ] ` )

  
# using the matrix.dot () method

geeks = gfg1.dot (gfg2)

 

print (geeks)

Exit :

 [[30 36 42] [66 81 96] [102 126 150]]