22# # Abstract Types
33# #==============================================================================
44
5- abstract type AbstractFactor end
6- abstract type AbstractPackedFactor end
5+ abstract type AbstractPackedFactorObservation end
6+ abstract type AbstractFactorObservation end
77
8- abstract type AbstractPrior <: AbstractFactor end
9- abstract type AbstractRelative <: AbstractFactor end
8+ abstract type AbstractPrior <: AbstractFactorObservation end
9+ abstract type AbstractRelative <: AbstractFactorObservation end
1010abstract type AbstractRelativeMinimize <: AbstractRelative end
1111abstract type AbstractManifoldMinimize <: AbstractRelative end
1212
13- # NOTE DF, Convolution is IIF idea, but DFG should know about "FactorOperationalMemory "
14- # DF, IIF.CommonConvWrapper <: FactorOperationalMemory #
13+ # NOTE DF, Convolution is IIF idea, but DFG should know about "FactorSolverCache "
14+ # DF, IIF.CommonConvWrapper <: FactorSolverCache #
1515# NOTE was `<: Function` as unnecessary
16- abstract type FactorOperationalMemory end
16+ abstract type FactorSolverCache end
1717# TODO to be removed from DFG,
18- # we can add to IIF or have IIF.CommonConvWrapper <: FactorOperationalMemory directly
19- # abstract type ConvolutionObject <: FactorOperationalMemory end
18+ # we can add to IIF or have IIF.CommonConvWrapper <: FactorSolverCache directly
19+ # abstract type ConvolutionObject <: FactorSolverCache end
2020
2121# #==============================================================================
2222# # GenericFunctionNodeData
@@ -29,13 +29,13 @@ Notes
2929- S::Symbol
3030
3131Designing (WIP)
32- - T <: Union{FactorOperationalMemory, AbstractPackedFactor }
33- - in IIF.CCW{T <: DFG.AbstractFactor }
34- - in DFG.AbstractRelativeMinimize <: AbstractFactor
32+ - T <: Union{FactorSolverCache, AbstractPackedFactorObservation }
33+ - in IIF.CCW{T <: DFG.AbstractFactorObservation }
34+ - in DFG.AbstractRelativeMinimize <: AbstractFactorObservation
3535- in Main.SomeFactor <: AbstractRelativeMinimize
3636"""
3737Base. @kwdef mutable struct GenericFunctionNodeData{
38- T <: Union{<:AbstractPackedFactor , <:AbstractFactor , <:FactorOperationalMemory } ,
38+ T <: Union{<:AbstractPackedFactorObservation , <:AbstractFactorObservation , <:FactorSolverCache } ,
3939}
4040 eliminated:: Bool = false
4141 potentialused:: Bool = false
5959 inflation:: Float64 = 0.0
6060end
6161
62- # TODO should we move non FactorOperationalMemory to FactorCompute:
62+ # TODO should we move non FactorSolverCache to FactorCompute:
6363# fnc, multihypo, nullhypo, inflation ?
64- # that way we split solverData <: FactorOperationalMemory and constants
64+ # that way we split solverData <: FactorSolverCache and constants
6565# TODO see if above ever changes?
6666
6767# # Constructors
7070# # PackedFunctionNodeData and FunctionNodeData
7171
7272const PackedFunctionNodeData{T} =
73- GenericFunctionNodeData{T} where {T <: AbstractPackedFactor }
73+ GenericFunctionNodeData{T} where {T <: AbstractPackedFactorObservation }
7474function PackedFunctionNodeData (args... ; kw... )
7575 return PackedFunctionNodeData {typeof(args[4])} (args... ; kw... )
7676end
7777
7878const FunctionNodeData{T} = GenericFunctionNodeData{
7979 T,
80- } where {T <: Union{<:AbstractFactor , <:FactorOperationalMemory } }
80+ } where {T <: Union{<:AbstractFactorObservation , <:FactorSolverCache } }
8181FunctionNodeData (args... ; kw... ) = FunctionNodeData {typeof(args[4])} (args... ; kw... )
8282
83- # PackedFunctionNodeData(x2, x3, x4, x6::T, multihypo::Vector{Float64}=[], certainhypo::Vector{Int}=Int[], x9::Int=0) where T <: AbstractPackedFactor =
83+ # PackedFunctionNodeData(x2, x3, x4, x6::T, multihypo::Vector{Float64}=[], certainhypo::Vector{Int}=Int[], x9::Int=0) where T <: AbstractPackedFactorObservation =
8484# GenericFunctionNodeData{T}(x2, x3, x4, x6, multihypo, certainhypo, x9)
85- # FunctionNodeData(x2, x3, x4, x6::T, multihypo::Vector{Float64}=[], certainhypo::Vector{Int}=Int[], x9::Int=0) where T <: Union{AbstractFactor, FactorOperationalMemory } =
85+ # FunctionNodeData(x2, x3, x4, x6::T, multihypo::Vector{Float64}=[], certainhypo::Vector{Int}=Int[], x9::Int=0) where T <: Union{AbstractFactorObservation, FactorSolverCache } =
8686# GenericFunctionNodeData{T}(x2, x3, x4, x6, multihypo, certainhypo, x9)
8787
8888# #==============================================================================
@@ -183,24 +183,24 @@ $(TYPEDEF)
183183Abstract parent type for all InferenceTypes, which are the
184184observation functions inside of factors.
185185"""
186- abstract type InferenceType <: AbstractPackedFactor end
186+ abstract type InferenceType <: AbstractPackedFactorObservation end
187187
188- # TODO deprecate InferenceType in favor of AbstractPackedFactor v0.26
188+ # TODO deprecate InferenceType in favor of AbstractPackedFactorObservation v0.26
189189
190190# this is the GenericFunctionNodeData for packed types
191191# TODO deprecate FactorData in favor of FactorState (with no more distinction between packed and compute)
192- const FactorData = PackedFunctionNodeData{AbstractPackedFactor }
192+ const FactorData = PackedFunctionNodeData{AbstractPackedFactorObservation }
193193
194194# Packed Factor constructor
195195function assembleFactorName (xisyms:: Union{Vector{String}, Vector{Symbol}} )
196196 return Symbol (xisyms... , " _f" , randstring (4 ))
197197end
198198
199- getFncTypeName (fnc:: AbstractPackedFactor ) = split (string (typeof (fnc)), " ." )[end ]
199+ getFncTypeName (fnc:: AbstractPackedFactorObservation ) = split (string (typeof (fnc)), " ." )[end ]
200200
201201function FactorDFG (
202202 xisyms:: Vector{Symbol} ,
203- fnc:: AbstractPackedFactor ;
203+ fnc:: AbstractPackedFactorObservation ;
204204 multihypo:: Vector{Float64} = Float64[],
205205 nullhypo:: Float64 = 0.0 ,
206206 solvable:: Int = 1 ,
@@ -249,7 +249,7 @@ DevNotes
249249Fields:
250250$(TYPEDFIELDS)
251251"""
252- Base. @kwdef struct FactorCompute{FT <: AbstractFactor , N} <: AbstractDFGFactor
252+ Base. @kwdef struct FactorCompute{FT <: AbstractFactorObservation , N} <: AbstractDFGFactor
253253 """ The ID for the factor"""
254254 id:: Union{UUID, Nothing} = nothing # TODO deprecate id
255255 """ Factor label, e.g. :x1f1.
@@ -281,9 +281,9 @@ Base.@kwdef struct FactorCompute{FT <: AbstractFactor, N} <: AbstractDFGFactor
281281 Accessors: [`getFactorState`](@ref)"""
282282 state:: FactorState
283283 """ Temporary, non-persistent memory used internally by the solver for intermediate numerical computations and buffers.
284- `workmem ` is lazily allocated and only used during factor operations; it is not serialized or retained after solving.
285- Accessors: [`getWorkmem `](@ref), [`setWorkmem !`](@ref)"""
286- workmem :: Base.RefValue{<:FactorOperationalMemory } # TODO easy of use vs. performance as container is abstract in any case.
284+ `solvercache ` is lazily allocated and only used during factor operations; it is not serialized or retained after solving.
285+ Accessors: [`getCache `](@ref), [`setCache !`](@ref)"""
286+ solvercache :: Base.RefValue{<:FactorSolverCache } # TODO easy of use vs. performance as container is abstract in any case.
287287end
288288
289289# #------------------------------------------------------------------------------
293293function FactorCompute (
294294 label:: Symbol ,
295295 variableOrder:: Union{Vector{Symbol}, Tuple} ,
296- observation:: AbstractFactor ,
296+ observation:: AbstractFactorObservation ,
297297 state:: FactorState = FactorState (),
298- _workmem = nothing ;
298+ cache = nothing ;
299299 tags:: Set{Symbol} = Set {Symbol} (),
300300 timestamp:: Union{DateTime, ZonedDateTime} = now (localzone ()),
301301 solvable:: Int = 1 ,
@@ -308,10 +308,10 @@ function FactorCompute(
308308 Base. depwarn (" `FactorCompute` solverData is deprecated" , :FactorCompute )
309309 end
310310
311- if isnothing (_workmem )
312- workmem = Ref {FactorOperationalMemory } ()
311+ if isnothing (cache )
312+ solvercache = Ref {FactorSolverCache } ()
313313 else
314- workmem = Ref (_workmem )
314+ solvercache = Ref (cache )
315315 end
316316
317317 return FactorCompute (
@@ -325,7 +325,7 @@ function FactorCompute(
325325 smallData,
326326 observation,
327327 state,
328- workmem ,
328+ solvercache ,
329329 )
330330end
331331
@@ -341,7 +341,7 @@ function FactorCompute(
341341 smallData:: Dict{Symbol, SmallDataTypes} = Dict {Symbol, SmallDataTypes} (),
342342)
343343 Base. depwarn (
344- " `FactorCompute` constructor with `GenericFunctionNodeData` is deprecated. observation, state, and workmem should be provided explicitly." ,
344+ " `FactorCompute` constructor with `GenericFunctionNodeData` is deprecated. observation, state, and solvercache should be provided explicitly." ,
345345 :FactorCompute ,
346346 )
347347 observation = getFactorType (solverData)
@@ -355,18 +355,18 @@ function FactorCompute(
355355 solverData. inflation,
356356 )
357357
358- if solverData. fnc isa FactorOperationalMemory
359- workmem = solverData. fnc
358+ if solverData. fnc isa FactorSolverCache
359+ solvercache = solverData. fnc
360360 else
361- workmem = nothing
361+ solvercache = nothing
362362 end
363363
364364 return FactorCompute (
365365 label,
366366 Tuple (variableOrder),
367367 observation,
368368 state,
369- workmem ;
369+ solvercache ;
370370 id,
371371 timestamp,
372372 nstime,
@@ -381,7 +381,7 @@ function Base.getproperty(x::FactorCompute, f::Symbol)
381381 getfield (x, f)[]
382382 elseif f == :solverData
383383 error (
384- " `solverData` is obsolete in `FactorCompute`. Use `getObservation`, `getState` or `getWorkmem ` instead." ,
384+ " `solverData` is obsolete in `FactorCompute`. Use `getObservation`, `getState` or `getCache ` instead." ,
385385 )
386386 elseif f == :_variableOrderSymbols
387387 [getfield (x, f)... ]
@@ -395,7 +395,7 @@ function Base.setproperty!(x::FactorCompute, f::Symbol, val)
395395 getfield (x, f)[] = val
396396 elseif f == :solverData
397397 error (
398- " `solverData` is obsolete in `FactorCompute`. Use `Observation`, `State` or `Workmem ` instead." ,
398+ " `solverData` is obsolete in `FactorCompute`. Use `Observation`, `State` or `Cache ` instead." ,
399399 )
400400 else
401401 setfield! (x, f, val)
0 commit comments