summaryrefslogtreecommitdiff
path: root/examples/plot_OT_1D.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/plot_OT_1D.py')
-rw-r--r--examples/plot_OT_1D.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/examples/plot_OT_1D.py b/examples/plot_OT_1D.py
index 15ead96..62f0b7d 100644
--- a/examples/plot_OT_1D.py
+++ b/examples/plot_OT_1D.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
"""
-====================
-1D optimal transport
-====================
+======================================
+Optimal Transport for 1D distributions
+======================================
This example illustrates the computation of EMD and Sinkhorn transport plans
and their visualization.
@@ -64,7 +64,11 @@ ot.plot.plot1D_mat(a, b, M, 'Cost matrix M')
#%% EMD
-G0 = ot.emd(a, b, M)
+# use fast 1D solver
+G0 = ot.emd_1d(x, x, a, b)
+
+# Equivalent to
+# G0 = ot.emd(a, b, M)
pl.figure(3, figsize=(5, 5))
ot.plot.plot1D_mat(a, b, G0, 'OT matrix G0')