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§
Sourcefn dot_product(&self, other: &Self) -> f64
fn dot_product(&self, other: &Self) -> f64
Get dot product of two embedding vectors
Sourcefn cosine_similarity(&self, other: &Self, normalized: bool) -> f64
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.
Sourcefn angular_distance(&self, other: &Self, normalized: bool) -> f64
fn angular_distance(&self, other: &Self, normalized: bool) -> f64
Get angular distance of two embedding vectors.
Sourcefn euclidean_distance(&self, other: &Self) -> f64
fn euclidean_distance(&self, other: &Self) -> f64
Get euclidean distance of two embedding vectors.
Sourcefn manhattan_distance(&self, other: &Self) -> f64
fn manhattan_distance(&self, other: &Self) -> f64
Get manhattan distance of two embedding vectors.
Sourcefn chebyshev_distance(&self, other: &Self) -> f64
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§
impl VectorDistance for Embedding
Available on crate feature
rayon only.