title: Fast way to compute the minimal distance of two sets of k-dimensional vectors
body: <p>I two sets of k-dimensional vectors, where k is around 500 and the number of vectors is usually smaller. I want to compute the (arbitrarily defined) minimal distance between the two sets.
  A naive approach would be this:</p>
  
  <pre><code>(loop for a in set1
        for b in set2
        minimizing (distance a b))
  </code></pre>
  
  <p>However, this requires O(n² * distance) computations. Is there a faster way of doing this?</p>