iris-cv 0.0.0

A fast computer vision library framework in Rust.
Documentation
/// Stubs and helpers for low-level CPU vector instructions (AVX2, Neon) for custom manual loops.
pub struct SimdHelper;

impl SimdHelper {
    /// Vectorized sum of two floating point slices.
    pub fn vector_add(a: &[f32], b: &[f32], out: &mut [f32]) {
        assert_eq!(a.len(), b.len());
        assert_eq!(a.len(), out.len());

        // Simple autovectorizable compiler optimization loop
        for i in 0..a.len() {
            out[i] = a[i] + b[i];
        }
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_simd_helper() {
        let a = vec![1.0f32, 2.0, 3.0];
        let b = vec![4.0f32, 5.0, 6.0];
        let mut out = vec![0.0f32; 3];
        SimdHelper::vector_add(&a, &b, &mut out);
        assert_eq!(out, vec![5.0f32, 7.0, 9.0]);
    }
}