Skip to content

Commit

Permalink
Fix a missing initialization with zeros in kd-tree lookup (#9)
Browse files Browse the repository at this point in the history
Since d856431, inconsistencies between the stored delta vector and its 
norm will propagate, so they need to be initialized consistently.
  • Loading branch information
martinholters committed Nov 29, 2019
1 parent dba54b3 commit 3b7e9d5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/kdtree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ mutable struct Alts{T}
end

Alts(p::Vector{T}) where {T} =
Alts([AltEntry(1, Vector{T}(undef, length(p)), zero(T))], typemax(T), 0, 1)
Alts([AltEntry(1, zeros(T, length(p)), zero(T))], typemax(T), 0, 1)

function init!(alts::Alts{T}, best_dist, best_pidx) where {T}
alts.number_valid = 1
Expand Down

0 comments on commit 3b7e9d5

Please sign in to comment.