Skip to content

Commit

Permalink
Speed up hamming distance for bit arrays (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
ymtoo authored Jul 8, 2024
1 parent bfb819f commit 90b0691
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

"""
```
Expand Down

0 comments on commit 90b0691

Please sign in to comment.