NearestNeighbors.jl
NearestNeighbors.jl copied to clipboard
`KDTree` inference failure causes results to fail to infer
function foo(data, point)
b = KDTree(data)
return knn(b, point, 1)
end
foo([1.0 3.4; 4.5 3.4], [4.5; 3.4])
The root cause is that obviously the static vector size isn't knowable at compile time.
I suggest adding a variant interface allowing the dimension to be specified by the user, such as:
function KDTree(data::AbstractVecOrMat{T}, ::Val{D}, metric::M = Euclidean(); ...) where {T <: AbstractFloat, M <: MinkowskiMetric, D}
...
end