Expand description
Cross-platform deterministic scoring via fixed-point i64 (2^32 scale).
Re-exports§
pub use distance::score_from_distance;Deprecated pub use distance::score_from_distance_lossy;pub use distance::try_score_from_distance;
Modules§
- distance
- Canonical distance-to-
DeterministicScoreconversion for all retrieval backends.
Structs§
- Deterministic
Score - Fixed-point
i64score scaled by2^32, with saturating deterministic arithmetic. - Ranked
- Max-heap ranking item: higher score wins and lower ID breaks ties.
Enums§
- Score
Error - Validation errors from aggregation and distance conversion.
Functions§
- avg_
scores - Return the arithmetic mean of
scores, clamped to[NEG_INF, MAX]. - avg_
scores_ checked - Return the mean and whether absolute input mass or the result approaches saturation.
- cmp_
asc_ then_ id - Compare scores ascending, lower ID wins ties.
- cmp_
desc_ then_ id - Compare scores descending, lower ID wins ties.
- max_
score - Return the maximum score, or
DeterministicScore::NEG_INFfor an empty slice. - min_
score - Return the minimum score, or
DeterministicScore::MAXfor an empty slice. - rrf_
score - RRF score
1 / (k + rank). Rank is 1-based; preferrrf_score_one_basedorrrf_score_zero_based. - rrf_
score_ one_ based - RRF score with 1-based rank (first result = rank 1).
kis the smoothing constant. - rrf_
score_ zero_ based - RRF score with 0-based index (index 0 → rank 1 internally).
- sum_
scores - Return the saturating sum of
scores, clamped to[NEG_INF, MAX]. - weighted_
sum - Return a saturating weighted sum.