Skip to main content

distance_turbovec

Function distance_turbovec 

Source
pub fn distance_turbovec(
    query: &[f32],
    stored: &EncodedVector,
    metric: Distance,
) -> f32
Expand description

Score query against a single turbovec-stored vector at the given Distance metric, using turbovec’s SIMD-accelerated search path against an ephemeral one-element index.

Returns f32::INFINITY if stored is not a turbovec payload, if the stored vector cannot be added to the ephemeral index (e.g. a coordinate magnitude trips turbovec’s input validation), or if the dimension is not a supported turbovec dim. Smaller scores are closer; cosine and dot-product are mapped from turbovec’s similarity score by negation, and euclidean is approximated through the inner-product surrogate after L2 normalisation.

This is a single-pair surrogate; the bulk-search path used by the table layer issues one batched call to turbovec::TurboQuantIndex::search across all rows and avoids the ephemeral-index cost.