class ott.geometry.distrib_costs.UnivariateWasserstein(ground_cost=None, solver=None, **kwargs)[source]#

1D Wasserstein cost for two 1D distributions.

This ground cost between considers vectors as a family of values. The Wasserstein distance between them is the 1D OT cost, using a user-defined ground cost.

  • ground_cost (Optional[TICost]) – Cost used to compute the 1D optimal transport between vector, should be a translation-invariant (TI) cost for correctness. If None, defaults to SqEuclidean.

  • solver (Optional[UnivariateSolver]) – 1D optimal transport solver.

  • kwargs (Any) – Arguments passed on when calling the UnivariateSolver. May include random key, or specific instructions to subsample or compute using quantiles.


all_pairs(x, y)

Compute matrix of all pairwise costs, including the norms.

all_pairs_pairwise(x, y)

Compute matrix of all pairwise costs, excluding the norms.

barycenter(weights, xs)

Barycentric operator.

pairwise(x, y)

Wasserstein distance between \(x\) and \(y\) seen as a 1D dist.