Skip to main content

VectorDistance

Trait VectorDistance 

Source
pub trait VectorDistance {
    // Required method
    fn cosine_similarity(&self, other: &Self, normalize: bool) -> f32;
}
Expand description

Basic vector distance helpers.

Required Methods§

Source

fn cosine_similarity(&self, other: &Self, normalize: bool) -> f32

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl VectorDistance for Vec<f32>

Source§

fn cosine_similarity(&self, other: &Self, normalize: bool) -> f32

Source§

impl VectorDistance for [f32]

Source§

fn cosine_similarity(&self, other: &Self, normalize: bool) -> f32

Implementors§