From 3844639d3dd4e0dd360ebef34dd657d26664039e Mon Sep 17 00:00:00 2001 From: RĂ©mi Flamary Date: Mon, 27 Jan 2020 09:35:19 +0100 Subject: add test for constraint viuolation of duals --- test/test_ot.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'test/test_ot.py') 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) -- cgit v1.2.3