@@ -4,6 +4,7 @@ export isPrior, lsfPriors
4
4
export getData
5
5
export getVariableType, getSofttype
6
6
export getFactorType, getfnctype
7
+ export lsTypes, lsfTypes
7
8
8
9
9
10
"""
180
181
181
182
Return the DFGVariable softtype in factor graph `dfg<:AbstractDFG` and label `::Symbol`.
182
183
"""
183
- getVariableType (var:: DFGVariable ; solveKey:: Symbol = :default ) = getSofttype (var, solvekey = solveKey)
184
+ getVariableType (var:: DFGVariable ; solveKey:: Symbol = :default ) = getSofttype (var, solveKey = solveKey)
184
185
function getVariableType (dfg:: G , lbl:: Symbol ; solveKey:: Symbol = :default ) where G <: AbstractDFG
185
186
getVariableType (getVariable (dfg, lbl), solveKey= solveKey)
186
187
end
188
+
189
+
190
+ """
191
+ $SIGNATURES
192
+
193
+ Return `::Dict{Symbol, Vector{String}}` of all unique factor types in factor graph.
194
+ """
195
+ function lsfTypes (dfg:: G ):: Dict{Symbol, Vector{String}} where G <: AbstractDFG
196
+ alltypes = Dict {Symbol,Vector{String}} ()
197
+ for fc in lsf (dfg)
198
+ Tt = typeof (getFactorType (dfg, fc))
199
+ sTt = string (Tt)
200
+ name = Symbol (Tt. name)
201
+ if ! haskey (alltypes, name)
202
+ alltypes[name] = String[string (Tt)]
203
+ else
204
+ if sum (alltypes[name] .== sTt) == 0
205
+ push! (alltypes[name], sTt)
206
+ end
207
+ end
208
+ end
209
+ return alltypes
210
+ end
211
+
212
+ """
213
+ $SIGNATURES
214
+
215
+ Return `::Dict{Symbol, Vector{String}}` of all unique variable types in factor graph.
216
+ """
217
+ function lsTypes (dfg:: G ):: Dict{Symbol, Vector{String}} where G <: AbstractDFG
218
+ alltypes = Dict {Symbol,Vector{String}} ()
219
+ for fc in ls (dfg)
220
+ Tt = typeof (getVariableType (dfg, fc))
221
+ sTt = string (Tt)
222
+ name = Symbol (Tt. name)
223
+ if ! haskey (alltypes, name)
224
+ alltypes[name] = String[string (Tt)]
225
+ else
226
+ if sum (alltypes[name] .== sTt) == 0
227
+ push! (alltypes[name], sTt)
228
+ end
229
+ end
230
+ end
231
+ return alltypes
232
+ end
0 commit comments