Skip to main content

cosine_sim

Function cosine_sim 

Source
pub fn cosine_sim(a: &[f32], b: &[f32]) -> f32
Expand description

Compute the cosine similarity between two equal-length slices.

Returns 0.0 when either vector has zero magnitude.