oineus.sliced_wasserstein_distance

oineus.sliced_wasserstein_distance(dgm_1, dgm_2, n_directions=100, ignore_inf_points=False, seed=None, directions=None)[source]

Sliced Wasserstein distance between two single-dimension diagrams.

Standard form: diagonal projections of the opposite diagram are added to each side and participate symmetrically in the rank matching.

Parameters:
  • dgm_1 – Single-dimension diagrams ((n, 2) numpy array or list[DiagramPoint]).

  • dgm_2 – Single-dimension diagrams ((n, 2) numpy array or list[DiagramPoint]).

  • n_directions (int) – Number of random projection directions (ignored if directions is given).

  • ignore_inf_points (bool) – If True, drop essential points and only match the finite part.

  • seed – Seed for the random directions (forwarded to numpy.random.default_rng); use it for reproducible results.

  • directions – Optional explicit (n_directions, 2) array of directions; overrides n_directions/seed. Useful for deterministic runs or comparing two distances under identical directions.

Returns:

The sliced Wasserstein distance as a Python float.