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