def test_average_same(self, qty=1000): for i in range(qty): a = Bitstring() b = a.copy() c = Bitstring.average(a, b) self.assertEqual(c.distance_to(a), 0) self.assertEqual(c.distance_to(b), 0)
def test_random_swap(self, qty=1000): for i in range(qty): a = Bitstring() b = a.copy() self.assertEqual(a.distance_to(b), 0) dist = random.randint(0, sdm.get_dimension()) b.bitrandomswap(dist) self.assertEqual(a.distance_to(b), dist)
def test_writereadnear(self, distance=50, qty=10): #sdm.initialize() for i in range(qty): a = Bitstring() sdm.write(a, a) b = a.copy() b.bitrandomswap(distance) c = sdm.read(b) self.assertEqual(a.distance_to(c), 0)
def test_writereadnear(self, distance=50, qty=10): sdm.initialize() for i in range(qty): a = Bitstring() sdm.thread_write(a, a) b = a.copy() b.bitrandomswap(distance) c = sdm.thread_read(b) self.assertEqual(a.distance_to(c), 0) sdm.free()
def table_7_1(): n = sdm.get_dimension() a = Bitstring() v = [] for i in range(550): b = a.copy() b.bitrandomswap(i) v.append([ i, sdm.thread_radius_count_intersect(a, b) ]) print i sys.stdout.flush() return v
def table_7_1(): n = sdm.get_dimension() a = Bitstring() v = [] for i in range(550): b = a.copy() b.bitrandomswap(i) v.append([i, sdm.thread_radius_count_intersect(a, b)]) print i sys.stdout.flush() return v