pub struct Distance<T, U>where
T: 'static,
U: 'static,{ /* private fields */ }Expand description
A function pointer-like type for computing distances between &[T] and &[U].
See: DistanceProvider.
Implementations§
Source§impl<T, U> Distance<T, U>where
T: 'static,
U: 'static,
impl<T, U> Distance<T, U>where
T: 'static,
U: 'static,
Sourcepub fn call(&self, x: &[T], y: &[U]) -> f32
pub fn call(&self, x: &[T], y: &[U]) -> f32
Compute the distance between x and y.
The actual distance computed depends on the metric supplied to DistanceProvider.
Additionally, if a dimension were given to DistanceProvider, this function may
panic if provided with slices with a length not equal to this dimension.
Sourcepub fn call_unaligned(
&self,
x: UnalignedSlice<'_, T>,
y: UnalignedSlice<'_, U>,
) -> f32
pub fn call_unaligned( &self, x: UnalignedSlice<'_, T>, y: UnalignedSlice<'_, U>, ) -> f32
Compute the distance between x and y.
The actual distance computed depends on the metric supplied to DistanceProvider.
Additionally, if a dimension were given to DistanceProvider, this function may
panic if provided with slices with a length not equal to this dimension.
Trait Implementations§
impl<T, U> Copy for Distance<T, U>where
T: 'static,
U: 'static,
Source§impl<T, U> DistanceFunction<UnalignedSlice<'_, T>, UnalignedSlice<'_, U>> for Distance<T, U>where
T: 'static,
U: 'static,
impl<T, U> DistanceFunction<UnalignedSlice<'_, T>, UnalignedSlice<'_, U>> for Distance<T, U>where
T: 'static,
U: 'static,
Source§fn evaluate_similarity(
&self,
x: UnalignedSlice<'_, T>,
y: UnalignedSlice<'_, U>,
) -> f32
fn evaluate_similarity( &self, x: UnalignedSlice<'_, T>, y: UnalignedSlice<'_, U>, ) -> f32
Perform a distance computation between the left-hand and right-hand arguments.
Auto Trait Implementations§
impl<T, U> Freeze for Distance<T, U>
impl<T, U> RefUnwindSafe for Distance<T, U>
impl<T, U> Send for Distance<T, U>
impl<T, U> Sync for Distance<T, U>
impl<T, U> Unpin for Distance<T, U>
impl<T, U> UnsafeUnpin for Distance<T, U>
impl<T, U> UnwindSafe for Distance<T, U>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more