summaryrefslogtreecommitdiff
path: root/ot/lp/__init__.py
diff options
context:
space:
mode:
authorRomain Tavenard <romain.tavenard@univ-rennes2.fr>2019-06-20 14:52:23 +0200
committerRomain Tavenard <romain.tavenard@univ-rennes2.fr>2019-06-20 14:52:23 +0200
commit15b21611a3a93043d30c4eaaf9d622200453a884 (patch)
tree20ff23c61f35b876e56d435a5c522249f396e3c5 /ot/lp/__init__.py
parentf63f34f8adb6943b6410f8b773b4b4d8f1c7b4ba (diff)
EMD 1d without doc made faster
Diffstat (limited to 'ot/lp/__init__.py')
-rw-r--r--ot/lp/__init__.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/ot/lp/__init__.py b/ot/lp/__init__.py
index 49ded5b..c4457dc 100644
--- a/ot/lp/__init__.py
+++ b/ot/lp/__init__.py
@@ -333,9 +333,8 @@ def emd_1d(a, b, x_a, x_b, metric='sqeuclidean', log=False):
inv_perm_a = np.argsort(perm_a)
inv_perm_b = np.argsort(perm_b)
- M = dist(x_a[perm_a], x_b[perm_b], metric=metric)
-
- G_sorted, cost = emd_1d_sorted(a, b, M)
+ G_sorted, cost = emd_1d_sorted(a, b, x_a[perm_a], x_b[perm_b],
+ metric=metric)
G = G_sorted[inv_perm_a, :][:, inv_perm_b]
if log:
log = {}