use na::{Const, DimMin, RealField, Scalar}; use crate::aliases::{TMat, TVec}; use crate::traits::Number; /// The determinant of the matrix `m`. pub fn determinant(m: &TMat) -> T where Const: DimMin, Output = Const>, { m.determinant() } /// The inverse of the matrix `m`. pub fn inverse(m: &TMat) -> TMat { m.clone() .try_inverse() .unwrap_or_else(TMat::::zeros) } /// Component-wise multiplication of two matrices. pub fn matrix_comp_mult( x: &TMat, y: &TMat, ) -> TMat { x.component_mul(y) } /// Treats the first parameter `c` as a column vector and the second parameter `r` as a row vector and does a linear algebraic matrix multiply `c * r`. pub fn outer_product( c: &TVec, r: &TVec, ) -> TMat { c * r.transpose() } /// The transpose of the matrix `m`. pub fn transpose(x: &TMat) -> TMat { x.transpose() }