N = 40000
r = 0.1
x1 = np.random.normal(size=N)
x1 = (x1 - min(x1)) / (max(x1) - min(x1))
x2 = np.random.normal(size=N)
x2 = (x2 - min(x2)) / (max(x2) - min(x2))
X = np.vstack([x1, x2]).T
tic = time.time()
grid0 = gt.get_centers0(X, r)
toc = time.time()
print('Method 0: ' + str(toc - tic))
tic = time.time()
grid2 = gt.get_centers2(X, r, 10)
toc = time.time()
print('Method 2: ' + str(toc - tic))
tic = time.time()
grid3 = gt.get_centers_fast(X, r)
toc = time.time()
print('Method 3: ' + str(toc - tic))
Build an approximately uniform grid from random sample (python)