Skip to content
This repository has been archived by the owner on Feb 3, 2020. It is now read-only.

Commit

Permalink
Some updates
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Mar 5, 2015
1 parent 71a69f0 commit 82d55c9
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Kd trees for Julia.

[![Build Status](https://travis-ci.org/KristofferC/KDTrees.jl.svg?branch=master)](https://travis-ci.org/KristofferC/KDTrees.jl) [![Coverage Status](https://coveralls.io/repos/KristofferC/KDTrees.jl/badge.svg)](https://coveralls.io/r/KristofferC/KDTrees.jl)

This package contains a highly optimized kd tree to perform *k* nearest neighbour searches and range searches.
This package contains a optimized kd tree to perform *k* nearest neighbour searches and range searches.

The readme contains some usage examples, different benchmarks and a comparison for kNN to scipy's cKDTree.

Expand Down Expand Up @@ -59,10 +59,10 @@ gives the indices:

KDTrees.jl also supports *dual tree range searches* where the query points are
put in their own separate tree and both trees are traversed at the same time
while extracting the pairs of points that are in a given range. This can give
be more effective when the number of points to query with are large.
while extracting the pairs of points that are in a given range.

Dual tree range searches are performed with the function `inball(tree1, tree2, radius, sort)` and returns a list of list such that the *i*:th list contains the indices for the points in tree2 that are in range to point *i* in tree. Currently, trees where the data has been optimized for memory allocation is not supported.
Dual tree range searches are performed with the function `inball(tree1, tree2, radius, sort)` and returns a list of list such that the *i*:th list contains the indices for the points in tree2 that are in range to point *i* in tree.
If `sort = true` the lists are sorted before being returned. Currently, trees where the data has been optimized for memory allocation is not supported.

```julia
using KDTrees
Expand All @@ -88,21 +88,6 @@ gives the result
[5,7]
```

An example showing the speedup vs point by point querying is shown below:
```julia
julia> tree = KDTree(rand(3, 10^6));

julia> tree = KDTree(rand(3, 10^6));

julia> @time inball(tree, tree2, 0.15);
elapsed time: 13.55269431 seconds (3737369440 bytes allocated, 3.00% gc time)

julia> @time for i in 1:10^6
inball(tree, rand(5), 0.15)
end
0.683663458
```

### K-Nearest-Neighbours

The exported function `knn(tree, point, k)` finds the *k* nearest neighbours to a given point. The function returns a tuple of two lists with the indices and the distances from the given points respectively. These are sorted in the order of smallest to largest distance.
Expand Down Expand Up @@ -175,4 +160,4 @@ knn / sec: 730922

Contributions are more than welcome. If you have an idea that would make the
tree have better performance or be more general please create a PR. Make
sure you run the benchmarks before and after your changes.
sure you run the benchmarks before and after your changes.

0 comments on commit 82d55c9

Please sign in to comment.