| 27 | |
| 28 | @pytest.mark.skipif(nocvxpy, reason="No CVXPY available") |
| 29 | def test_nearest_brenier_potential_fit(nx): |
| 30 | X = nx.ones((2, 2)) |
| 31 | phi, G, log = ot.mapping.nearest_brenier_potential_fit(X, X, its=3, log=True) |
| 32 | np.testing.assert_almost_equal( |
| 33 | to_numpy(G), to_numpy(X) |
| 34 | ) # image of source should be close to target |
| 35 | # test without log but with X_classes, a, b and other init method |
| 36 | a = nx.ones(2) / 2 |
| 37 | ot.mapping.nearest_brenier_potential_fit( |
| 38 | X, X, X_classes=nx.ones(2), a=a, b=a, its=1, init_method="target" |
| 39 | ) |
| 40 | |
| 41 | |
| 42 | @pytest.mark.skipif(nocvxpy, reason="No CVXPY available") |