Skip to content

Commit

Permalink
Merge pull request #110 from JuliaRobotics/21Q3/upstream/calccovbasic
Browse files Browse the repository at this point in the history
add calcVariableCovarianceBasic, upstream from IIF
  • Loading branch information
dehann committed Jul 18, 2021
2 parents 62d8b04 + 94b5ea7 commit 421b898
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ApproxManifoldProducts"
uuid = "9bbbb610-88a1-53cd-9763-118ce10c1f89"
keywords = ["MM-iSAMv2", "SLAM", "inference", "sum-product", "belief-propagation", "nonparametric", "manifolds", "functional"]
version = "0.4.5"
version = "0.4.6"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand Down
3 changes: 2 additions & 1 deletion src/ApproxManifoldProducts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export
buildHybridManifoldCallbacks,
getKDEManifoldBandwidths,
manifoldProduct,
manikde!
manikde!,
calcVariableCovarianceBasic


# internal features not exported
Expand Down
14 changes: 14 additions & 0 deletions src/CommonUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,20 @@ function updateProductSample( dest::BallTreeDensity,
manikde!(pts, manifolds)
end

# Returns the covariance (square), not deviation
function calcVariableCovarianceBasic(M::AbstractManifold, ptsArr::Vector{P}) where P
#TODO double check the maths,. it looks like its working at least for groups
μ = mean(M, ptsArr)
Xcs = vee.(Ref(M), Ref(μ), log.(Ref(M), Ref(μ), ptsArr))
Σ = mean(Xcs .* transpose.(Xcs))
@debug "calcVariableCovarianceBasic" μ
@debug "calcVariableCovarianceBasic" Σ
# TODO don't know what to do here so keeping as before, #FIXME it will break
# a change between this and previous is that a full covariance matrix is returned
msst = Σ
msst_ = 0 < sum(1e-10 .< msst) ? maximum(msst) : 1.0
return msst_
end


# """
Expand Down

0 comments on commit 421b898

Please sign in to comment.