K-d tree: Difference between revisions
m
→{{header|Julia}}
Line 1,325:
println("\n\nThe point $rand3point is closest to the point $(cubedis[1:3, idxs[1]])",
" at distance $(dists[1]).")
NearestNeighbors.print_stats()
NearestNeighbors.reset_stats()
const cubedis2 = rand(3, 100000)
const kdcubetree2 = KDTree(cubedis)
const rand3point2 = rand(3, 1)
idxs, dists = knn(kdcubetree2, rand3point2, 1)
println("\n\nThe point $rand3point2 is closest to the point $(cubedis2[1:3, idxs[1]]) out of $(size(cubedis2)[2]) points, ",
" at distance $(dists[1]).")
NearestNeighbors.print_stats()
</lang>
{{out}}
The point [0.845167; 0.636466; 0.196453] is closest to the point [0.947299; 0.204084; 0.266638] out of 100000 points, at distance [0.0613915].
Nodes visited: 12
Points visited: 40, out of these: 0 unchecked.
</pre>
|