Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new functions #272

Merged
merged 1 commit into from
May 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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