86 Stars
Updated Last
10 Months Ago
Started In
April 2020


CI GPU tests DOI Codecov Coveralls Code Style: Blue

This package provides some Julia implementations of algorithms for computational optimal transport, including the Earth-Mover's (Wasserstein) distance, Sinkhorn algorithm for entropically regularized optimal transport as well as some variants or extensions.

Notably, OptimalTransport.jl provides GPU acceleration through CUDA.jl and NNlibCUDA.jl.

This package is inspired by the Python Optimal Transport package.


using OptimalTransport
using Distances

# uniform histograms
μ = fill(1/250, 250)
ν = fill(1/200, 200)

# random cost matrix
C = pairwise(SqEuclidean(), rand(1, 250), rand(1, 200); dims=2)

# regularization parameter
ε = 0.01

# solve entropically regularized optimal transport problem
sinkhorn(μ, ν, C, ε)

Please see the documentation pages for further information.

Related packages


Contributions are more than welcome! Please feel free to submit an issue or pull request in this repository.


Contributors include:

  • Tim Matsumoto (UBC)
  • David Widmann (Uppsala)
  • Davi Barreira (FGV)
  • Stephen Zhang (UBC)


  • Peyré, G. and Cuturi, M., 2019. Computational optimal transport. Foundations and Trends® in Machine Learning, 11(5-6), pp.355-607.
  • Lorenz, D.A., Manns, P. and Meyer, C., 2019. Quadratically regularized optimal transport. Applied Mathematics & Optimization, pp.1-31.
  • Rémi Flamary and Nicolas Courty, POT Python Optimal Transport library, https://pythonot.github.io/, 2017
  • Chizat, L., Peyré, G., Schmitzer, B. and Vialard, F.X., 2016. Scaling algorithms for unbalanced transport problems. arXiv preprint arXiv:1607.05816.
  • Schmitzer, B., 2019. Stabilized sparse scaling algorithms for entropy regularized transport problems. SIAM Journal on Scientific Computing, 41(3), pp.A1443-A1481.

Used By Packages

No packages found.