pub fn cosine_sim(a: &[f64], b: &[f64]) -> f64
Cosine similarity between two vectors. Returns 0.0 when either vector has zero magnitude or the lengths differ.