NearestNeighbors.jl
NearestNeighbors.jl copied to clipboard
periodic kdtree or balltree
I am trying to use this package to build neighbor lists. I am new to Julia. Can you help me in the implementation of periodic elucidation distance or add it as a functionality?
You can find the PeriodicEuclidean
distance over at Distances.jl. And then you can pass it as the metric argument to the tree constructor here. You'll need to use a BallTree, though, because PeriodicEuclidean is not a Minkowski-type metric.
In what sense is PeriodicEucledean
not a Minkowski Metric? As it is very similar to the Eucledean
would it not be quite easy to also implement it for KDTree?
In what sense is
PeriodicEucledean
not a Minkowski Metric? As it is similar to theEucledean
would it not be quite easy to also implement it for KDTree?
Did a quick google search. It seems that for periodic euclidean metric the canonical KD tree structure is not applicable. Nevertheless, as this review indicates there are modified KD Tree structures which can handle periodic boundaries.
I guess it should be possible https://namdanalyzer.readthedocs.io/en/latest/kdTree/periodic_kdtree.html. I am still learning Julia, do you have an example of using distance.jl with ballTree.
I guess it should be possible https://namdanalyzer.readthedocs.io/en/latest/kdTree/periodic_kdtree.html. I am still learning Julia, do you have an example of using distance.jl with ballTree.
using NearestNeighbors
using Distances
data = rand(1, 10^4)
r = 0.05
point = rand(1)
balltree = BallTree(data, PeriodicEuclidean([1]))
idxs = inrange(balltree, point, r)