Skip to content

Commit 5cde903

Browse files
authored
add GFND.nullhypo::Float64 (#536)
* add GFND.nullhypo::Float64, to persist nullhypo factor data * bump v0.9.0 * try fix test failure * fix stackoverflow
1 parent 8dc2597 commit 5cde903

File tree

4 files changed

+24
-12
lines changed

4 files changed

+24
-12
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "DistributedFactorGraphs"
22
uuid = "b5cc3c7e-6572-11e9-2517-99fb8daf2f04"
3-
version = "0.8.1"
3+
version = "0.9.0"
44

55
[deps]
66
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

src/entities/DFGFactor.jl

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,31 @@ 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)
51-
52-
function GenericFunctionNodeData(eliminated,
53-
potentialused,
54-
edgeIDs,
55-
fnc,
56-
multihypo=Float64[],
57-
certainhypo=Int[])
58-
return GenericFunctionNodeData(eliminated, potentialused, edgeIDs, fnc, multihypo, certainhypo, 0)
56+
GenericFunctionNodeData{T}(false, false, Int[], T(), Float64[], Int[], 0, 0)
57+
58+
function GenericFunctionNodeData(eliminated::Bool,
59+
potentialused::Bool,
60+
edgeIDs::Vector{Int},
61+
fnc::T,
62+
multihypo::Vector{<:Real}=Float64[],
63+
certainhypo::Vector{Int}=Int[],
64+
nullhypo::Real=0,
65+
solveInP::Int=0) where T
66+
return GenericFunctionNodeData{T}(eliminated, potentialused, edgeIDs, fnc, multihypo, certainhypo, nullhypo, solveInP)
5967
end
6068

6169

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)