use na::{Scalar, Real, DefaultAllocator}; use traits::{Alloc, Dimension, Number}; use aliases::{TMat, TVec}; /// The determinant of the matrix `m`. pub fn determinant(m: &TMat) -> N where DefaultAllocator: Alloc { m.determinant() } /// The inverse of the matrix `m`. pub fn inverse(m: &TMat) -> TMat where DefaultAllocator: Alloc { m.clone().try_inverse().unwrap_or(TMat::::zeros()) } /// Component-wise multiplication of two matrices. pub fn matrix_comp_mult(x: &TMat, y: &TMat) -> TMat where DefaultAllocator: Alloc { 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 where DefaultAllocator: Alloc { c * r.transpose() } /// The transpose of the matrix `m`. pub fn transpose(x: &TMat) -> TMat where DefaultAllocator: Alloc { x.transpose() }