Function wasserstein_1d

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

Exact Wasserstein-1 (Earth Mover’s Distance) between two 1D distributions.

Both distributions must be non-negative and sum to the same total (typically 1.0 for probability distributions).

§Complexity

O(K log K) for sorting + O(K) for the sweep.