JuliaGeometry / KDTrees.jl

KDTrees for julia
Other
25 stars 8 forks source link

Higher dimensional trees? #14

Closed carolynkim closed 9 years ago

carolynkim commented 9 years ago

Hi,

I think that the newest version can't do higher dimensional trees. The _knn function in this version takes 7 arguments, but is called with 8 (e.g., line 371). For example. this fails:

julia> tree = KDTree(randn(30, 1000)) KDTree from 1000 points in 30 dimensions.

julia> knn(tree,zeros(30), 5) ERROR: _knn has no method matching _knn(::KDTree{Float64}, ::Array{Float64,1}, ::Int64, ::Array{Int64,1}, ::Array{Float64,1}, ::Int64, ::Float64, ::Int64) in knn at /Users/Home/.julia/v0.3/KDTrees/src/kd_tree.jl:371 in knn at /Users/Home/.julia/v0.3/KDTrees/src/kd_tree.jl:352

(But it works fine with 3 instead of 30:

julia> tree = KDTree(randn(3, 1000)) KDTree from 1000 points in 3 dimensions.

julia> knn(tree,zeros(3), 5) ([995,306,104,476,243],[0.154768,0.169576,0.180216,0.232775,0.235856]) )

KristofferC commented 9 years ago

Yeah, sorry about that. I fixed it now and will tag a new version. For now you can run Pkg.checkout("KDTrees") and it should work until the new version has been updated in METADATA.jl.

I leave this open until you have confirmed it works again.

carolynkim commented 9 years ago

Thanks! It seems to work now.

KristofferC commented 9 years ago

Thanks for the report. Some uncareful committing on my part. Sorry about that.