Utils


Python

check_emd_status

wasserstein.check_emd_status(status)

Examines the return status of an EMD computation and raises an appropriate RuntimeError if it is not 0. See EMDStatus for details acceptable values.

Arguments

  • status : int
    • The status of the EMD computation. Zero means success and non-zero values indicate some sort of failure.

C++

check_emd_status

inline void check_emd_status(EMDStatus status);

Throws a std::runtime_error with a descriptive message if status is not EMDStatus::Success.

EMDStatus

Used to indicate the result of running the network simplex algorithm.

enum class wasserstein::EMDStatus : char {
  Success = 0,
  Empty = 1,
  SupplyMismatch = 2,
  Unbounded = 3,
  MaxIterReached = 4,
  Infeasible = 5
};

ExtraParticle

Used to indicate which event, if any, got an artificial extra particle during an EMD computation.

enum class wasserstein::ExtraParticle : char {
  Neither = -1,
  Zero = 0,
  One = 1
};

EMDPairsStorage

Used to indicate the type of storage for EMDs in a PairwiseEMD

enum class wasserstein::EMDPairsStorage : char {
  Full = 0,
  FullSymmetric = 1,
  FlattenedSymmetric = 2,
  External = 3
};

CenterWeightedCentroid

Not normally instantiated directly. Used with the templated preprocess method of the EMD and PairwiseEMD classes to adjust all particles so that the weighted centroid is located at the origin.