@@ -7,14 +7,20 @@ using SparseArrays
77# using Zygote
88
99# #
10- function getVarIntLabelMap (vartypeslist:: OrderedDict{DataType, Vector{Symbol}} )
10+ function getVarIntLabelMap (
11+ vartypeslist:: OrderedDict{DataType, Vector{Symbol}}
12+ )
1113 varlist_tuple = (values (vartypeslist)... ,)
1214 varlabelsAP = ArrayPartition {Symbol, typeof(varlist_tuple)} (varlist_tuple)
1315 varIntLabel = OrderedDict (zip (varlabelsAP, collect (1 : length (varlabelsAP))))
1416 return varIntLabel, varlabelsAP
1517end
1618
17- function CalcFactorResidual (fg, fct:: DFGFactor , varIntLabel)
19+ function CalcFactorResidual (
20+ fg,
21+ fct:: DFGFactor ,
22+ varIntLabel
23+ )
1824 fac_func = getFactorType (fct)
1925 varOrder = getVariableOrder (fct)
2026
4551 CalcFactorResidualAP
4652Create an `ArrayPartition` of `CalcFactorResidual`s.
4753"""
48- function CalcFactorResidualAP (fg:: GraphsDFG , factorLabels:: Vector{Symbol} , varIntLabel:: OrderedDict{Symbol, Int64} )
54+ function CalcFactorResidualAP (
55+ fg:: GraphsDFG ,
56+ factorLabels:: Vector{Symbol} ,
57+ varIntLabel:: OrderedDict{Symbol, Int64}
58+ )
4959 factypes, typedict, alltypes = getFactorTypesCount (getFactor .(fg, factorLabels))
5060
5161 # skip non-numeric prior (MetaPrior)
@@ -300,6 +310,7 @@ function solve_RLM(
300310 faclabels = lsf (fg);
301311 is_sparse = true ,
302312 finiteDiffCovariance = false ,
313+ solveKey:: Symbol = :parametric ,
303314 kwargs...
304315)
305316
@@ -312,7 +323,7 @@ function solve_RLM(
312323
313324 # Can use varIntLabel (because its an OrderedDict), but varLabelsAP makes the ArrayPartition.
314325 p0 = map (varlabelsAP) do label
315- getVal (fg, label, solveKey = :parametric )[1 ]
326+ getVal (fg, label; solveKey)[1 ]
316327 end
317328
318329 # create an ArrayPartition{CalcFactorResidual} for faclabels
@@ -389,6 +400,7 @@ function solve_RLM_conditional(
389400 separators:: Vector{Symbol} = setdiff (ls (fg), frontals);
390401 is_sparse= false ,
391402 finiteDiffCovariance= true ,
403+ solveKey:: Symbol = :parametric ,
392404 kwargs...
393405)
394406 is_sparse && error (" Sparse solve_RLM_conditional not supported yet" )
@@ -420,7 +432,7 @@ function solve_RLM_conditional(
420432 all_varlabelsAP = ArrayPartition ((frontal_varlabelsAP. x... , separator_varlabelsAP. x... ))
421433
422434 all_points = map (all_varlabelsAP) do label
423- getVal (fg, label, solveKey = :parametric )[1 ]
435+ getVal (fg, label; solveKey)[1 ]
424436 end
425437
426438 p0 = ArrayPartition (all_points. x[1 : length (frontal_varlabelsAP. x)])
@@ -537,7 +549,7 @@ function autoinitParametric!(
537549 )
538550 )
539551 end
540- M, vartypeslist, lm_r, Σ = solve_RLM_conditional (dfg, [initme], initfrom; kwargs... )
552+ M, vartypeslist, lm_r, Σ = solve_RLM_conditional (dfg, [initme], initfrom; solveKey, kwargs... )
541553
542554 val = lm_r[1 ]
543555 vnd. val[1 ] = val
@@ -549,8 +561,8 @@ function autoinitParametric!(
549561 vnd. initialized = true
550562 # fill in ppe as mean
551563 Xc:: Vector{Float64} = collect (getCoordinates (getVariableType (xi), val))
552- ppe = MeanMaxPPE (:parametric , Xc, Xc, Xc)
553- getPPEDict (xi)[:parametric ] = ppe
564+ ppe = MeanMaxPPE (solveKey , Xc, Xc, Xc)
565+ getPPEDict (xi)[solveKey ] = ppe
554566
555567 result = vartypeslist, lm_r
556568
0 commit comments