diff options
author | Rémi Flamary <remi.flamary@gmail.com> | 2019-12-02 11:13:07 +0100 |
---|---|---|
committer | Rémi Flamary <remi.flamary@gmail.com> | 2019-12-02 11:13:07 +0100 |
commit | 57321bd0172c97b77dfc8b14972c18d063b6dda8 (patch) | |
tree | 6d21c211a69cee58b4d62f2abcbd0e99e0f23808 /test/test_ot.py | |
parent | 4a6883e0ce2fd9f3edd374d54c4c219d876ceb76 (diff) |
add awesome sparse solver
Diffstat (limited to 'test/test_ot.py')
-rw-r--r-- | test/test_ot.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/test_ot.py b/test/test_ot.py index dacae0a..4d59e12 100644 --- a/test/test_ot.py +++ b/test/test_ot.py @@ -118,6 +118,26 @@ def test_emd_empty(): np.testing.assert_allclose(w, 0) +def test_emd_sparse(): + + n = 100 + rng = np.random.RandomState(0) + + x = rng.randn(n, 2) + x2 = rng.randn(n, 2) + u = ot.utils.unif(n) + + M = ot.dist(x, x2) + + G = ot.emd([], [], M) + + Gs = ot.emd([], [], M, sparse=True) + + # check G is the same + np.testing.assert_allclose(G, Gs.todense()) + # check constraints + + def test_emd2_multi(): n = 500 # nb bins |