inv¶
- inv(x: array, /) array ¶
Returns the multiplicative inverse of a square matrix (or a stack of square matrices)
x
.If
x
is real-valued, let \(\mathbb{K}\) be the set of real numbers \(\mathbb{R}\), and, ifx
is complex-valued, let \(\mathbb{K}\) be the set of complex numbers \(\mathbb{C}\).The inverse matrix \(x^{-1} \in\ \mathbb{K}^{n \times n}\) of a square matrix \(x \in\ \mathbb{K}^{n \times n}\) is defined as
\[x^{-1}x = xx^{-1} = I_n\]where \(I_n\) is the n-dimensional identity matrix.
The inverse matrix exists if and only if
x
is invertible. Whenx
is invertible, the inverse is unique.When
x
is a stack of matrices, the function must compute the inverse for each matrix in the stack.- Parameters:
x (array) – input array having shape
(..., M, M)
and whose innermost two dimensions form square matrices. Should have a floating-point data type.- Returns:
out (array) – an array containing the multiplicative inverses. The returned array must have a floating-point data type determined by Type Promotion Rules and must have the same shape as
x
.
Notes
Changed in version 2022.12: Added complex data type support.