VectorDistance

Trait VectorDistance 

Source
pub trait VectorDistance {
    // Required methods
    fn dot_product(&self, other: &Self) -> f64;
    fn cosine_similarity(&self, other: &Self, normalized: bool) -> f64;
    fn angular_distance(&self, other: &Self, normalized: bool) -> f64;
    fn euclidean_distance(&self, other: &Self) -> f64;
    fn manhattan_distance(&self, other: &Self) -> f64;
    fn chebyshev_distance(&self, other: &Self) -> f64;
}

Required Methods§

Source

fn dot_product(&self, other: &Self) -> f64

Get dot product of two embedding vectors

Source

fn cosine_similarity(&self, other: &Self, normalized: bool) -> f64

Get cosine similarity of two embedding vectors. If normalized is true, the dot product is returned.

Source

fn angular_distance(&self, other: &Self, normalized: bool) -> f64

Get angular distance of two embedding vectors.

Source

fn euclidean_distance(&self, other: &Self) -> f64

Get euclidean distance of two embedding vectors.

Source

fn manhattan_distance(&self, other: &Self) -> f64

Get manhattan distance of two embedding vectors.

Source

fn chebyshev_distance(&self, other: &Self) -> f64

Get chebyshev distance of two embedding vectors.

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.

Implementors§

Source§

impl VectorDistance for Embedding

Available on crate feature rayon only.