Skip to content

Commit 9ab541e

Browse files
committed
add a comment explaining the relevancy issue we may encounter
1 parent ae65345 commit 9ab541e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Diff for: src/distance/binary_quantized_euclidean.rs

+2
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,7 @@ impl Distance for BinaryQuantizedEuclidean {
7575
}
7676

7777
fn dot_product(u: &UnalignedVector<BinaryQuantized>, v: &UnalignedVector<BinaryQuantized>) -> f32 {
78+
// /!\ If the number of dimensions is not a multiple of the `Word` size, we'll xor 0 bits at the end, which will generate a lot of 1s.
79+
// This may or may not impact relevancy since the 1s will be added to every vector.
7880
u.as_bytes().iter().zip(v.as_bytes()).map(|(u, v)| (u ^ v).count_ones()).sum::<u32>() as f32
7981
}

0 commit comments

Comments
 (0)