@@ -19,12 +19,12 @@ $(TYPEDFIELDS)
19
19
mutable struct VariableNodeData{T<: InferenceVariable , P}
20
20
val:: Vector{P}
21
21
bw:: Vector{Vector{Float64}}
22
- BayesNetOutVertIDs:: Array {Symbol,1 }
23
- dimIDs:: Array {Int,1 } # Likely deprecate
22
+ BayesNetOutVertIDs:: Vector {Symbol}
23
+ dimIDs:: Vector {Int} # Likely deprecate
24
24
dims:: Int
25
25
eliminated:: Bool
26
26
BayesNetVertID:: Symbol # Union{Nothing, }
27
- separator:: Array {Symbol,1 }
27
+ separator:: Vector {Symbol}
28
28
variableType:: T
29
29
initialized:: Bool
30
30
inferdim:: Float64
@@ -34,13 +34,14 @@ mutable struct VariableNodeData{T<:InferenceVariable, P}
34
34
solvedCount:: Int
35
35
solveKey:: Symbol
36
36
events:: Dict{Symbol,Threads.Condition}
37
- VariableNodeData {T} (; solveKey:: Symbol = :default ) where {T <: InferenceVariable } =
38
- new {T,Vector{Vector{Float64}}} ([[ 0.0 ;];], [[ 0.0 ;];] , Symbol[], Int[], 0 , false , :NOTHING , Symbol[], T (), false , 0.0 , false , false , 0 , 0 , solveKey, Dict {Symbol,Threads.Condition} ())
39
- VariableNodeData {T} (val:: Vector{P} ,
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
40
bw:: Vector{Vector{Float64}} ,
41
- BayesNetOutVertIDs:: Array{Symbol,1} ,
42
- dimIDs:: Array{Int,1} ,
43
- dims:: Int ,eliminated:: Bool ,
41
+ BayesNetOutVertIDs:: AbstractVector{Symbol} ,
42
+ dimIDs:: AbstractVector{Int} ,
43
+ dims:: Int ,
44
+ eliminated:: Bool ,
44
45
BayesNetVertID:: Symbol ,
45
46
separator:: Array{Symbol,1} ,
46
47
variableType:: T ,
@@ -51,7 +52,7 @@ mutable struct VariableNodeData{T<:InferenceVariable, P}
51
52
solveInProgress:: Int = 0 ,
52
53
solvedCount:: Int = 0 ,
53
54
solveKey:: Symbol = :default ,
54
- events:: Dict{Symbol,Threads.Condition} = Dict {Symbol,Threads.Condition} ()) where {T <: InferenceVariable , P, B } =
55
+ events:: Dict{Symbol,Threads.Condition} = Dict {Symbol,Threads.Condition} ()) where {T <: InferenceVariable , P} =
55
56
new {T,P} ( val,bw,BayesNetOutVertIDs,dimIDs,dims,
56
57
eliminated,BayesNetVertID,separator,
57
58
variableType,initialized,inferdim,ismargin,
61
62
# #------------------------------------------------------------------------------
62
63
# # Constructors
63
64
65
+ #
66
+
64
67
VariableNodeData (val:: Vector{P} ,
65
68
bw:: Vector{Vector{Float64}} ,
66
- BayesNetOutVertIDs:: Array{Symbol,1} ,
67
- dimIDs:: Array{Int,1} ,
68
- dims:: Int ,eliminated:: Bool ,
69
+ BayesNetOutVertIDs:: AbstractVector{Symbol} ,
70
+ dimIDs:: AbstractVector{Int} ,
71
+ dims:: Int ,
72
+ eliminated:: Bool ,
69
73
BayesNetVertID:: Symbol ,
70
- separator:: Array {Symbol,1 } ,
74
+ separator:: AbstractVector {Symbol} ,
71
75
variableType:: T ,
72
76
initialized:: Bool ,
73
77
inferdim:: Float64 ,
@@ -77,15 +81,25 @@ VariableNodeData(val::Vector{P},
77
81
solvedCount:: Int = 0 ,
78
82
solveKey:: Symbol = :default
79
83
) where {T <: InferenceVariable , P} =
80
- VariableNodeData {T,P} ( val,bw,BayesNetOutVertIDs,dimIDs,dims,
84
+ VariableNodeData {T} ( val,bw,BayesNetOutVertIDs,dimIDs,dims,
81
85
eliminated,BayesNetVertID,separator,
82
86
variableType,initialized,inferdim,ismargin,
83
87
dontmargin, solveInProgress, solvedCount,
84
- solveKey)
85
-
86
-
87
- VariableNodeData (variableType:: T ; solveKey:: Symbol = :default ) where T <: InferenceVariable =
88
- VariableNodeData {T,Vector{getPointType(T)}} ([[0.0 ;];], [[0.0 ;];], Symbol[], Int[], 0 , false , :NOTHING , Symbol[], variableType, false , 0.0 , false , false , 0 , 0 , solveKey)
88
+ solveKey )
89
+ #
90
+
91
+ function VariableNodeData (variableType:: T ; solveKey:: Symbol = :default ) where T <: InferenceVariable
92
+ #
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))
98
+ VariableNodeData ( P0, BW, Symbol[], Int[],
99
+ 0 , false , :NOTHING , Symbol[],
100
+ variableType, false , 0.0 , false ,
101
+ false , 0 , 0 , solveKey )
102
+ end
89
103
90
104
# #==============================================================================
91
105
# # PackedVariableNodeData.jl
0 commit comments