-
Notifications
You must be signed in to change notification settings - Fork 2
implement mergeVariableStates! #1145
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
base: develop
Are you sure you want to change the base?
Conversation
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
I think variable should also be plural, so |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1145 +/- ##
===========================================
+ Coverage 73.58% 73.71% +0.12%
===========================================
Files 28 28
Lines 2442 2450 +8
===========================================
+ Hits 1797 1806 +9
+ Misses 645 644 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
return sum(cnt) | ||
end | ||
|
||
function mergeVariableStates!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have expected the default implementation signature to be
function mergeState!(<:Variable, <:VariableState)
# actual implementation lives here
end
mergeState!(dfg::Factorgraph, lb::Symbol, state::VariableState) = mergeState!(getVariable(fg, lb), state)
mergeStates!(dfg::Factorgraph, ::Vector{<:Pair_}) = # pmap over vector mergeState!(dfg, pair[1], pair[2])
mergeVariableState!(w...;kw...) = mergeState!(w...;kw...) # alias
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mergeState!
is not consistent with the rest of the API as we have getVariableState
and therefore would expect mergeVariableState!
. We need the Variable
noun in get
explicit to avoid ambiguities, to have a type stable implementation in julia, and to help with SDKs without multiple dispatch. It also makes for more readable and maintainable code to be more explicit -- when updating from getSolverData
, it was a pain to distinguish between Variable and Factor. We can still do the alias, but that would likely be a DFG only function and not across SDKs. I would also not include [get/add/merge/delete]State[!]
for DFGv1 beta work.
Does the comment ... ::Vector{<:Pair_})
mean you are happy with the new signature, what I wanted to know form this PR?
I went back and forth on
mergeVariableStates!
and comparing it withupdateVariableNodeData!
and settled on following the verb by still providing a container. The same concept can be followed for all satellite levels (such asBlobentry
)@dehann would you mind giving your inputs.