MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / l2_squared

Function l2_squared

nodedb-vector/src/distance/simd/avx2.rs:7–11  ·  view source on GitHub ↗
(a: &[f32], b: &[f32])

Source from the content-addressed store, hash-verified

5#![cfg(target_arch = "x86_64")]
6
7pub fn l2_squared(a: &[f32], b: &[f32]) -> f32 {
8 assert_eq!(a.len(), b.len(), "avx2 l2: length mismatch");
9 // SAFETY: caller verified avx2+fma via is_x86_feature_detected.
10 unsafe { l2_squared_impl(a, b) }
11}
12
13#[target_feature(enable = "avx2,fma")]
14unsafe fn l2_squared_impl(a: &[f32], b: &[f32]) -> f32 {

Callers 9

ground_truthFunction · 0.50
rerankFunction · 0.50
scalar_distanceFunction · 0.50
search_recall_at_10Function · 0.50

Calls 1

l2_squared_implFunction · 0.85

Tested by 2

search_recall_at_10Function · 0.40