slmsuite.holography.toolbox.assign_vectors#

assign_vectors(vectors, assignment_options)[source]#

Assigns each vector in vectors to the closest counterpart assignment_options. Uses Euclidean distance.

Note

An \(\mathcal{O}(N^2)\) brute force approach is currently implemented, though it is vectorized. This could be sped up significantly.

Parameters:
  • vectors (array_like) – Array of M-vectors of shape (M, vector_count)

  • assignment_options (array_like) – Array of M-vectors of shape (M, option_count)

Returns:

For each vector, the index of the closest assignment_options. Of shape (option_count,).

Return type:

numpy.ndarray