Skip to content
Snippets Groups Projects
Commit 5bd499e5 authored by Christoph Groth's avatar Christoph Groth
Browse files

lll: small optimization

parent 421fce97
No related branches found
No related tags found
No related merge requests found
......@@ -156,12 +156,12 @@ def cvp(vec, basis, n=1):
point_coords -= vec.T
distances = np.sqrt(np.sum(point_coords**2, 1))
order = np.argsort(distances)
distances = distances[order]
if distances[n - 1] < nth_dist:
nth_dist = distances[n - 1]
new_nth_dist = distances[order[n - 1]]
if new_nth_dist < nth_dist:
nth_dist = new_nth_dist
rad += 1
else:
return np.array(points[order][:n], int)
return np.array(points[order[:n]], int)
def voronoi(basis):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment