Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get rid of unused code #98

Merged
merged 1 commit into from
Nov 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/NearestNeighbors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ export Euclidean,
Chebyshev,
Hamming

# Change this to enable debugging
const DEBUG = false

abstract type NNTree{V <: AbstractVector,P <: Metric} end

const MinkowskiMetric = Union{Euclidean,Chebyshev,Cityblock,Minkowski}
Expand All @@ -40,7 +37,6 @@ end
get_T(::Type{T}) where {T <: AbstractFloat} = T
get_T(::T) where {T} = Float64

include("debugging.jl")
include("evaluation.jl")
include("tree_data.jl")
include("datafreetree.jl")
Expand Down
2 changes: 0 additions & 2 deletions src/ball_tree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ function knn_kernel!(tree::BallTree{V},
best_idxs::Vector{Int},
best_dists::Vector,
skip::F) where {V, F}
@NODE 1
if isleaf(tree.tree_data.n_internal_nodes, index)
add_points_knn!(best_dists, best_idxs, tree, index, point, true, skip)
return
Expand Down Expand Up @@ -206,7 +205,6 @@ function inrange_kernel!(tree::BallTree,
point::AbstractVector,
query_ball::HyperSphere,
idx_in_ball::Vector{Int})
@NODE 1

if index > length(tree.hyper_spheres)
return
Expand Down
2 changes: 0 additions & 2 deletions src/brute_tree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ function knn_kernel!(tree::BruteTree{V},
continue
end

@POINT 1
dist_d = evaluate(tree.metric, tree.data[i], point)
if dist_d <= best_dists[1]
best_dists[1] = dist_d
Expand All @@ -74,7 +73,6 @@ function inrange_kernel!(tree::BruteTree,
r::Number,
idx_in_ball::Vector{Int})
for i in 1:length(tree.data)
@POINT 1
d = evaluate(tree.metric, tree.data[i], point)
if d <= r
push!(idx_in_ball, i)
Expand Down
42 changes: 0 additions & 42 deletions src/debugging.jl

This file was deleted.

10 changes: 0 additions & 10 deletions src/hyperrectangles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@ end
############################################
# Rectangle - Point functions
############################################
@inline function get_min_dim(rec::HyperRectangle, point::AbstractVector, dim::Int)
@inbounds d = abs2(max(0, max(rec.mins[dim] - point[dim], point[dim] - rec.maxes[dim])))
d
end

@inline function get_max_dim(rec::HyperRectangle, point::AbstractVector, dim::Int)
@inbounds d = abs2(max(rec.maxes[dim] - point[dim], point[dim] - rec.mins[dim]))
d
end

# Max distance between rectangle and point
@inline function get_max_distance(rec::HyperRectangle, point::AbstractVector{T}) where {T}
max_dist = zero(T)
Expand Down
2 changes: 0 additions & 2 deletions src/kd_tree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ function knn_kernel!(tree::KDTree{V},
best_dists::Vector,
min_dist,
skip::F) where {V, F}
@NODE 1
# At a leaf node. Go through all points in node and add those in range
if isleaf(tree.tree_data.n_internal_nodes, index)
add_points_knn!(best_dists, best_idxs, tree, index, point, false, skip)
Expand Down Expand Up @@ -223,7 +222,6 @@ function inrange_kernel!(tree::KDTree,
r::Number,
idx_in_ball::Vector{Int},
min_dist)
@NODE 1
# Point is outside hyper rectangle, skip the whole sub tree
if min_dist > r
return
Expand Down
4 changes: 0 additions & 4 deletions src/tree_ops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ end
tree::NNTree, index::Int, point::AbstractVector,
do_end::Bool, skip::F) where {F}
for z in get_leaf_range(tree.tree_data, index)
@POINT 1
idx = tree.reordered ? z : tree.indices[z]
dist_d = evaluate(tree.metric, tree.data[idx], point, do_end)
if dist_d <= best_dists[1]
Expand All @@ -118,7 +117,6 @@ end
@inline function add_points_inrange!(idx_in_ball::Vector{Int}, tree::NNTree,
index::Int, point::AbstractVector, r::Number, do_end::Bool)
for z in get_leaf_range(tree.tree_data, index)
@POINT 1
idx = tree.reordered ? z : tree.indices[z]
dist_d = evaluate(tree.metric, tree.data[idx], point, do_end)
if dist_d <= r
Expand All @@ -131,10 +129,8 @@ end
# they are all within the desired range
function addall(tree::NNTree, index::Int, idx_in_ball::Vector{Int})
tree_data = tree.tree_data
@NODE 1
if isleaf(tree.tree_data.n_internal_nodes, index)
for z in get_leaf_range(tree.tree_data, index)
@POINT_UNCHECKED 1
idx = tree.reordered ? z : tree.indices[z]
push!(idx_in_ball, idx)
end
Expand Down