Expand description
Dtype-aware distance dispatch shim.
Routes byte-encoded vector pairs to the correct distance kernel based on
dtype and metric. F16 / BF16 inputs on the three hot metrics (L2, Cosine,
InnerProduct) use fused decode-and-compute kernels from typed_scalar,
eliminating the intermediate Vec<f32> allocation. Rare metrics (Manhattan,
Chebyshev, Hamming, Jaccard, Pearson) fall through to cast_to_f32 +
distance() — correctness is identical and they are not on the hot path.
The F32 path is always a straight cast + delegate (no conversion needed).
Enums§
- Distance
Error - Error type for
distance_typed.
Functions§
- distance_
typed - Compute distance between two byte-encoded vectors of the given dtype.