pub struct L2Dist;
Expand description
L2 or Euclidean distance
Trait Implementations
sourceimpl<F: Float> Distance<F> for L2Dist
impl<F: Float> Distance<F> for L2Dist
sourcefn distance<D: Dimension>(
&self,
a: ArrayView<'_, F, D>,
b: ArrayView<'_, F, D>
) -> F
fn distance<D: Dimension>(
&self,
a: ArrayView<'_, F, D>,
b: ArrayView<'_, F, D>
) -> F
Computes the distance between two points. For most spatial algorithms to work correctly, this metric must satisfy the Triangle Inequality. Read more
sourcefn rdistance<D: Dimension>(
&self,
a: ArrayView<'_, F, D>,
b: ArrayView<'_, F, D>
) -> F
fn rdistance<D: Dimension>(
&self,
a: ArrayView<'_, F, D>,
b: ArrayView<'_, F, D>
) -> F
A faster version of the distance metric that keeps the order of the distance function. That
is, dist(a, b) > dist(c, d)
implies rdist(a, b) > rdist(c, d)
. For most algorithms this
is the same as distance
. Unlike distance
, this function does not need to satisfy
the Triangle Inequality. Read more
sourcefn rdist_to_dist(&self, rdist: F) -> F
fn rdist_to_dist(&self, rdist: F) -> F
Converts the result of rdistance
to distance
sourcefn dist_to_rdist(&self, dist: F) -> F
fn dist_to_rdist(&self, dist: F) -> F
Converts the result of distance
to rdistance
impl StructuralPartialEq for L2Dist
Auto Trait Implementations
impl RefUnwindSafe for L2Dist
impl Send for L2Dist
impl Sync for L2Dist
impl Unpin for L2Dist
impl UnwindSafe for L2Dist
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more