pub trait MInv: SquareMatrixwhere
Self::Output: SquareMatrix,{
type Output;
// Required method
fn inv(&self) -> Option<Self::Output>;
}
Required Associated Types§
Required Methods§
Sourcefn inv(&self) -> Option<Self::Output>
fn inv(&self) -> Option<Self::Output>
Returns the inverted matrix if the matrix is non-singular
A⁻¹
§Examples
// Returns none if matrix is singular
let a = [
[1.0, 2.0],
[2.0, 4.0]
];
assert_eq!(a.inv(), None);
// Otherwise equals adjunct matrix divided by determinant
let a = [
[1.0, 2.0],
[3.0, 4.0]
];
let ai = a.adj().dot(a.det().recip());
assert_eq!(a.inv(), Some(ai));
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.