Module simd_euclidean

Source
Expand description
for &i in [16, 32, 64, 128].into_iter() {
  // Dispatch to F32x4 or F32x8 (above 64 elements)
    let mut rng = rand::thread_rng();
    let a = (0..i).map(|_| rng.gen::<f32>()).collect::<Vec<f32>>();
    let b = (0..i).map(|_| rng.gen::<f32>()).collect::<Vec<f32>>();
    let v = Vectorized::distance(&a, &b);
    let n = Naive::distance(&a, &b);
    assert!((n-v).abs() < 0.00001);
}

Structs§

F32x4
F32x8
F64x2
F64x4

Traits§

Naive
Vectorized

Functions§

scalar_euclidean
Calculate the euclidean distance between two slices of equal length
vector_euclidean
SIMD-capable calculation of the euclidean distance between two slices of equal length