-
Notifications
You must be signed in to change notification settings - Fork 73
Open
Description
Great package! So fast! 😃 Anyway, I thought this MWE (based on the readme example except for using points instead of point) would work (since "points can also be a vector of other vectors where each element in the outer vector is considered a point.") but it throws an error:
julia> using NearestNeighbors
julia> data = rand(3, 10^4);
julia> k = 3 ;
julia> kdtree = KDTree(data) ;
julia> points = [rand(3) for i in 1:10]
10-element Array{Array{Float64,1},1}:
[0.68304, 0.983004, 0.220862]
[0.626807, 0.61079, 0.968843]
[0.192098, 0.157959, 0.300556]
[0.300309, 0.502549, 0.653381]
[0.160819, 0.653002, 0.9979]
[0.809764, 0.0521815, 0.0290807]
[0.20466, 0.592894, 0.656526]
[0.370667, 0.0579244, 0.930079]
[0.593999, 0.934687, 0.555133]
[0.60504, 0.78062, 0.243998]
julia> idxs, dists = knn(kdtree, points, k, true)
ERROR: MethodError: no method matching length(::Type{Array{Float64,1}})
Closest candidates are:
length(::Core.SimpleVector) at essentials.jl:561
length(::Base.MethodList) at reflection.jl:801
length(::Core.MethodTable) at reflection.jl:875
...
Stacktrace:
[1] check_input(::KDTree{StaticArrays.SArray{Tuple{3},Float64,1,3},Euclidean,Float64}, ::Array{Array{Float64,1},1}) at /Users/benoitpasquier/.julia/packages/NearestNeighbors/N7lgR/src/NearestNeighbors.jl:29
[2] knn(::KDTree{StaticArrays.SArray{Tuple{3},Float64,1,3},Euclidean,Float64}, ::Array{Array{Float64,1},1}, ::Int64, ::Bool, ::Function) at /Users/benoitpasquier/.julia/packages/NearestNeighbors/N7lgR/src/knn.jl:16 (repeats 2 times)
[3] top-level scope at none:0Maybe I'm doing this wrong?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels