Skip to main content

compute_distance_matrix

Function compute_distance_matrix 

Source
pub fn compute_distance_matrix(xs: &[f32], ys: &[f32]) -> Vec<f32>
Expand description

Computes a flattened 1D row-major euclidean distance matrix from coordinate slices.

Returns a vector of size n * n, where n = xs.len(). Element at index i * n + j is sqrt((xs[i] - xs[j])^2 + (ys[i] - ys[j])^2).