Skip to main content

DistanceFunction

Trait DistanceFunction 

Source
pub trait DistanceFunction<Left, Right, To = f32> {
    // Required method
    fn evaluate_similarity(&self, x: Left, y: Right) -> To;
}
Expand description

An overloadable, 2-argument distance function with a parameterized return type.

Unlike PureDistanceFunction, this takes a functor as the receiver. This allows distance functors to contain auxiliary state required to do their job (for example, access to some shared quantization tables).

Required Methods§

Source

fn evaluate_similarity(&self, x: Left, y: Right) -> To

Perform a distance computation between the left-hand and right-hand arguments.

Implementors§

Source§

impl<T, U> DistanceFunction<&[T], &[U]> for Distance<T, U>
where T: 'static, U: 'static,