ashvardanian / SimSIMD

Up to 200x Faster Dot Products & Similarity Metrics — for Python, Rust, C, JS, and Swift, supporting f64, f32, f16 real & complex, i8, and bit vectors using SIMD for both AVX2, AVX-512, NEON, SVE, & SVE2 📐
https://ashvardanian.com/posts/simsimd-faster-scipy/
Apache License 2.0
988 stars 59 forks source link

Higher Precision Cosine Distance #156

Closed ashvardanian closed 2 months ago

ashvardanian commented 2 months ago

As mentioned by @cbornet in #153, the precision of some of the kernels may be lower than expected. It's mostly true for the cosine distance due to low-precision aggregations and, more importantly, due to rsqrt approximations.

This PR refactors a huge part of dot.h and spatial.h to introduce new helper functions for NEON, Haswell, and Skylake, to mitigate those issues.