Expand description
Shared scalar distance metric implementations.
Pure scalar functions that the compiler auto-vectorizes. Used by both
nodedb (with optional SIMD dispatch) and nodedb-lite (scalar only).
Enums§
- Distance
Metric - Distance metric selection.
Functions§
- chebyshev
- Chebyshev (L-infinity) distance: max absolute difference.
- cosine_
distance - Cosine distance: 1.0 - cosine_similarity(a, b).
- distance
- Compute distance using the specified metric (scalar dispatch).
- hamming_
f32 - Hamming distance for f32 vectors (values > 0.5 treated as 1).
- jaccard
- Jaccard distance for f32 vectors (values > 0.5 treated as set membership).
- l2_
squared - Euclidean (L2) squared distance.
- manhattan
- Manhattan (L1) distance: sum of absolute differences.
- neg_
inner_ product - Negative inner product (for max-inner-product search via min-heap).
- pearson
- Pearson distance: 1 - Pearson correlation coefficient.