slmsuite.holography.toolbox.smallest_distance

smallest_distance(vectors, metric=<function chebyshev>)[source]

Returns the smallest distance between pairs of points under a given metric.

Note

An \(\mathcal{O}(N^2)\) brute force approach is currently implemented. Future work will involve an \(\mathcal{O}(N\log(N))\) divide and conquer algorithm.

Parameters
  • vectors (array_like) – Points to compare. Cleaned with format_2vectors().

  • metric (lambda) – Function to use to compare. Defaults to scipy.spatial.distance.chebyshev(). scipy.spatial.distance.euclidean() is also common.