(nx)
| 666 | |
| 667 | |
| 668 | def test_proj_SDP(nx): |
| 669 | t = np.pi / 8 |
| 670 | U = np.array([[np.cos(t), -np.sin(t)], [np.sin(t), np.cos(t)]]) |
| 671 | w = np.array([1.0, -1.0]) |
| 672 | S = np.stack([U @ np.diag(w) @ U.T] * 2, axis=0) |
| 673 | S_nx = nx.from_numpy(S) |
| 674 | R = ot.utils.proj_SDP(S_nx) |
| 675 | |
| 676 | w_expected = np.array([1.0, 0.0]) |
| 677 | S_expected = np.stack([U @ np.diag(w_expected) @ U.T] * 2, axis=0) |
| 678 | assert np.allclose(nx.to_numpy(R), S_expected) |
| 679 | |
| 680 | R0 = ot.utils.proj_SDP(S_nx[0]) |
| 681 | assert np.allclose(nx.to_numpy(R0), S_expected[0]) |
| 682 | |
| 683 | |
| 684 | def test_laplacian(): |
nothing calls this directly
no test coverage detected