Skip to content

Commit

Permalink
Merge pull request #1643 from JuliaRobotics/22Q4/depr/rm_calcCovarian…
Browse files Browse the repository at this point in the history
…ceBasic

Cleanup calcCovarianceBasic
  • Loading branch information
Affie committed Dec 15, 2022
2 parents 32e32f5 + 2946255 commit 9685c9d
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/VariableStatistics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ function Statistics.cov(
return cov(getManifold(vartype), ptsArr; basis, kwargs...)
end

# To replace calcCovarianceBasic
function calcStdBasicSpread(vartype::InferenceVariable, ptsArr::Vector{P}) where {P}
σ = std(vartype, ptsArr)

Expand Down
2 changes: 0 additions & 2 deletions src/services/EvalFactor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ function calcVariableDistanceExpectedFractional(
)
#
if sfidx in certainidx
# msst_ = sqrt(calcCovarianceBasic(getManifold(ccwl.vartypes[sfidx]), ccwl.params[sfidx]))
msst_ = calcStdBasicSpread(ccwl.vartypes[sfidx](), ccwl.params[sfidx])
return kappa * msst_
end
Expand Down Expand Up @@ -473,7 +472,6 @@ function evalPotentialSpecific(

# view on elements marked for nullhypo
addEntrNH = view(addEntr, nhmask)
# spreadDist = spreadNH*sqrt(calcCovarianceBasic(mani, addEntr))
spreadDist = spreadNH * calcStdBasicSpread(getVariableType(Xi[sfidx]), addEntr)
# partials are treated differently
ipc = if !isPartial(ccwl) #ccwl.partial
Expand Down
2 changes: 1 addition & 1 deletion test/testSpecialOrthogonalMani.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ vnd = getVariableSolverData(fg, :x0)
@test all(is_point.(Ref(M), vnd.val))

points = sampleFactor(fg, :x0f1, 100)
IIF.calcCovarianceBasic(SpecialOrthogonal(3), points)
std(SpecialOrthogonal(3), points)

##
v1 = addVariable!(fg, :x1, SO3)
Expand Down
2 changes: 1 addition & 1 deletion test/testpartialconstraint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ X2 = getBelief(fg, :x2)
@test_broken isapprox(mean(X2), [-20;10], atol=0.01)

# check covariance is close too
@test 0 < AMP.calcCovarianceBasic(getManifold(X2), getPoints(X2))
@test 0 < var(getManifold(X2), getPoints(X2))

@cast pts[i,j] := pts_[j][i]
@test (Statistics.std(pts,dims=2)[1]-1.0) < 3.0
Expand Down

0 comments on commit 9685c9d

Please sign in to comment.