summaryrefslogtreecommitdiff
path: root/test/test_ot.py
diff options
context:
space:
mode:
authorRémi Flamary <remi.flamary@gmail.com>2018-05-11 17:25:32 +0200
committerRémi Flamary <remi.flamary@gmail.com>2018-05-11 17:25:32 +0200
commitbd1af44ea0a819d5df0ccffbea4d05ed7547960b (patch)
tree491b3831a494e83fc00d7b09072d5ded51f80d97 /test/test_ot.py
parentfdb2f3af19d04872bafa0d9ec5563732e1d6209b (diff)
add test barycenter cvxopt
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 bf23e8c..cc25bf4 100644
--- a/test/test_ot.py
+++ b/test/test_ot.py
@@ -12,6 +12,7 @@ import ot
from ot.datasets import get_1D_gauss as gauss
import pytest
+
def test_doctest():
import doctest
@@ -133,6 +134,7 @@ def test_lp_barycenter():
np.testing.assert_allclose(bary, bary0, rtol=1e-5, atol=1e-7)
np.testing.assert_allclose(bary.sum(), 1)
+
@pytest.mark.skipif(not ot.lp.cvx.cvxopt, reason="No cvxopt available")
def test_lp_barycenter_cvxopt():
@@ -145,11 +147,12 @@ def test_lp_barycenter_cvxopt():
# obvious barycenter between two diracs
bary0 = np.array([0, 1.0, 0])
- bary = ot.lp.barycenter(A, M, [.5, .5],solver=None)
+ bary = ot.lp.barycenter(A, M, [.5, .5], solver=None)
np.testing.assert_allclose(bary, bary0, rtol=1e-5, atol=1e-7)
np.testing.assert_allclose(bary.sum(), 1)
+
def test_warnings():
n = 100 # nb bins
m = 100 # nb bins