pub struct BatchSimdOps;Expand description
Batch SIMD operations for processing multiple vectors at once
Production optimizations:
- Cache-aware processing for large batches
- Memory-aligned operations for optimal SIMD performance
- Parallel processing with work-stealing for large datasets
- Branch-prediction friendly algorithms
- Memory bandwidth optimization
Implementations§
Source§impl BatchSimdOps
impl BatchSimdOps
Sourcepub fn pairwise_cosine_similarities(vectors: &[Array1<f32>]) -> Vec<Vec<f32>>
pub fn pairwise_cosine_similarities(vectors: &[Array1<f32>]) -> Vec<Vec<f32>>
Compute pairwise cosine similarities between all vectors in a batch
Sourcepub fn find_k_most_similar(
query: &Array1<f32>,
vectors: &[Array1<f32>],
k: usize,
) -> Vec<(usize, f32)>
pub fn find_k_most_similar( query: &Array1<f32>, vectors: &[Array1<f32>], k: usize, ) -> Vec<(usize, f32)>
Find the k most similar vectors to a query vector
Sourcepub fn compute_centroid(vectors: &[Array1<f32>]) -> Array1<f32>
pub fn compute_centroid(vectors: &[Array1<f32>]) -> Array1<f32>
Compute centroid of a batch of vectors
Sourcepub fn fast_cosine_similarity_with_norms(
a: &Array1<f32>,
b: &Array1<f32>,
norm_a: f32,
norm_b: f32,
) -> f32
pub fn fast_cosine_similarity_with_norms( a: &Array1<f32>, b: &Array1<f32>, norm_a: f32, norm_b: f32, ) -> f32
Fast cosine similarity with pre-computed norms (production optimization)
Sourcepub fn cache_optimized_batch_similarities(
query: &Array1<f32>,
vectors: &[Array1<f32>],
batch_size: usize,
) -> Vec<f32>
pub fn cache_optimized_batch_similarities( query: &Array1<f32>, vectors: &[Array1<f32>], batch_size: usize, ) -> Vec<f32>
Cache-optimized batch similarity calculation for large datasets
Sourcepub fn aligned_dot_product(a: &Array1<f32>, b: &Array1<f32>) -> f32
pub fn aligned_dot_product(a: &Array1<f32>, b: &Array1<f32>) -> f32
Memory-aligned vector operations for optimal SIMD performance
Sourcepub fn batch_normalize(vectors: &mut [Array1<f32>])
pub fn batch_normalize(vectors: &mut [Array1<f32>])
High-performance batch normalization
Auto Trait Implementations§
impl Freeze for BatchSimdOps
impl RefUnwindSafe for BatchSimdOps
impl Send for BatchSimdOps
impl Sync for BatchSimdOps
impl Unpin for BatchSimdOps
impl UnwindSafe for BatchSimdOps
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more