@@ -21,47 +21,77 @@ mutable struct VariableNodeData{T<:InferenceVariable, P}
21
21
bw:: Vector{Vector{Float64}}
22
22
BayesNetOutVertIDs:: Vector{Symbol}
23
23
dimIDs:: Vector{Int} # Likely deprecate
24
+
24
25
dims:: Int
25
26
eliminated:: Bool
26
27
BayesNetVertID:: Symbol # Union{Nothing, }
27
28
separator:: Vector{Symbol}
29
+
28
30
variableType:: T
29
31
initialized:: Bool
30
32
inferdim:: Float64
31
33
ismargin:: Bool
34
+
32
35
dontmargin:: Bool
33
36
solveInProgress:: Int
34
37
solvedCount:: Int
35
38
solveKey:: Symbol
39
+
36
40
events:: Dict{Symbol,Threads.Condition}
37
- VariableNodeData {T,P} (; solveKey:: Symbol = :default ) where {T <: InferenceVariable , P} =
38
- new {T,getPointType(T)} (Vector {getPointType(T)} (undef, 1 ), Vector {Vector{Float64}} (undef,1 ), Symbol[], Int[], 0 , false , :NOTHING , Symbol[], T (), false , 0.0 , false , false , 0 , 0 , solveKey, Dict {Symbol,Threads.Condition} ())
39
- VariableNodeData {T,P} (val:: Vector{P} ,
40
- bw:: Vector{Vector{Float64}} ,
41
- BayesNetOutVertIDs:: AbstractVector{Symbol} ,
42
- dimIDs:: AbstractVector{Int} ,
43
- dims:: Int ,
44
- eliminated:: Bool ,
45
- BayesNetVertID:: Symbol ,
46
- separator:: Array{Symbol,1} ,
47
- variableType:: T ,
48
- initialized:: Bool ,
49
- inferdim:: Float64 ,
50
- ismargin:: Bool ,
51
- dontmargin:: Bool ,
52
- solveInProgress:: Int = 0 ,
53
- solvedCount:: Int = 0 ,
54
- solveKey:: Symbol = :default ,
55
- events:: Dict{Symbol,Threads.Condition} = Dict {Symbol,Threads.Condition} ()) where {T <: InferenceVariable , P} =
56
- new {T,P} ( val,bw,BayesNetOutVertIDs,dimIDs,dims,
57
- eliminated,BayesNetVertID,separator,
58
- variableType,initialized,inferdim,ismargin,
59
- dontmargin, solveInProgress, solvedCount, solveKey, events)
41
+
42
+ # VariableNodeData{T,P}() = new{T,P}()
43
+ VariableNodeData {T,P} (w... ) where {T <: InferenceVariable , P} = new {T,P} (w... )
44
+ VariableNodeData {T,P} (;solveKey:: Symbol = :default ) where {T <: InferenceVariable , P} = new {T,P} (
45
+ Vector {P} (),
46
+ Vector {Vector{Float64}} (),
47
+ Symbol[],
48
+ Int[],
49
+ 0 ,
50
+ false ,
51
+ :NOTHING ,
52
+ Symbol[],
53
+ T (),
54
+ false ,
55
+ 0.0 ,
56
+ false ,
57
+ false ,
58
+ 0 ,
59
+ 0 ,
60
+ solveKey,
61
+ Dict {Symbol,Threads.Condition} () )
62
+ #
60
63
end
61
64
62
65
# #------------------------------------------------------------------------------
63
66
# # Constructors
64
67
68
+ VariableNodeData {T} (;solveKey:: Symbol = :default ) where T <: InferenceVariable = VariableNodeData {T, getPointType(T)} (solveKey= solveKey)
69
+
70
+ VariableNodeData ( val:: Vector{P} ,
71
+ bw:: Vector{Vector{Float64}} ,
72
+ BayesNetOutVertIDs:: AbstractVector{Symbol} ,
73
+ dimIDs:: AbstractVector{Int} ,
74
+ dims:: Int ,
75
+ eliminated:: Bool ,
76
+ BayesNetVertID:: Symbol ,
77
+ separator:: Array{Symbol,1} ,
78
+ variableType:: T ,
79
+ initialized:: Bool ,
80
+ inferdim:: Float64 ,
81
+ ismargin:: Bool ,
82
+ dontmargin:: Bool ,
83
+ solveInProgress:: Int = 0 ,
84
+ solvedCount:: Int = 0 ,
85
+ solveKey:: Symbol = :default ,
86
+ events:: Dict{Symbol,Threads.Condition} = Dict {Symbol,Threads.Condition} ()
87
+ ) where {T <: InferenceVariable , P} = VariableNodeData {T,P} (
88
+ val,bw,BayesNetOutVertIDs,dimIDs,dims,
89
+ eliminated,BayesNetVertID,separator,
90
+ variableType,initialized,inferdim,ismargin,
91
+ dontmargin, solveInProgress, solvedCount, solveKey, events )
92
+ #
93
+
94
+
65
95
#
66
96
67
97
VariableNodeData (val:: Vector{P} ,
@@ -81,7 +111,7 @@ VariableNodeData(val::Vector{P},
81
111
solvedCount:: Int = 0 ,
82
112
solveKey:: Symbol = :default
83
113
) where {T <: InferenceVariable , P} =
84
- VariableNodeData {T} ( val,bw,BayesNetOutVertIDs,dimIDs,dims,
114
+ VariableNodeData {T,P } ( val,bw,BayesNetOutVertIDs,dimIDs,dims,
85
115
eliminated,BayesNetVertID,separator,
86
116
variableType,initialized,inferdim,ismargin,
87
117
dontmargin, solveInProgress, solvedCount,
@@ -90,11 +120,11 @@ VariableNodeData(val::Vector{P},
90
120
91
121
function VariableNodeData (variableType:: T ; solveKey:: Symbol = :default ) where T <: InferenceVariable
92
122
#
93
- p0 = getPointIdentity (T)
94
- P0 = Vector {getPointType(T)} (undef, 1 )
95
- P0[1 ] = p0
96
- BW = Vector {Vector{Float64}} (undef, 1 )
97
- BW[1 ] = zeros (getDimension (T))
123
+ # p0 = getPointIdentity(T)
124
+ P0 = Vector {getPointType(T)} ()
125
+ # P0[1] = p0
126
+ BW = Vector {Vector{Float64}} ()
127
+ # BW[1] = zeros(getDimension(T))
98
128
VariableNodeData ( P0, BW, Symbol[], Int[],
99
129
0 , false , :NOTHING , Symbol[],
100
130
variableType, false , 0.0 , false ,
@@ -251,7 +281,7 @@ struct DFGVariable{T<:InferenceVariable} <: AbstractDFGVariable
251
281
ppeDict:: Dict{Symbol, <: AbstractPointParametricEst}
252
282
""" Dictionary of solver data. May be a subset of all solutions if a solver key was specified in the get call.
253
283
Accessors: [`addVariableSolverData!`](@ref), [`updateVariableSolverData!`](@ref), and [`deleteVariableSolverData!`](@ref)"""
254
- solverDataDict:: Dict{Symbol, VariableNodeData{T}}
284
+ solverDataDict:: Dict{Symbol, <: VariableNodeData{T}}
255
285
""" Dictionary of small data associated with this variable.
256
286
Accessors: [`getSmallData`](@ref), [`setSmallData!`](@ref)"""
257
287
smallData:: Dict{Symbol, SmallDataTypes}
@@ -275,10 +305,10 @@ function DFGVariable(label::Symbol, variableType::T;
275
305
nstime:: Nanosecond = Nanosecond (0 ),
276
306
tags:: Set{Symbol} = Set {Symbol} (),
277
307
estimateDict:: Dict{Symbol, <: AbstractPointParametricEst} = Dict {Symbol, MeanMaxPPE} (),
278
- solverDataDict:: Dict{Symbol, VariableNodeData{T}} = Dict {Symbol, VariableNodeData{T}} (),
308
+ solverDataDict:: Dict{Symbol, VariableNodeData{T,P }} = Dict {Symbol, VariableNodeData{T,getPointType(T) }} (),
279
309
smallData:: Dict{Symbol, SmallDataTypes} = Dict {Symbol, SmallDataTypes} (),
280
310
dataDict:: Dict{Symbol, AbstractDataEntry} = Dict {Symbol,AbstractDataEntry} (),
281
- solvable:: Int = 1 ) where {T <: InferenceVariable }
311
+ solvable:: Int = 1 ) where {T <: InferenceVariable , P }
282
312
283
313
if timestamp isa DateTime
284
314
DFGVariable {T} (label, ZonedDateTime (timestamp, localzone ()), nstime, tags, estimateDict, solverDataDict, smallData, dataDict, Ref (solvable))
@@ -294,12 +324,13 @@ function DFGVariable(label::Symbol,
294
324
tags:: Set{Symbol} = Set {Symbol} (),
295
325
estimateDict:: Dict{Symbol, <: AbstractPointParametricEst} = Dict {Symbol, MeanMaxPPE} (),
296
326
smallData:: Dict{Symbol, SmallDataTypes} = Dict {Symbol, SmallDataTypes} (),
297
- dataDict:: Dict{Symbol, AbstractDataEntry} = Dict {Symbol,AbstractDataEntry} (),
327
+ dataDict:: Dict{Symbol, <: AbstractDataEntry} = Dict {Symbol,AbstractDataEntry} (),
298
328
solvable:: Int = 1 ) where {T <: InferenceVariable }
329
+ #
299
330
if timestamp isa DateTime
300
- DFGVariable {T} (label, ZonedDateTime (timestamp, localzone ()), nstime, tags, estimateDict, Dict {Symbol, VariableNodeData{T}} (:default => solverData), smallData, dataDict, Ref (solvable))
331
+ DFGVariable {T} (label, ZonedDateTime (timestamp, localzone ()), nstime, tags, estimateDict, Dict {Symbol, VariableNodeData{T, getPointType(T) }} (:default => solverData), smallData, dataDict, Ref (solvable))
301
332
else
302
- DFGVariable {T} (label, timestamp, nstime, tags, estimateDict, Dict {Symbol, VariableNodeData{T}} (:default => solverData), smallData, dataDict, Ref (solvable))
333
+ DFGVariable {T} (label, timestamp, nstime, tags, estimateDict, Dict {Symbol, VariableNodeData{T, getPointType(T) }} (:default => solverData), smallData, dataDict, Ref (solvable))
303
334
end
304
335
end
305
336
0 commit comments