(nx)
| 36 | |
| 37 | |
| 38 | def get_LazyTensor(nx): |
| 39 | n1 = 100 |
| 40 | n2 = 200 |
| 41 | |
| 42 | rng = np.random.RandomState(42) |
| 43 | a = rng.rand(n1) |
| 44 | a /= a.sum() |
| 45 | b = rng.rand(n2) |
| 46 | b /= b.sum() |
| 47 | |
| 48 | a, b = nx.from_numpy(a, b) |
| 49 | |
| 50 | def getitem(i, j, a, b): |
| 51 | return a[i, None] * b[None, j] |
| 52 | |
| 53 | # create a lazy tensor |
| 54 | T = ot.utils.LazyTensor((n1, n2), getitem, a=a, b=b) |
| 55 | |
| 56 | return T, a, b |
| 57 | |
| 58 | |
| 59 | def test_proj_simplex(nx): |
no test coverage detected