summaryrefslogtreecommitdiff
path: root/test/test_ot.py
diff options
context:
space:
mode:
authorRémi Flamary <remi.flamary@gmail.com>2020-01-27 09:35:19 +0100
committerRémi Flamary <remi.flamary@gmail.com>2020-01-27 09:35:19 +0100
commit3844639d3dd4e0dd360ebef34dd657d26664039e (patch)
tree3bb02034f411af3e85957e289619fec973b5df3d /test/test_ot.py
parentda375139c75117a560546a16031787c7f0d50e74 (diff)
add test for constraint viuolation of duals
Diffstat (limited to 'test/test_ot.py')
-rw-r--r--test/test_ot.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/test_ot.py b/test/test_ot.py
index 18b6294..c756e51 100644
--- a/test/test_ot.py
+++ b/test/test_ot.py
@@ -337,7 +337,10 @@ def test_dual_variables():
# Check that both cost computations are equivalent
np.testing.assert_almost_equal(cost1, log['cost'])
check_duality_gap(a, b, M, G, log['u'], log['v'], log['cost'])
-
+
+ viol=log['u'][:,None]+log['v'][None,:]-M
+
+ assert viol.max()<1e-8
def check_duality_gap(a, b, M, G, u, v, cost):
cost_dual = np.vdot(a, u) + np.vdot(b, v)