Trait vectors::Distance
[−]
[src]
pub trait Distance: Sized { type Scalar; fn squared_distance(&self, rhs: &Self) -> Self::Scalar; fn distance(&self, rhs: &Self) -> Self::Scalar
where
Self::Scalar: Real, { ... } }
The trait for types supporting the calculation of distance
Associated Types
type Scalar
The scalar type returned by self
's distance
Required Methods
fn squared_distance(&self, rhs: &Self) -> Self::Scalar
Calculates the squared euclidian distance between self
and rhs
.
Provided Methods
fn distance(&self, rhs: &Self) -> Self::Scalar where
Self::Scalar: Real,
Self::Scalar: Real,
Calculates the euclidian distance between self
and rhs
.
Implementors
impl<T, A> Distance for vectors::dense::stack::DenseVector<A> where
T: Copy + Signed,
A: Array<Item = T>, type Scalar = T;impl<T> Distance for vectors::dense::heap::DenseVector<T> where
T: Copy + Signed, type Scalar = T;impl<T, A> Distance for vectors::sparse::stack::SparseVector<A> where
T: Copy + Signed,
A: Array<Item = (usize, T)>, type Scalar = T;impl<T> Distance for vectors::sparse::heap::SparseVector<T> where
T: Copy + Signed, type Scalar = T;