Skip to content

Commit

Permalink
Merge pull request #1447 from JuliaRobotics/21Q4/refac/selfact
Browse files Browse the repository at this point in the history
better selectFactorType
  • Loading branch information
dehann authored Nov 8, 2021
2 parents 905a9f0 + 1899f51 commit 2dd4380
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/DefaultNodeTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
"""
$SIGNATURES
Hacky version to return which factor type to use between two variables of types T1 and T2.
Return a default factor type between two variables of types T1 and T2.
Pending work on RoME.jl #244 and IIF.jl #1010 and others, after which this will be refactored.
Notes
- Most likely used with deconvolution between target variables
"""
selectFactorType(T1::InstanceType{ContinuousScalar}, T2::InstanceType{ContinuousScalar}) = LinearRelative{1}
selectFactorType(Modl::Module, T1::Type{<:InferenceVariable}, T2::Type{<:InferenceVariable}) = getfield(Modl, Symbol(T1, T2))
selectFactorType(T1::Type{<:InferenceVariable}, T2::Type{<:InferenceVariable}) = selectFactorType(typeof(T1()).name.module, T1, T2)
selectFactorType(T1::Type{<:ContinuousScalar}, T2::Type{<:ContinuousScalar}) = LinearRelative{1}
selectFactorType(T1::Type{<:ContinuousEuclid{N}}, T2::Type{<:ContinuousEuclid{N}}) where N = LinearRelative{N}
selectFactorType(T1::InferenceVariable, T2::InferenceVariable) = selectFactorType(typeof(T1), typeof(T2))
selectFactorType(dfg::AbstractDFG, s1::Symbol, s2::Symbol) = selectFactorType( getVariableType(dfg, s1), getVariableType(dfg, s2) )

#

0 comments on commit 2dd4380

Please sign in to comment.