use num::Num; use traits::{Alloc, Number}; use na::{Scalar, Real, DimName, DefaultAllocator, U1}; use na::allocator::Allocator; use aliases::{Mat, Vec}; //pub fn determinant(m: &Mat) -> N // where DefaultAllocator: Allocator { // m.determinant() //} pub fn inverse(m: &Mat) -> Mat where DefaultAllocator: Alloc { m.clone().try_inverse().unwrap_or(Mat::::zeros()) } pub fn matrix_comp_mult(x: &Mat, y: &Mat) -> Mat where DefaultAllocator: Alloc { x.component_mul(y) } pub fn outer_product(c: &Vec, r: &Vec) -> Mat where DefaultAllocator: Alloc { c * r.transpose() } pub fn transpose(x: &Mat) -> Mat where DefaultAllocator: Alloc { x.transpose() }