Skip to content

Commit 3844639

Browse files
committed
add test for constraint viuolation of duals
1 parent da37513 commit 3844639

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test/test_ot.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,10 @@ def test_dual_variables():
337337
# Check that both cost computations are equivalent
338338
np.testing.assert_almost_equal(cost1, log['cost'])
339339
check_duality_gap(a, b, M, G, log['u'], log['v'], log['cost'])
340-
340+
341+
viol=log['u'][:,None]+log['v'][None,:]-M
342+
343+
assert viol.max()<1e-8
341344

342345
def check_duality_gap(a, b, M, G, u, v, cost):
343346
cost_dual = np.vdot(a, u) + np.vdot(b, v)

0 commit comments

Comments
 (0)