pub trait SimdOps {
// Required methods
fn add(a: &[Self], b: &[Self]) -> Vec<Self>
where Self: Sized;
fn sub(a: &[Self], b: &[Self]) -> Vec<Self>
where Self: Sized;
fn mul(a: &[Self], b: &[Self]) -> Vec<Self>
where Self: Sized;
fn dot(a: &[Self], b: &[Self]) -> Self
where Self: Sized;
fn cosine_distance(a: &[Self], b: &[Self]) -> Self
where Self: Sized;
fn euclidean_distance(a: &[Self], b: &[Self]) -> Self
where Self: Sized;
fn manhattan_distance(a: &[Self], b: &[Self]) -> Self
where Self: Sized;
fn norm(a: &[Self]) -> Self
where Self: Sized;
fn sum(a: &[Self]) -> Self
where Self: Sized;
fn mean(a: &[Self]) -> Self
where Self: Sized;
}Expand description
Unified SIMD operations trait
Required Methods§
Sourcefn cosine_distance(a: &[Self], b: &[Self]) -> Selfwhere
Self: Sized,
fn cosine_distance(a: &[Self], b: &[Self]) -> Selfwhere
Self: Sized,
Compute cosine distance (1 - cosine_similarity)
Sourcefn euclidean_distance(a: &[Self], b: &[Self]) -> Selfwhere
Self: Sized,
fn euclidean_distance(a: &[Self], b: &[Self]) -> Selfwhere
Self: Sized,
Compute Euclidean distance
Sourcefn manhattan_distance(a: &[Self], b: &[Self]) -> Selfwhere
Self: Sized,
fn manhattan_distance(a: &[Self], b: &[Self]) -> Selfwhere
Self: Sized,
Compute Manhattan distance
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl SimdOps for f32
SIMD implementation for f32
impl SimdOps for f32
SIMD implementation for f32
fn add(a: &[Self], b: &[Self]) -> Vec<Self>
fn sub(a: &[Self], b: &[Self]) -> Vec<Self>
fn mul(a: &[Self], b: &[Self]) -> Vec<Self>
fn dot(a: &[Self], b: &[Self]) -> Self
fn cosine_distance(a: &[Self], b: &[Self]) -> Self
fn euclidean_distance(a: &[Self], b: &[Self]) -> Self
fn manhattan_distance(a: &[Self], b: &[Self]) -> Self
fn norm(a: &[Self]) -> Self
fn sum(a: &[Self]) -> Self
fn mean(a: &[Self]) -> Self
Source§impl SimdOps for f64
SIMD implementation for f64
impl SimdOps for f64
SIMD implementation for f64