normalize_batch_parallel

Function normalize_batch_parallel 

Source
pub fn normalize_batch_parallel(data: &mut [f32], dim: usize) -> Vec<f32>
Expand description

Parallel batch L2 normalization using SIMD and multi-threading.

This is the high-performance version for processing thousands of vectors. Uses rayon for parallelism and SIMD for per-vector operations.

§Arguments

  • data - Flat array of vectors stored contiguously
  • dim - Dimension of each vector

§Returns

Vector of original norms for each vector.

§Performance

  • Uses rayon for parallel processing across CPU cores
  • Uses SIMD (AVX2 on x86_64) for individual vector operations
  • Optimal for batches of 1000+ vectors