[][src]Trait acap::distance::Metric

pub trait Metric<T: ?Sized = Self>: Proximity<T> { }

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

impl<'k, 'v, K: Metric<V>, V> Metric<&'v V> for &'k K[src]

Blanket Metric implementation for references.

Loading content...

Implementors

impl<T> Metric<Angular<T>> for Angular<T> where
    T: Coordinates,
    T::Value: Real,
    AngularDistance<T::Value>: Distance
[src]

Angular distance is a metric.

impl<T> Metric<Angular<T>> for T where
    T: Coordinates,
    T::Value: Real,
    AngularDistance<T::Value>: Distance
[src]

Angular distance is a metric.

impl<T> Metric<PrenormAngular<T>> for PrenormAngular<T> where
    T: Coordinates,
    T::Value: Real,
    AngularDistance<T::Value>: Distance
[src]

Angular distance is a metric.

impl<T> Metric<PrenormAngular<T>> for T where
    T: Coordinates,
    T::Value: Real,
    AngularDistance<T::Value>: Distance
[src]

Angular distance is a metric.

impl<T> Metric<Euclidean<T>> for Euclidean<T> where
    T: Coordinates,
    EuclideanDistance<T::Value>: Distance
[src]

Euclidean distance is a metric.

impl<T> Metric<Euclidean<T>> for T where
    T: Coordinates,
    EuclideanDistance<T::Value>: Distance
[src]

impl<T> Metric<T> for Angular<T> where
    T: Coordinates,
    T::Value: Real,
    AngularDistance<T::Value>: Distance
[src]

Angular distance is a metric.

impl<T> Metric<T> for PrenormAngular<T> where
    T: Coordinates,
    T::Value: Real,
    AngularDistance<T::Value>: Distance
[src]

Angular distance is a metric.

impl<T> Metric<T> for Euclidean<T> where
    T: Coordinates,
    EuclideanDistance<T::Value>: Distance
[src]

impl<T: Coordinates> Metric<Chebyshev<T>> for Chebyshev<T>[src]

Chebyshev distance is a metric.

impl<T: Coordinates> Metric<Chebyshev<T>> for T[src]

impl<T: Coordinates> Metric<Taxicab<T>> for Taxicab<T>[src]

Taxicab distance is a metric.

impl<T: Coordinates> Metric<Taxicab<T>> for T[src]

impl<T: Coordinates> Metric<T> for Chebyshev<T>[src]

impl<T: Coordinates> Metric<T> for Taxicab<T>[src]

impl<T: PrimInt> Metric<Hamming<T>> for Hamming<T>[src]

Hamming distance is a metric.

impl<T: PrimInt> Metric<T> for Hamming<T>[src]

impl<T: PrimInt> Metric<Hamming<T>> for T[src]

Loading content...