Skip to content

Commit

Permalink
Merge pull request #99 from JuliaRobotics/24Q1/enh/evaltypestab
Browse files Browse the repository at this point in the history
improve type stability in eval
  • Loading branch information
dehann authored Jan 22, 2024
2 parents 4a1950a + 2971229 commit 7efdf81
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/DualTree01.jl
Original file line number Diff line number Diff line change
Expand Up @@ -458,14 +458,13 @@ function evalAvgLogL(bd1::BallTreeDensity,

# TODO convert ind to a for loop to avoid memory allocation
ind = findall(L.==0.0)
ll = nothing
if sum(findall(x->x!=0, W[ind])) > 0
ll = if 0 < sum(findall(x->x!=0, W[ind]))
# println("evalAvgLogL -- in if")
ll=-Inf
-Inf
else
# println("evalAvgLogL -- in else")
L[ind] .= 1.0
ll = (log.(L)')*W
(log.(L)')*W
end
return ll
end
Expand Down

0 comments on commit 7efdf81

Please sign in to comment.