def test_unique_sets(): sets = np.array([[0, 1, 2], [1, 2, 0], [0, 2, 1], [1, 2, 3]]) e = array_to_set([[0, 1, 2], [1, 2, 3]]) # Run without inverse u = unique_sets(sets) nt.assert_equal(len(u), len(e)) nt.assert_equal(array_to_set(u), e) # Run with inverse u, m = unique_sets(sets, return_inverse=True) nt.assert_equal(len(u), len(e)) nt.assert_equal(array_to_set(u), e) nt.assert_equal(np.sort(u[m], -1), np.sort(sets, -1))
def test_unique_sets(): sets = np.array([[0, 1, 2], [1, 2, 0], [0, 2, 1], [1, 2, 3]]) e = array_to_set([[0, 1, 2], [1, 2, 3]]) # Run without inverse u = unique_sets(sets) nt.assert_equal(len(u), len(e)) nt.assert_equal(array_to_set(u), e) # Run with inverse u, m = unique_sets(sets, return_inverse=True) nt.assert_equal(len(u), len(e)) nt.assert_equal(array_to_set(u), e) nt.assert_equal(np.sort(u[m], -1), np.sort(sets, -1))