slmsuite.holography.toolbox.lloyds_algorithm#
- lloyds_algorithm(grid, vectors, iterations=10, plot=False)[source]#
Implements Lloyd’s Algorithm on a set of seed
vectorsto promote even vector spacing using the helper functionvoronoi_windows(). This iteratively forces a set ofvectorsaway from each other until they become more evenly distributed over a space. This function could be made much more computationally efficient by using analytic methods to compute Voronoi cell area, rather than the current numerical approach.- Parameters:
grid ((array_like, array_like) OR
SLMOR (int, int)) – Seevoronoi_windows().vectors (array_like) – See
voronoi_windows().iterations (int) – Number of iterations to apply Lloyd’s Algorithm.
plot (bool) – Whether to plot each iteration of the algorithm.
- Returns:
The result of Lloyd’s Algorithm.
- Return type:
numpy.ndarray