1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//! Distance metrics for vector comparison.
//!
//! This module defines the `Metric` trait and implements standard distance
//! metrics used in HNSW indexing (L2 Squared, Dot Product, Hamming).
//!
//! # SIMD Acceleration
//!
//! Implementations for `L2Squared` and `DotProduct` automatically use SIMD instructions
//! if the target architecture supports them (e.g., AVX2 on x86_64, SIMD128 on WASM).
//!
//! To enable WASM SIMD, compile with `RUSTFLAGS="-C target-feature=+simd128"`.
pub use DotProduct;
pub use Hamming;
pub use L2Squared;
/// A trait for calculating distance between two vectors.