Python Numpy matrix.dot()
在Numpy matrix.dot()方法的帮助下,我们能够找到两个给定矩阵的乘积,并给出新维矩阵的输出。
语法: matrix.dot()
返回:返回两个矩阵的乘积
例子#1 :
在这个例子中,我们可以看到,在matrix.dot()方法的帮助下,我们能够找到两个给定矩阵的乘积。
# import the important module in python
import numpy as np
# make matrix with numpy
gfg1 = np.matrix('[6, 2, 3]')
gfg2 = np.matrix('[4; 5; 9]')
# applying matrix.dot() method
geeks = gfg1.dot(gfg2)
print(geeks)
输出:
[[61]]
例子#2 :
# import the important module in 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]')
# applying matrix.dot() method
geeks = gfg1.dot(gfg2)
print(geeks)
输出:
[[ 30 36 42]
[ 66 81 96]
[102 126 150]]