(a: &[f32], b: &[f32])
| 7 | /// L2 squared distance between two equal-length slices. |
| 8 | #[inline] |
| 9 | pub fn l2_sq(a: &[f32], b: &[f32]) -> f32 { |
| 10 | a.iter().zip(b.iter()).map(|(x, y)| (x - y).powi(2)).sum() |
| 11 | } |
| 12 | |
| 13 | /// Lloyd's k-means clustering. |
| 14 | /// |