@@ -14,6 +14,36 @@ function _validate(dfg::DistributedFactorGraph)::Void
14
14
end
15
15
end
16
16
17
+ function getV (dfg:: DistributedFactorGraph , vId:: Int64 ):: DFGVariable
18
+ return DFGVariable (" x0" )
19
+ end
20
+
21
+ function getV (dfg:: DistributedFactorGraph , vLabel:: String ):: DFGVariable
22
+ _validate (dfg)
23
+ return DFGVariable (vLabel)
24
+ end
25
+
26
+ function getVs (dfg:: DistributedFactorGraph , regex:: String ):: Vector{DFGVariable}
27
+ _validate (dfg)
28
+ return [DFGVariable (" x0" )]
29
+ end
30
+
31
+ function getF (dfg:: DistributedFactorGraph , fId:: Int64 ):: DFGFactor
32
+ _validate (dfg)
33
+ return DFGFactor (fId, " x0f0" , [], GenericFunctionNodeData {Int64, Symbol} ())
34
+ end
35
+
36
+ function getF (dfg:: DistributedFactorGraph , fLabel:: String ):: DFGFactor
37
+ _validate (dfg)
38
+ return DFGFactor (1 , fLabel, [0 ], GenericFunctionNodeData {Int64, Symbol} ())
39
+ end
40
+
41
+ function getFs (dfg:: DistributedFactorGraph , regex:: String ):: Vector{DFGFactor}
42
+ _validate (dfg)
43
+ return [DFGFactor (" x0x1f0" , [0 , 1 ], GenericFunctionNodeData {Int64, Symbol} ())]
44
+ end
45
+
46
+
17
47
function addV! (dfg:: DistributedFactorGraph , v:: DFGVariable ):: DFGVariable
18
48
_validate (dfg)
19
49
# Principal
@@ -52,30 +82,44 @@ function addF!(dfg::DistributedFactorGraph, f::DFGFactor)::DFGFactor
52
82
return f
53
83
end
54
84
55
- function addF! (dfg:: DistributedFactorGraph , labelVariables:: Vector{Symbol} , factorFunc:: R ):: DFGFactor where {R <: Union{FunctorInferenceType, InferenceType} }
56
- variables = map (label -> gtV (dfg, label), labelVariables)
85
+ function parseusermultihypo (multihypo:: Union{Tuple,Vector{Float64}} )
86
+ mh = nothing
87
+ if multihypo != nothing
88
+ multihypo2 = Float64[multihypo... ]
89
+ # verts = Symbol.(multihypo[1,:])
90
+ for i in 1 : length (multihypo)
91
+ if multihypo[i] > 0.999999
92
+ multihypo2[i] = 0.0
93
+ end
94
+ end
95
+ mh = Categorical (Float64[multihypo2... ] )
96
+ end
97
+ return mh
98
+ end
99
+
100
+ function addF! (
101
+ dfg:: DistributedFactorGraph ,
102
+ labelVariables:: Vector{Symbol} ,
103
+ factorFunc:: R ;
104
+ multihypo:: Union{Nothing,Tuple,Vector{Float64}} = nothing ):: DFGFactor
105
+ where {R <: Union{FunctorInferenceType, InferenceType} }
106
+ variables = map (label -> getV (dfg, String (label)), labelVariables)
57
107
factName = _constructFactorName (dfg, labelVariables)
58
- f = DFGFactor (- 1 , factName, map (v -> v. id, variables), factorFunc)
59
- return f
60
- end
61
108
62
- function getV (vId:: Int64 ):: DFGVariable
63
- return DFGVariable (vId, " x0" , VariableNodeData (), Vector {String} (), Dict {String, Any} ())
64
- end
109
+ # Create the FunctionNodeData
110
+ ftyp = typeof (factorFunc) # maybe this can be T
111
+ # @show "setDefaultFactorNode!", usrfnc, ftyp, T
112
+ mhcat = parseusermultihypo (multihypo)
113
+ # gwpf = prepgenericwrapper(Xi, usrfnc, getSample, multihypo=mhcat)
114
+ ccw = prepgenericconvolution (Xi, usrfnc, multihypo= mhcat, threadmodel= threadmodel)
65
115
66
- function getV (d:: DFGAPI , vLabel:: String ):: DFGVariable
67
- _validate (dfg)
68
- return DFGVariable (0 , vLabel, VariableNodeData (), Vector {String} (), Dict {String, Any} ())
69
- end
116
+ m = Symbol (ftyp. name. module)
70
117
71
- function getF (d:: DFGAPI , fId:: Int64 ):: DFGFactor
72
- _validate (dfg)
73
- return DFGFactor (fId, " x0f0" , [], GenericFunctionNodeData {Int64, Symbol} ())
74
- end
118
+ # experimental wip
119
+ data_ccw = FunctionNodeData {CommonConvWrapper{T}} (Int[], false , false , Int[], m, ccw)
75
120
76
- function getF (d:: DFGAPI , fLabel:: String ):: DFGFactor
77
- _validate (dfg)
78
- return DFGFactor (1 , fLabel, [0 ], GenericFunctionNodeData {Int64, Symbol} ())
121
+ f = DFGFactor (- 1 , factName, map (v -> v. id, variables), data_ccw)
122
+ return f
79
123
end
80
124
81
125
function updateV! (d:: DFGAPI , v:: DFGVariable ):: DFGVariable
0 commit comments