From 1899f513a60d843924401f57124c2e62f63ac3dc Mon Sep 17 00:00:00 2001 From: dehann Date: Mon, 8 Nov 2021 14:53:24 -0500 Subject: [PATCH] better selectFactorType --- src/DefaultNodeTypes.jl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/DefaultNodeTypes.jl b/src/DefaultNodeTypes.jl index db6b9a1d5..942f92373 100644 --- a/src/DefaultNodeTypes.jl +++ b/src/DefaultNodeTypes.jl @@ -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) ) +# \ No newline at end of file