Hacker News new | ask | show | jobs
by Dav3xor 3997 days ago
If you're iterating over all your points calculating distances, you are going about this the wrong way.

(edit) The author could use my handy python quad tree if he so wishes -- https://github.com/Dav3xor/pyquadtree, and if he asks nicely, I could even add support for simple approximation of spherical coordinates.

1 comments

I feel like a k-d tree would be a more appropriate solution, if the programmer wanted to write more than a simple loop.
Indeed, came here to say exactly this.

K-d trees are even built in to SciPy, which the author probably already has installed (Scikit-Learn also has an implementation).

Sure, absolutely. Just wanted to point out that the article isn't very sophisticated.
It is simple indeed. The performance I got was good enough to spare me the effort of using quad trees. Yes, I know what quad trees are. I even coded octrees for 3D reasoning in a previous life ;)