persim.wasserstein

persim.wasserstein(dgm1, dgm2, matching=False)[source]

Perform the Wasserstein distance matching between persistence diagrams. Assumes first two columns of dgm1 and dgm2 are the coordinates of the persistence points, but allows for other coordinate columns (which are ignored in diagonal matching).

See the distances notebook for an example of how to use this.

Parameters
  • dgm1 (Mx(>=2)) – array of birth/death pairs for PD 1

  • dgm2 (Nx(>=2)) – array of birth/death paris for PD 2

  • matching (bool, default False) – if True, return matching information and cross-similarity matrix

Returns

  • d (float) – Wasserstein distance between dgm1 and dgm2

  • (matching, D) (Only returns if matching=True) – (tuples of matched indices, (N+M)x(N+M) cross-similarity matrix)