DistanceFunction

Trait DistanceFunction 

Source
pub trait DistanceFunction<T, const LANES: usize>: Send + Sync {
    // Required method
    fn distance(&self, a: &[T], b: &[T]) -> T;
}
Expand description

A trait representing a customizable distance function for k-means clustering.

This trait allows you to define your own distance metric to be used in the k-means clustering algorithm.

§Generics

  • T: The data type of the elements in the slices. This type must support arithmetic operations
  • LANES: SIMD lane size as requested by the API user

Required Methods§

Source

fn distance(&self, a: &[T], b: &[T]) -> T

Implementors§

Source§

impl<T, const LANES: usize> DistanceFunction<T, LANES> for EuclideanDistance
where T: Primitive, LaneCount<LANES>: SupportedLaneCount, Simd<T, LANES>: SupportedSimdArray<T, LANES>,

Source§

impl<T, const LANES: usize> DistanceFunction<T, LANES> for HistogramDistance
where T: Primitive, LaneCount<LANES>: SupportedLaneCount, Simd<T, LANES>: SupportedSimdArray<T, LANES>,