Skip to content

Commit

Permalink
Merge pull request #272 from JuliaRobotics/feature/reinitunmarg
Browse files Browse the repository at this point in the history
new functions
  • Loading branch information
dehann authored May 5, 2019
2 parents 268e6b4 + 333ec8d commit 89eafef
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/FGOSUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -774,4 +774,39 @@ Return `::Bool` on whether this variable has been marginalized.
isMarginalized(vert::Graphs.ExVertex) = getData(vert).ismargin
isMarginalized(fgl::FactorGraph, sym::Symbol; api::DataLayerAPI=localapi) = isMarginalized(getVert(fg, sym, api=api))



"""
$SIGNATURES
Free all variables from marginalization.
"""
function unmarginalizeVariablesAll!(fgl::FactorGraph)
fgl.isfixedlag = false
fgl.qfl = 9999999999
vsyms = union(ls(fgl)...)
for sym in vsyms
getData(fgl, sym).ismargin = false
end
nothing
end

"""
$SIGNATURES
Reset initialization flag on all variables in `::FactorGraphs`.
Notes
- Numerical values remain, but inference will overwrite since init flags are now `false`.
"""
function resetVariableAllInitializations!(fgl::FactorGraph)
vsyms = union(ls(fgl)...)
for sym in vsyms
getData(fgl, sym).initialized = false
end
nothing
end



#
2 changes: 2 additions & 0 deletions src/IncrementalInference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ export
localProduct,
treeProductUp,
approxCliqMarginalUp!,
unmarginalizeVariablesAll!,
resetVariableAllInitializations!,
isMarginalized,
isCliqMarginalizedFromVars,
isCliqParentNeedDownMsg,
Expand Down

0 comments on commit 89eafef

Please sign in to comment.