use na::{Real, DefaultAllocator}; use traits::{Alloc, Dimension}; use aliases::Vec; pub fn distance2(p0: &Vec, p1: &Vec) -> N where DefaultAllocator: Alloc { (p1 - p0).norm_squared() } pub fn l1_distance(x: &Vec, y: &Vec) -> N where DefaultAllocator: Alloc { l1_norm(&(x - y)) } pub fn l1_norm(v: &Vec) -> N where DefaultAllocator: Alloc { ::comp_add(&v.abs()) } pub fn l2_distance(x: &Vec, y: &Vec) -> N where DefaultAllocator: Alloc { l2_norm(&(y - x)) } pub fn l2_norm(x: &Vec) -> N where DefaultAllocator: Alloc { x.norm() } pub fn length2(x: &Vec) -> N where DefaultAllocator: Alloc { x.norm_squared() } //pub fn lxNorm(x: &Vec, y: &Vec, unsigned int Depth) -> N // where DefaultAllocator: Alloc { // unimplemented!() //} // //pub fn lxNorm(x: &Vec, unsigned int Depth) -> N // where DefaultAllocator: Alloc { // unimplemented!() //}