Skip to content

Commit 4cac5c3

Browse files
committed
refactro to ccw.hyporecipe
1 parent 7de8985 commit 4cac5c3

File tree

8 files changed

+46
-22
lines changed

8 files changed

+46
-22
lines changed

src/Deprecated.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,15 @@ function Base.getproperty(ccw::CommonConvWrapper, f::Symbol)
256256
elseif f == :vartypes
257257
@warn "CommonConvWrapper.vartypes is deprecated, use typeof.(getVariableType.(ccw.fullvariables) instead" maxlog=3
258258
return typeof.(getVariableType.(ccw.fullvariables))
259+
elseif f == :hypotheses
260+
@warn "CommonConvWrapper.hypotheses is now under ccw.hyporecipe.hypotheses" maxlog=5
261+
return ccw.hyporecipe.hypotheses
262+
elseif f == :certainhypo
263+
@warn "CommonConvWrapper.certainhypo is now under ccw.hyporecipe.certainhypo" maxlog=5
264+
return ccw.hyporecipe.certainhypo
265+
elseif f == :activehypo
266+
@warn "CommonConvWrapper.activehypo is now under ccw.hyporecipe.activehypo" maxlog=5
267+
return ccw.hyporecipe.activehypo
259268
else
260269
return getfield(ccw, f)
261270
end

src/IncrementalInference.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ include("ManifoldsExtentions.jl")
125125
# regular
126126
include("entities/SolverParams.jl")
127127

128+
include("entities/HypoRecipe.jl")
128129
include("entities/FactorOperationalMemory.jl")
129130

130131
include("Factors/GenericMarginal.jl")

src/entities/FactorOperationalMemory.jl

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ $(TYPEDEF)
6363
"""
6464
struct MultiThreaded <: _AbstractThreadModel end
6565

66+
67+
6668
"""
6769
$(TYPEDEF)
6870
@@ -86,8 +88,7 @@ Base.@kwdef struct CommonConvWrapper{
8688
TP <: Tuple,
8789
CT,
8890
AM <: AbstractManifold,
89-
HP <: Union{Nothing, <:Distributions.Categorical{Float64, Vector{Float64}}},
90-
CH <: Union{Nothing, Vector{Int}},
91+
HR <: HypoRecipeCompute,
9192
MT,
9293
G
9394
} <: FactorOperationalMemory
@@ -114,13 +115,8 @@ Base.@kwdef struct CommonConvWrapper{
114115
nullhypo::Float64 = 0.0
115116
""" inflationSpread particular to this factor (by how much to dispurse the belief initial values before numerical optimization is run). Analogous to stochastic search """
116117
inflation::Float64 = SolverParams().inflation
117-
# multihypo specific field containers for recipe of hypotheses to compute
118-
""" multi hypothesis settings #NOTE no need for a parameter as type is known from `parseusermultihypo` """
119-
hypotheses::HP = nothing
120-
""" categorical to select which hypothesis is being considered during convolution operation """
121-
certainhypo::CH = nothing
122-
""" subsection indices to select which params should be used for this hypothesis evaluation """
123-
activehypo::Vector{Int} = collect(1:length(varValsAll))
118+
""" multihypo specific field containers for recipe of hypotheses to compute """
119+
hyporecipe::HR = HypoRecipeCompute(;activehypo=collect(1:length(varValsAll)))
124120
# buffers and indices to point numerical computations to specific memory locations
125121
""" user defined measurement values for each approxConv operation
126122
FIXME make type stable, JT should now be type stable if rest works.

src/entities/HypoRecipe.jl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
3+
4+
Base.@kwdef struct HypoRecipe
5+
certainidx::Vector{Int}
6+
allelements::Vector{Vector{Int}}
7+
activehypo::Vector{Tuple{Int,Vector{Int}}}
8+
mhidx::Vector{Int}
9+
end
10+
11+
Base.@kwdef struct HypoRecipeCompute{
12+
HP <: Union{Nothing, <:Distributions.Categorical{Float64, <:AbstractVector{Float64}}},
13+
CH <: Union{Nothing, <:AbstractVector{<:Integer}},
14+
}
15+
""" multi hypothesis settings #NOTE no need for a parameter as type is known from `parseusermultihypo` """
16+
hypotheses::HP = nothing
17+
""" categorical to select which hypothesis is being considered during convolution operation """
18+
certainhypo::CH = nothing
19+
""" subsection indices to select which params should be used for this hypothesis evaluation """
20+
activehypo::Vector{Int} = Int[]
21+
end

src/services/CalcFactor.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,10 @@ function _createCCW(
436436
partial,
437437
nullhypo = float(nullhypo),
438438
inflation = float(inflation),
439-
hypotheses = multihypo,
440-
certainhypo,
439+
hyporecipe = HypoRecipeCompute(;
440+
hypotheses = multihypo,
441+
certainhypo,
442+
),
441443
measurement,
442444
_gradients,
443445
)

src/services/ExplicitDiscreteMarginalizations.jl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,7 @@ function getHypothesesVectors(
2323
return (allmhp, certainidx, uncertnidx)
2424
end
2525

26-
Base.@kwdef struct HypoRecipe
27-
certainidx::Vector{Int}
28-
allelements::Vector{Vector{Int}}
29-
activehypo::Vector{Tuple{Int,Vector{Int}}}
30-
mhidx::Vector{Int}
31-
end
26+
3227

3328
"""
3429
$(SIGNATURES)

src/services/FactorGraph.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ function getDefaultFactorData(
725725

726726
# allocate temporary state for convolutional operations (not stored)
727727
userCache = preambleCache(dfg, Xi, usrfnc)
728-
ccw = _createCCW(
728+
ccwl = _createCCW(
729729
Xi,
730730
usrfnc;
731731
multihypo = mhcat,
@@ -737,11 +737,11 @@ function getDefaultFactorData(
737737
)
738738

739739
# and the factor data itself
740-
return FunctionNodeData{typeof(ccw)}(
740+
return FunctionNodeData{typeof(ccwl)}(
741741
eliminated,
742742
potentialused,
743743
edgeIDs,
744-
ccw,
744+
ccwl,
745745
multihypo,
746746
ccw.certainhypo,
747747
nullhypo,

src/services/NumericalCalculations.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ function _buildCalcFactorLambdaSample(
349349
# DevNotes, also see new `hyporecipe` approach (towards consolidation CCW CPT FMd CF...)
350350

351351
# build a view to the decision variable memory
352-
varValsHypo = ccwl.varValsAll[ccwl.activehypo]
352+
varValsHypo = ccwl.varValsAll[ccwl.hyporecipe.activehypo]
353353
# tup = tuple(varParams...)
354354
# nms = keys(ccwl.varValsAll)[cpt_.activehypo]
355355
# varValsHypo = NamedTuple{nms,typeof(tup)}(tup)
@@ -364,7 +364,7 @@ function _buildCalcFactorLambdaSample(
364364
# fmd_.cachedata )
365365
#
366366
# get the operational CalcFactor object
367-
cf = _buildCalcFactor(ccwl, smpid, varValsHypo, ccwl.activehypo)
367+
cf = _buildCalcFactor(ccwl, smpid, varValsHypo, ccwl.hyporecipe.activehypo)
368368
# new dev work on CalcFactor
369369
# cf = CalcFactor(ccwl.usrfnc!, _fmd_, smpid,
370370
# varValsHypo)

0 commit comments

Comments
 (0)