Trait acap::distance::Metric [−][src]
Expand description
Marker trait for metric spaces.
A metric must be symmetric and obey the triangle inequality. More precisely, let $x$
,
$y$
, and $z$
be any elements of a metric space, and let
$d(x, y) = x.\mathrm{distance}(y).\mathrm{value}()$
. Then the following rules must hold:
\begin{aligned}
d(x, x) &= 0 \\
d(x, y) &= d(y, x) & \text{(symmetry)} \\
d(x, z) &\le d(x, y) + d(y, z) & \text{(triangle inequality)}
\end{aligned}
Those conditions also imply the following condition:
\begin{aligned}
d(x, y) &\ge \rlap{0}\phantom{d(x, y) + d(y, z)} & \text{\phantom{(triangle inequality)}\llap{(non-negativity)}}
\end{aligned}
Because we do not prohibit $d(x, y) = 0$
for distinct $x$
and $y$
, these spaces are more
properly known as pseudometric spaces. This distinction is usually unimportant.
Implementations on Foreign Types
Blanket Metric
implementation for references.
Implementors
impl<T> Metric<Angular<T>> for Angular<T> where
T: Coordinates,
T::Value: Real,
AngularDistance<T::Value>: Distance,
Angular distance is a metric.
impl<T> Metric<Angular<T>> for T where
T: Coordinates,
T::Value: Real,
AngularDistance<T::Value>: Distance,
Angular distance is a metric.
impl<T> Metric<PrenormAngular<T>> for PrenormAngular<T> where
T: Coordinates,
T::Value: Real,
AngularDistance<T::Value>: Distance,
Angular distance is a metric.
impl<T> Metric<PrenormAngular<T>> for T where
T: Coordinates,
T::Value: Real,
AngularDistance<T::Value>: Distance,
Angular distance is a metric.
impl<T> Metric<Euclidean<T>> for Euclidean<T> where
T: Coordinates,
EuclideanDistance<T::Value>: Distance,
Euclidean distance is a metric.
impl<T> Metric<Euclidean<T>> for T where
T: Coordinates,
EuclideanDistance<T::Value>: Distance,
impl<T> Metric<T> for Angular<T> where
T: Coordinates,
T::Value: Real,
AngularDistance<T::Value>: Distance,
Angular distance is a metric.
impl<T> Metric<T> for PrenormAngular<T> where
T: Coordinates,
T::Value: Real,
AngularDistance<T::Value>: Distance,
Angular distance is a metric.
impl<T> Metric<T> for Euclidean<T> where
T: Coordinates,
EuclideanDistance<T::Value>: Distance,
Chebyshev distance is a metric.
Taxicab distance is a metric.
Hamming distance is a metric.