@@ -7,14 +7,20 @@ using SparseArrays
7
7
# using Zygote
8
8
9
9
# #
10
- function getVarIntLabelMap (vartypeslist:: OrderedDict{DataType, Vector{Symbol}} )
10
+ function getVarIntLabelMap (
11
+ vartypeslist:: OrderedDict{DataType, Vector{Symbol}}
12
+ )
11
13
varlist_tuple = (values (vartypeslist)... ,)
12
14
varlabelsAP = ArrayPartition {Symbol, typeof(varlist_tuple)} (varlist_tuple)
13
15
varIntLabel = OrderedDict (zip (varlabelsAP, collect (1 : length (varlabelsAP))))
14
16
return varIntLabel, varlabelsAP
15
17
end
16
18
17
- function CalcFactorResidual (fg, fct:: DFGFactor , varIntLabel)
19
+ function CalcFactorResidual (
20
+ fg,
21
+ fct:: DFGFactor ,
22
+ varIntLabel
23
+ )
18
24
fac_func = getFactorType (fct)
19
25
varOrder = getVariableOrder (fct)
20
26
45
51
CalcFactorResidualAP
46
52
Create an `ArrayPartition` of `CalcFactorResidual`s.
47
53
"""
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
+ )
49
59
factypes, typedict, alltypes = getFactorTypesCount (getFactor .(fg, factorLabels))
50
60
51
61
# skip non-numeric prior (MetaPrior)
@@ -300,6 +310,7 @@ function solve_RLM(
300
310
faclabels = lsf (fg);
301
311
is_sparse = true ,
302
312
finiteDiffCovariance = false ,
313
+ solveKey:: Symbol = :parametric ,
303
314
kwargs...
304
315
)
305
316
@@ -312,7 +323,7 @@ function solve_RLM(
312
323
313
324
# Can use varIntLabel (because its an OrderedDict), but varLabelsAP makes the ArrayPartition.
314
325
p0 = map (varlabelsAP) do label
315
- getVal (fg, label, solveKey = :parametric )[1 ]
326
+ getVal (fg, label; solveKey)[1 ]
316
327
end
317
328
318
329
# create an ArrayPartition{CalcFactorResidual} for faclabels
@@ -389,6 +400,7 @@ function solve_RLM_conditional(
389
400
separators:: Vector{Symbol} = setdiff (ls (fg), frontals);
390
401
is_sparse= false ,
391
402
finiteDiffCovariance= true ,
403
+ solveKey:: Symbol = :parametric ,
392
404
kwargs...
393
405
)
394
406
is_sparse && error (" Sparse solve_RLM_conditional not supported yet" )
@@ -420,7 +432,7 @@ function solve_RLM_conditional(
420
432
all_varlabelsAP = ArrayPartition ((frontal_varlabelsAP. x... , separator_varlabelsAP. x... ))
421
433
422
434
all_points = map (all_varlabelsAP) do label
423
- getVal (fg, label, solveKey = :parametric )[1 ]
435
+ getVal (fg, label; solveKey)[1 ]
424
436
end
425
437
426
438
p0 = ArrayPartition (all_points. x[1 : length (frontal_varlabelsAP. x)])
@@ -537,7 +549,7 @@ function autoinitParametric!(
537
549
)
538
550
)
539
551
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... )
541
553
542
554
val = lm_r[1 ]
543
555
vnd. val[1 ] = val
@@ -549,8 +561,8 @@ function autoinitParametric!(
549
561
vnd. initialized = true
550
562
# fill in ppe as mean
551
563
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
554
566
555
567
result = vartypeslist, lm_r
556
568
0 commit comments