summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorarolet <antoine.rolet@gmail.com>2017-07-21 12:12:21 +0900
committerarolet <antoine.rolet@gmail.com>2017-07-21 12:12:21 +0900
commitdc3bbd4134f0e2b80e0fe72368bdcf9966f434dc (patch)
tree00c58d3024e1b40c9d285148e9827d5dced64703 /test
parent1fcb7d0ffbc5b00ed20b5ded2e7f1001dc914d6e (diff)
Cleaned optimal plan and optimal cost computation
Diffstat (limited to 'test')
-rw-r--r--test/test_emd.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/test_emd.py b/test/test_emd.py
index eb1c5c5..4757cd1 100644
--- a/test/test_emd.py
+++ b/test/test_emd.py
@@ -43,11 +43,17 @@ ot.toc('1 proc : {} s')
cost1 = (G * M).sum()
+# emd loss 1 proc
+ot.tic()
+cost_emd2 = ot.emd2(a,b,M)
+ot.toc('1 proc : {} s')
+
ot.tic()
G = ot.emd(b, a, np.ascontiguousarray(M.T))
ot.toc('1 proc : {} s')
cost2 = (G * M.T).sum()
-assert np.abs(cost1-cost2) < tol
-assert np.abs(cost1-np.abs(mean1-mean2)) < tol
+assert np.abs(cost1-cost_emd2)/np.abs(cost1) < tol
+assert np.abs(cost1-cost2)/np.abs(cost1) < tol
+assert np.abs(cost1-np.abs(mean1-mean2))/np.abs(cost1) < tol