Compute the inverse of a matrix.
Parameters: | a : array_like, shape (M, M)
|
---|---|
Returns: | ainv : ndarray, shape (M, M)
|
Raises: | LinAlgError :
|
Examples
>>> a = np.array([[1., 2.], [3., 4.]])
>>> np.linalg.inv(a)
array([[-2. , 1. ],
[ 1.5, -0.5]])
>>> np.dot(a, np.linalg.inv(a))
array([[ 1., 0.],
[ 0., 1.]])