From 90b069134839adf9ba09d282e53bec1d5d2c0b1f Mon Sep 17 00:00:00 2001 From: Too Yuen Min Date: Mon, 8 Jul 2024 16:56:25 +0800 Subject: [PATCH] Speed up hamming distance for bit arrays (#112) --- src/core.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core.jl b/src/core.jl index 26c9606..04f8730 100644 --- a/src/core.jl +++ b/src/core.jl @@ -75,7 +75,7 @@ distance = hamming_distance(desc_1, desc_2) Calculates the hamming distance between two descriptors. """ -hamming_distance(desc_1, desc_2) = mean(xor.(desc_1, desc_2)) +hamming_distance(desc_1, desc_2) = sum(xor.(desc_1, desc_2)) / length(desc_1) """ ```