Skip to main content

Module distances

Module distances 

Source
Expand description

Zero-sized types representing distance functions.

The types defined here are zero-sized types that represent logical distance function operations.

Some types like bit-vectors and crate::bits::BitSlices can be efficiently implemented as pure functions and therefore can use PureDistanceFunction semantics for these types directly.

Other quantization schemes such as scalar quantization (e.g. crate::scalar::CompensatedSquaredL2) need auxiliary state and therefore need customized, stateful distance function types.

Macros§

check_lengths
Check that x.len() == y.len(), returning Err(diskann_vector::distances::UnequalLengths) if the results are different.

Structs§

Hamming
Compute the hamming distance between bit-vectors.
InnerProduct
Compute the inner-product between vector-like types.
SquaredL2
Compute the squared Euclidean distance between vector-like types.
UnequalLengths
A marker type that indicates a distance computation failed because the arguments had unequal lengths.

Type Aliases§

MathematicalResult
Upcoming return type for distance functions to allow graceful failure instead of panicking when incorrect dimensions are provided.
Result
Upcoming return type for distance functions to allow graceful failure instead of panicking when incorrect dimensions are provided.