Skip to main content

sparse_dot

Function sparse_dot 

Source
pub fn sparse_dot(a: &SparseVector, b: &SparseVector) -> f32
Expand description

Dot product of two sparse vectors via a linear merge-join over their (ascending) term ids. This is the SPLADE/learned-sparse scoring primitive and the exact ground truth a brute-force oracle uses.

O(|a| + |b|). Relies on the SparseVector sorted-index invariant.