Skip to content

Commit def496c

Browse files
committed
restore accumulateFactorMeans
1 parent b84a1f9 commit def496c

File tree

3 files changed

+44
-45
lines changed

3 files changed

+44
-45
lines changed

NEWS.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ The list below highlights major breaking changes, and please note that significa
2323
- Deprecate use of `getParametricMeasurement` and use `getMeasurementParametric` instead, and add `<:AbstractManifold` to API.
2424
- Deprecate use of `solveBinaryFactorParameteric`, instead use `solveFactorParameteric`.
2525
- Deprecating `approxConvBinary`, use `approxConvBelief` instead.
26-
- Deprecating `accumulateFactorChain`, use `approxConvBelief` instead.
2726

2827

2928
# Major changes in v0.24

src/Deprecated.jl

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -26,49 +26,6 @@ end
2626
##==============================================================================
2727

2828

29-
# """
30-
# $SIGNATURES
31-
32-
# Calculate both measured and predicted relative variable values, starting with `from` at zeros up to `to::Symbol`.
33-
34-
# Notes
35-
# - assume single variable separators only.
36-
37-
# DevNotes
38-
# - TODO better consolidate with [`approxConvBelief`](@ref) which can now also work with factor chains.
39-
# """
40-
# function accumulateFactorChain( dfg::AbstractDFG,
41-
# from::Symbol,
42-
# to::Symbol,
43-
# fsyms::Vector{Symbol}=findFactorsBetweenNaive(dfg, from, to);
44-
# initval=zeros(size(getVal(dfg, from))))
45-
46-
# # get associated variables
47-
# svars = union(ls.(dfg, fsyms)...)
48-
49-
# # use subgraph copys to do calculations
50-
# tfg_meas = buildSubgraph(dfg, [svars;fsyms])
51-
# tfg_pred = buildSubgraph(dfg, [svars;fsyms])
52-
53-
# # drive variable values manually to ensure no additional stochastics are introduced.
54-
# nextvar = from
55-
# initManual!(tfg_meas, nextvar, initval)
56-
# initManual!(tfg_pred, nextvar, initval)
57-
58-
# # nextfct = fsyms[1] # for debugging
59-
# for nextfct in fsyms
60-
# nextvars = setdiff(ls(tfg_meas,nextfct),[nextvar])
61-
# @assert length(nextvars) == 1 "accumulateFactorChain requires each factor pair to separated by a single variable"
62-
# nextvar = nextvars[1]
63-
# meas, pred = approxDeconv(dfg, nextfct) # solveFactorMeasurements
64-
# pts_meas = approxConv(tfg_meas, nextfct, nextvar, (meas,ones(Int,100),collect(1:100)))
65-
# pts_pred = approxConv(tfg_pred, nextfct, nextvar, (pred,ones(Int,100),collect(1:100)))
66-
# initManual!(tfg_meas, nextvar, pts_meas)
67-
# initManual!(tfg_pred, nextvar, pts_pred)
68-
# end
69-
# return getVal(tfg_meas,nextvar), getVal(tfg_pred,nextvar)
70-
# end
71-
7229

7330
# # TODO should this be consolidated with regular approxConv?
7431
# # TODO, perhaps pass Xi::Vector{DFGVariable} instead?

src/services/ApproxConv.jl

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
export calcFactorResidual
3-
3+
export accumulateFactorChain
44

55

66
function approxConvBelief(dfg::AbstractDFG,
@@ -299,5 +299,48 @@ end
299299

300300

301301

302+
"""
303+
$SIGNATURES
304+
305+
Calculate both measured and predicted relative variable values, starting with `from` at zeros up to `to::Symbol`.
306+
307+
Notes
308+
- assume single variable separators only.
309+
310+
DevNotes
311+
- TODO better consolidate with [`approxConvBelief`](@ref) which can now also work with factor chains.
312+
"""
313+
function accumulateFactorChain( dfg::AbstractDFG,
314+
from::Symbol,
315+
to::Symbol,
316+
fsyms::Vector{Symbol}=findFactorsBetweenNaive(dfg, from, to);
317+
initval=zeros(size(getVal(dfg, from))))
318+
319+
# get associated variables
320+
svars = union(ls.(dfg, fsyms)...)
321+
322+
# use subgraph copys to do calculations
323+
tfg_meas = buildSubgraph(dfg, [svars;fsyms])
324+
tfg_pred = buildSubgraph(dfg, [svars;fsyms])
325+
326+
# drive variable values manually to ensure no additional stochastics are introduced.
327+
nextvar = from
328+
initManual!(tfg_meas, nextvar, initval)
329+
initManual!(tfg_pred, nextvar, initval)
330+
331+
# nextfct = fsyms[1] # for debugging
332+
for nextfct in fsyms
333+
nextvars = setdiff(ls(tfg_meas,nextfct),[nextvar])
334+
@assert length(nextvars) == 1 "accumulateFactorChain requires each factor pair to separated by a single variable"
335+
nextvar = nextvars[1]
336+
meas, pred = approxDeconv(dfg, nextfct) # solveFactorMeasurements
337+
pts_meas = approxConv(tfg_meas, nextfct, nextvar, (meas,ones(Int,100),collect(1:100)))
338+
pts_pred = approxConv(tfg_pred, nextfct, nextvar, (pred,ones(Int,100),collect(1:100)))
339+
initManual!(tfg_meas, nextvar, pts_meas)
340+
initManual!(tfg_pred, nextvar, pts_pred)
341+
end
342+
return getVal(tfg_meas,nextvar), getVal(tfg_pred,nextvar)
343+
end
344+
302345

303346
#

0 commit comments

Comments
 (0)