def test_is_in(self): import numpy as np from cykhash import Int64Set_from_buffer, isin_int64 a = np.arange(42, dtype=np.int64) lookup = Int64Set_from_buffer(a) b = np.arange(84, dtype=np.int64) result = np.empty(b.size, dtype=np.bool) isin_int64(b, lookup, result) assert np.sum(result.astype(np.int)) == 42 self.assertTrue(True)
def test_quick_tutorial_1(self): import numpy as np a = np.arange(42, dtype=np.int64) b = np.arange(84, dtype=np.int64) result = np.empty(b.size, dtype=np.bool) # actually usage from cykhash import Int64Set_from_buffer, isin_int64 lookup = Int64Set_from_buffer(a) # create a hashset isin_int64(b, lookup, result) # running time O(b.size) isin_int64(b, lookup, result) # lookup is reused and not recreated self.assertTrue(True)