Skip to content

Commit

Permalink
Merge pull request #261 from JuliaRobotics/23Q4/perf/less_allocs
Browse files Browse the repository at this point in the history
Less allocs in resid2DLinear and faster mean
  • Loading branch information
dehann committed Oct 26, 2023
2 parents 6647e8e + 17bc3a8 commit ee044bd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/CommonUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@


function resid2DLinear(μ, mus, Lambdas; diffop::Function=-) # '-' exploits EuclideanManifold commutativity a-b = b-a
= broadcast(diffop, μ, mus) # mus .- μ ## μ .\ mus
# dμ = broadcast(diffop, μ, mus) # mus .- μ ## μ .\ mus
# @show round.(dμ, digits=4)
ret = sum( Lambdas.*dμ )
return ret
# ret = sum( Lambdas.*dμ )
r = map((mu, lam) -> diffop(μ[], mu) * lam, mus, Lambdas)
return sum(r)
end

function solveresid2DLinear!(res, x, mus, Lambdas; diffop::Function=-)::Nothing
Expand Down Expand Up @@ -71,7 +72,7 @@ function _getManifoldFullOrPart(mkd::ManifoldKernelDensity, aspartial::Bool=true
end

function Statistics.mean(mkd::ManifoldKernelDensity, aspartial::Bool=true; kwargs...)
return mean(_getManifoldFullOrPart(mkd,aspartial), getPoints(mkd, aspartial); kwargs...)
return mean(_getManifoldFullOrPart(mkd,aspartial), getPoints(mkd, aspartial), GeodesicInterpolation(); kwargs...)
end
"""
$SIGNATURES
Expand Down

0 comments on commit ee044bd

Please sign in to comment.