summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRĂ©mi Flamary <remi.flamary@gmail.com>2020-02-03 09:59:15 +0100
committerGitHub <noreply@github.com>2020-02-03 09:59:15 +0100
commit81e9d425b905b1b7fc0ee888556e60c692d9bb18 (patch)
treee786f1ec744bbf28928ac72bb705f172b04a4562 /test
parentda375139c75117a560546a16031787c7f0d50e74 (diff)
parentf65073faa73b36280a19ff8b9c383e66f8bdbd2b (diff)
Merge pull request #123 from rflamary/bug_dual
[WIP] Bug on dual potential (constraint violation when some weights are 0)
Diffstat (limited to 'test')
-rw-r--r--test/test_ot.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/test_ot.py b/test/test_ot.py
index 18b6294..47df946 100644
--- a/test/test_ot.py
+++ b/test/test_ot.py
@@ -338,6 +338,10 @@ def test_dual_variables():
np.testing.assert_almost_equal(cost1, log['cost'])
check_duality_gap(a, b, M, G, log['u'], log['v'], log['cost'])
+ constraint_violation = log['u'][:, None] + log['v'][None, :] - M
+
+ assert constraint_violation.max() < 1e-8
+
def check_duality_gap(a, b, M, G, u, v, cost):
cost_dual = np.vdot(a, u) + np.vdot(b, v)