Closed BenCurran98 closed 2 months ago
Hi, I've been trying to run knn on views of an array of points where my points are SVectors and noticed that knn doesn't allow this? E.g.
knn
view
SVector
using NearestNeighbors using StaticArrays points = rand(SVector{3, Float64}, 100) kdtree = KDTree(points) idxs, dists = knn(kdtree, view(points, 1:10), 3)
The error from this (in Julia 1.10) is:
ERROR: MethodError: no method matching knn(::KDTree{SVector{…}, Euclidean, Float64, SVector{…}}, ::SubArray{SVector{…}, 1, Vector{…}, Tuple{…}, true}, ::Int64) Closest candidates are: knn(::NNTree{V}, ::Vector{T}, ::Int64, ::Any, ::F) where {V, T<:(AbstractVector), F<:Function} @ NearestNeighbors ~/.julia/packages/NearestNeighbors/dZqbT/src/knn.jl:17 knn(::NNTree{V}, ::Vector{T}, ::Int64, ::Any) where {V, T<:(AbstractVector)} @ NearestNeighbors ~/.julia/packages/NearestNeighbors/dZqbT/src/knn.jl:17 knn(::NNTree{V}, ::Vector{T}, ::Int64) where {V, T<:(AbstractVector)} @ NearestNeighbors ~/.julia/packages/NearestNeighbors/dZqbT/src/knn.jl:17 ... Stacktrace: [1] top-level scope @ REPL[24]:1 Some type information was truncated. Use `show(err)` to see complete types.
Any help would be much appreciated! :slightly_smiling_face:
Hi and thanks for the report. Sorry for the late reply but this should be fixed and be in a release soon.
Thanks for that! :slightly_smiling_face:
Hi, I've been trying to run
knn
onview
s of an array of points where my points areSVector
s and noticed thatknn
doesn't allow this? E.g.The error from this (in Julia 1.10) is:
Any help would be much appreciated! :slightly_smiling_face: