-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a new search type CountWithinRange
?
#16
Comments
CountWithinRange
CountWithinRange
?
Hi, yes sounds good, but I'd vote to remove the |
However, I'm not sure if this struct is the way to go, because then what would |
Good point. think re-exporting function inrangecount(tree, query_pts, r)
[inrangecount(tree, pᵢ, r) for pᵢ in pts]
end where If you're okay with that @Datseris, I'll submit a PR (also including an in-place version where the count vector is pre-allocated). |
sounds good, but if there is no performant version for getting in a vector of points already in NearestNeighbors.jl, I'd say that |
Solved by #17. |
Is there a reason why this was given version 0.2.4? In the list of tagged releases, 0.2.2 was the previous one. |
I've encountered a use case where I need to construct a tree search structure, and for a list of query points, I need to find how many points are within a certain radius
r
of each of those points (see this comment).A way of doing this is to use
WithinRange(r)
withbulkisearch
. However, this is inefficient, because it allocates the index vectors (thus, allocations grow with the number of input points).NearestNeighbors.jl
recently added theinrangecount
function, which simply counts the number of neighbors without allocating neither indices nor distances. In my specific application, usinginrangecount
instead ofbulkisearch
reduces runtime by half and allocations by many orders of magnitude (depending on size of input data).It would be nice to have a generic search structure representing this use case in
Neighborhood.jl
too. Perhaps something like the following?where
r
is the radius andself_count
flag determines whether the query point itself should be counted or not.The text was updated successfully, but these errors were encountered: