3 ms·
Interesting to see this - we ran into a similar problem of finding points within a certain distance from amongst thousands or millions of points. We ended up u
by erjiang 11y ago
Interesting to see this - we ran into a similar problem of finding points within a certain distance from amongst thousands or millions of points. We ended up using Cython[0].
Would this numpy trick work if he still needed an accurate distance calculation? Kind of underwhelming to throw away the accuracy to get speed without adding it back later.
[0] http://doublemap.github.io/blog/2015/05/29/optimizing-python/ http://doublemap.github.io/blog/2015/05/29/optimizing-python...
- noreasonw 11y agoJust thinking a little bit about this problem, there is an easy to code, precise and top performance algorithm for solving the following two problems: 1) finding the points Pi within a certain distance d0 of a fixed point P0 in your database 2) finding the nearest point Pmin to P0, with Pmin in your database. I will keep it for myself, but as a hint here are two steps: first: read the John Cook article about deriving the distance formula, and second: think and easy way of avoiding unneeded computation. It took me just a minute to realize the correct way to solve the OP, so it shouldn't take you long to solve it.