bundles / numpy 2.4.3 / numpy / matrixlib / defmatrix / matrix / I
function
numpy.matrixlib.defmatrix:matrix.I
Signature
def I(self)Summary
Returns the (multiplicative) inverse of invertible self.
Parameters
None
Returns
ret: matrix objectIf
selfis non-singular, ret is such thatret * self==self * ret==np.matrix(np.eye(self[0,:].size))all returnTrue.
Raises
: numpy.linalg.LinAlgError: Singular matrixIf
selfis singular.
Examples
m = np.matrix('[1, 2; 3, 4]'); m m.getI()✓
matrix([[-2. , 1. ],
[ 1.5, -0.5]])
m.getI() * m
✗matrix([[1.0000e+00, 0.0000e+00],
[1.1102e-16, 1.0000e+00]])
See also
Aliases
numpy.matrix.getI