-
Notifications
You must be signed in to change notification settings - Fork 73
Closed
Description
Hi Kristoffer
Let's say that I have a tree:
using NearestNeighbors, StaticArrays
data = [rand(SVector{3}) for i in 1:1000]
tree = KDTree(data, Euclidean())I found that I am implementing an algorithm where I want the nearest neighbor of a point very frequently. Sometimes I am also quering about it multiple times. I was wondering whether there is some way I can get the indices of nearest neighbors from the tree structure.
Of course I know I can do:
nind = [knn(tree, data[j], 1, false, i -> i == j)[1][1] for j in 1:length(data)]
but is there some "faster way" ?
edit: the tree is not an argument to my high-level function but created inside. so if there is a way to do what I want even during construction, then it will still be super useful
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels