Fast way to compute the minimal distance of two sets of k-dimensional vectors

Posted by vrld on Stack Overflow See other posts from Stack Overflow or by vrld
Published on 2010-06-06T13:30:23Z Indexed on 2010/06/06 14:42 UTC
Read the original article Hit count: 198

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:

(loop for a in set1
      for b in set2
      minimizing (distance a b))

However, this requires O(n² * distance) computations. Is there a faster way of doing this?

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about computational-geometry