Python| numpy matrix.getI()
在Numpy matrix.getI()
方法的帮助下,我们可以获得与给定矩阵相同大小的乘法逆。
Syntax : matrix.getI()
Return : Return multiplicative inverse of given matrix
示例 #1:
在这个例子中,我们可以看到我们能够在方法matrix.getI()
的帮助下得到乘法逆。
# import the important module in python
import numpy as np
# make matrix with numpy
gfg = np.matrix('[6, 1; 2, 3]')
# applying matrix.getI() method
geeks = gfg.getI()
print(geeks)
输出:
[[ 0.1875 -0.0625]
[-0.125 0.375 ]]
示例 #2:
# import the important module in python
import numpy as np
# make a matrix with numpy
gfg = np.matrix('[1, 2, 3; 4, 5, 6; 7, 8, 9]')
# applying matrix.getI() method
geeks = gfg.getI()
print(geeks)
输出:
[[ -4.50359963e+15 9.00719925e+15 -4.50359963e+15]
[ 9.00719925e+15 -1.80143985e+16 9.00719925e+15]
[ -4.50359963e+15 9.00719925e+15 -4.50359963e+15]]