Skip to content

Commit

Permalink
bump the default leafsize from 10 to 25 (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Jun 29, 2024
1 parent 3636844 commit 1a5c45f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ using NearestNeighbors
data = rand(3, 10^4)

# Create trees
kdtree = KDTree(data; leafsize = 10)
kdtree = KDTree(data; leafsize = 25)
balltree = BallTree(data, Minkowski(3.5); reorder = false)
brutetree = BruteTree(data)
```
Expand Down
6 changes: 3 additions & 3 deletions src/ball_tree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ end


"""
BallTree(data [, metric = Euclidean(); leafsize = 10, reorder = true]) -> balltree
BallTree(data [, metric = Euclidean(); leafsize = 25, reorder = true]) -> balltree
Creates a `BallTree` from the data using the given `metric` and `leafsize`.
"""
function BallTree(data::AbstractVector{V},
metric::Metric = Euclidean();
leafsize::Int = 10,
leafsize::Int = 25,
reorder::Bool = true,
storedata::Bool = true,
reorderbuffer::Vector{V} = Vector{V}()) where {V <: AbstractArray}
Expand Down Expand Up @@ -70,7 +70,7 @@ end

function BallTree(data::AbstractVecOrMat{T},
metric::Metric = Euclidean();
leafsize::Int = 10,
leafsize::Int = 25,
storedata::Bool = true,
reorder::Bool = true,
reorderbuffer::Matrix{T} = Matrix{T}(undef, 0, 0)) where {T <: AbstractFloat}
Expand Down
6 changes: 3 additions & 3 deletions src/kd_tree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ end


"""
KDTree(data [, metric = Euclidean(); leafsize = 10, reorder = true]) -> kdtree
KDTree(data [, metric = Euclidean(); leafsize = 25, reorder = true]) -> kdtree
Creates a `KDTree` from the data using the given `metric` and `leafsize`.
The `metric` must be a `MinkowskiMetric`.
"""
function KDTree(data::AbstractVector{V},
metric::M = Euclidean();
leafsize::Int = 10,
leafsize::Int = 25,
storedata::Bool = true,
reorder::Bool = true,
reorderbuffer::Vector{V} = Vector{V}()) where {V <: AbstractArray, M <: MinkowskiMetric}
Expand Down Expand Up @@ -76,7 +76,7 @@ end

function KDTree(data::AbstractVecOrMat{T},
metric::M = Euclidean();
leafsize::Int = 10,
leafsize::Int = 25,
storedata::Bool = true,
reorder::Bool = true,
reorderbuffer::Matrix{T} = Matrix{T}(undef, 0, 0)) where {T <: AbstractFloat, M <: MinkowskiMetric}
Expand Down

0 comments on commit 1a5c45f

Please sign in to comment.