Skip to content

Commit f26abe6

Browse files
committed
minor enhancements
1 parent 5a49668 commit f26abe6

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

src/ParametricUtils.jl

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -790,20 +790,10 @@ Update the parametric solver data value and covariance.
790790
"""
791791
function updateSolverDataParametric! end
792792

793-
function updateSolverDataParametric!(
794-
v::DFGVariable,
795-
val::AbstractArray{<:Real},
796-
cov::Matrix;
797-
solveKey::Symbol = :parametric,
798-
)
799-
vnd = getSolverData(v, solveKey)
800-
return updateSolverDataParametric!(vnd, val, cov)
801-
end
802-
803793
function updateSolverDataParametric!(
804794
vnd::VariableNodeData,
805-
val::AbstractArray{<:Real},
806-
cov::Matrix,
795+
val::AbstractArray,
796+
cov::AbstractMatrix,
807797
)
808798
# fill in the variable node data value
809799
vnd.val[1] = val
@@ -812,6 +802,17 @@ function updateSolverDataParametric!(
812802
return vnd
813803
end
814804

805+
function updateSolverDataParametric!(
806+
v::DFGVariable,
807+
val::AbstractArray,
808+
cov::AbstractMatrix;
809+
solveKey::Symbol = :parametric,
810+
)
811+
vnd = getSolverData(v, solveKey)
812+
return updateSolverDataParametric!(vnd, val, cov)
813+
end
814+
815+
815816
"""
816817
$SIGNATURES
817818
Add parametric solver to fg, batch solve using [`solveGraphParametric`](@ref) and update fg.

src/services/FactorGraph.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ end
864864

865865
function DFG.addFactor!(
866866
dfg::AbstractDFG,
867-
xisyms::AbstractVector{Symbol},
867+
vlbs::AbstractVector{Symbol},
868868
usrfnc::AbstractFactor;
869869
suppressChecks::Bool = false,
870870
kw...,
@@ -873,11 +873,12 @@ function DFG.addFactor!(
873873

874874
# basic sanity check for unary vs n-ary
875875
if !suppressChecks
876-
_checkFactorAdd(usrfnc, xisyms)
876+
_checkFactorAdd(usrfnc, vlbs)
877+
@assert length(vlbs) == length(unique(vlbs)) "List of variables should be unique and ordered."
877878
end
878879

879-
# variables = getVariable.(dfg, xisyms)
880-
variables = map(vid -> getVariable(dfg, vid), xisyms)
880+
# variables = getVariable.(dfg, vlbs)
881+
variables = map(vid -> getVariable(dfg, vid), vlbs)
881882
return addFactor!(dfg, variables, usrfnc; suppressChecks = suppressChecks, kw...)
882883
end
883884

0 commit comments

Comments
 (0)