Skip to content

Commit d68426d

Browse files
committed
add GFND.nullhypo::Float64,
to persist nullhypo factor data
1 parent cdcc0dd commit d68426d

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

src/entities/DFGFactor.jl

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,30 @@ mutable struct GenericFunctionNodeData{T<:Union{PackedInferenceType, FunctorInfe
3939
potentialused::Bool
4040
edgeIDs::Vector{Int}
4141
fnc::T
42-
multihypo::Vector{Float64} # FIXME likely to moved when GenericWrapParam is refactored #477
42+
multihypo::Vector{Float64} # TODO re-evaluate after refactoring w #477
4343
certainhypo::Vector{Int}
44+
nullhypo::Float64
4445
solveInProgress::Int
46+
47+
# TODO deprecate all these inner constructors at end of DFG v0.9.x (was added for GFND.nullhypo::Float64 breaking change)
48+
GenericFunctionNodeData{T}() where T = new{T}()
49+
GenericFunctionNodeData{T}(el,po,ed,fn,mu::Vector{<:Real},ce::Vector{Int},so::Int) where T = new{T}(el,po,ed,fn,mu,ce,0.0,so)
50+
GenericFunctionNodeData{T}(el,po,ed,fn,mu::Vector{<:Real},ce::Vector{Int},nu::Real,so::Int) where T = new{T}(el,po,ed,fn,mu,ce,nu,so)
4551
end
4652

4753
## Constructors
4854

4955
GenericFunctionNodeData{T}() where T =
50-
GenericFunctionNodeData{T}(false, false, Int[], T(), Float64[], Int[], 0)
56+
GenericFunctionNodeData{T}(false, false, Int[], T(), Float64[], Int[], 0, 0)
5157

52-
function GenericFunctionNodeData(eliminated,
53-
potentialused,
54-
edgeIDs,
58+
function GenericFunctionNodeData(eliminated::Bool,
59+
potentialused::Bool,
60+
edgeIDs::Vector{Int},
5561
fnc,
56-
multihypo=Float64[],
57-
certainhypo=Int[])
58-
return GenericFunctionNodeData(eliminated, potentialused, edgeIDs, fnc, multihypo, certainhypo, 0)
62+
multihypo::Vector{<:Real}=Float64[],
63+
certainhypo::Vector{Int}=Int[],
64+
nullhypo::Real=0)
65+
return GenericFunctionNodeData(eliminated, potentialused, edgeIDs, fnc, multihypo, certainhypo, nullhypo, 0)
5966
end
6067

6168

src/services/CompareUtils.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ function compare(a::GenericFunctionNodeData{T1},b::GenericFunctionNodeData{T2})
217217
TP = TP && a.potentialused == b.potentialused
218218
TP = TP && a.edgeIDs == b.edgeIDs
219219
# TP = TP && typeof(a.fnc) == typeof(b.fnc)
220+
TP = TP && (a.multihypo - b.multihypo |> norm < 1e-10)
221+
TP = TP && a.certainhypo == b.certainhypo
222+
TP = TP && a.nullhypo == b.nullhypo
223+
TP = TP && a.solveInProgress == b.solveInProgress
220224
return TP
221225
end
222226

test/testBlocks.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ function testGroup!(fg, v1, v2, f0, f1)
899899
@test issetequal(ls(fg, tags=[:POSE, :LANDMARK]), ls(fg, tags=[:VARIABLE]))
900900

901901
@test lsf(fg, tags=[:NONE]) == []
902-
@test lsf(fg, tags=[:PRIOR]) == [:af1]
902+
@test lsf(fg, tags=[:PRIOR]) == [:af1]
903903

904904
# Regexes
905905
@test ls(fg, r"a") == [v1.label]
@@ -1050,7 +1050,7 @@ function connectivityTestGraph(::Type{T}; VARTYPE=DFGVariable, FACTYPE=DFGFactor
10501050
setSolvable!(dfg, :x8, 0)
10511051
setSolvable!(dfg, :x9, 0)
10521052

1053-
gfnd = GenericFunctionNodeData(true, true, Int[], TestCCW(TestFunctorInferenceType1()), Float64[], Int[], 1)
1053+
gfnd = GenericFunctionNodeData(true, true, Int[], TestCCW(TestFunctorInferenceType1()), Float64[], Int[], 0, 1)
10541054
f_tags = Set([:FACTOR])
10551055
# f1 = DFGFactor(f1_lbl, [:a,:b], gfnd, tags = f_tags)
10561056

0 commit comments

Comments
 (0)