pub fn cosine_similarity(a: &[f32], b: &[f32]) -> f32Expand description
Compute the cosine similarity between two dense vectors.
Returns a value in [-1.0, 1.0]. Returns 0.0 if either vector has zero norm
so that zero-length embeddings never falsely match.
ยงPanics
Does not panic. Mismatched lengths are handled by iterating the shorter vector.