[ Web Proxy ]
URL:
Viewing: https://numpy.org/doc/stable/reference/generated/../random/../generated/numpy.matrix.I.html [Back]  [Original]

numpy.matrix.I — NumPy v2.5 Manual
Back to top
Search the docs ...:

numpy.matrix.I#

property

property matrix.I#

Returns the (multiplicative) inverse of invertible self.

Parameters:
None
Returns:
retmatrix object

If self is non-singular, ret is such that ret * self == self * ret == np.matrix(np.eye(self[0,:].size)) all return True.

Raises:
numpy.linalg.LinAlgError: Singular matrix

If self is singular.

See also

linalg.inv

Examples

Try it in your browser!
>>> m = np.matrix('[1, 2; 3, 4]'); m
matrix([[1, 2],
        [3, 4]])
>>> m.getI()
matrix([[-2. ,  1. ],
        [ 1.5, -0.5]])
>>> m.getI() * m
matrix([[ 1.,  0.], # may vary
        [ 0.,  1.]])

Web Proxy Viewer  |  New URL  |  Original Page