Skip to content

Commit e6c8e80

Browse files
committed
compat json, rm .threadmodel calls
1 parent d495923 commit e6c8e80

File tree

3 files changed

+79
-120
lines changed

3 files changed

+79
-120
lines changed

Project.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ Distributions = "0.24, 0.25"
5555
DocStringExtensions = "0.8, 0.9"
5656
FileIO = "1"
5757
FunctionalStateMachine = "0.2.9"
58-
JSON = "0.21"
59-
JSON2 = "0.3"
6058
JSON3 = "1"
6159
KernelDensityEstimate = "0.5.6"
6260
Manifolds = "0.8.15"

src/Deprecated.jl

Lines changed: 78 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,34 @@
1+
## ================================================================================================
2+
## Manifolds.jl Consolidation
3+
## TODO: Still to be completed and tested.
4+
## ================================================================================================
5+
# struct ManifoldsVector <: Optim.Manifold
6+
# manis::Vector{Manifold}
7+
# end
18

2-
##==============================================================================
3-
## LEGACY, towards Sidecar
4-
##==============================================================================
5-
6-
"""
7-
Converter: Prior -> PackedPrior::Dict{String, Any}
8-
9-
FIXME see DFG #590 for consolidation with Serialization and Marshaling
10-
"""
11-
function convert(::Type{Dict{String, Any}}, prior::IncrementalInference.Prior)
12-
@error("Obsolete, use pack/unpack converters instead")
13-
z = convert(Type{Dict{String, Any}}, prior.Z)
14-
return Packed_Factor([z], "Prior")
15-
end
16-
17-
"""
18-
Converter: PackedPrior::Dict{String, Any} -> Prior
19-
20-
FIXME see DFG #590 for consolidation on Serialization and Marshaling
21-
"""
22-
function convert(::Type{<:Prior}, prior::Dict{String, Any})
23-
@error("Obsolete, use pack/unpack converters instead")
24-
# Genericize to any packed type next.
25-
z = prior["measurement"][1]
26-
z = convert(DFG.getTypeFromSerializationModule(z["distType"]), z)
27-
return Prior(z)
28-
end
29-
30-
# more legacy, dont delete yet
31-
function Base.getproperty(ccw::CommonConvWrapper, f::Symbol)
32-
if f == :threadmodel
33-
@warn "CommonConvWrapper.threadmodel is obsolete" maxlog=3
34-
return SingleThreaded
35-
elseif f == :params
36-
@warn "CommonConvWrapper.params is deprecated, use .varValsAll instead" maxlog=3
37-
return ccw.varValsAll
38-
elseif f == :vartypes
39-
@warn "CommonConvWrapper.vartypes is deprecated, use typeof.(getVariableType.(ccw.fullvariables) instead" maxlog=3
40-
return typeof.(getVariableType.(ccw.fullvariables))
41-
else
42-
return getfield(ccw, f)
43-
end
44-
end
45-
46-
47-
##==============================================================================
48-
## Deprecate code below before v0.33
49-
##==============================================================================
50-
51-
# export setThreadModel!
52-
# introduced for approximate convolution operations
53-
export SingleThreaded, MultiThreaded
54-
55-
function setThreadModel!(fgl::AbstractDFG; model = IIF.SingleThreaded)
56-
#
57-
@error("Obsolete, ThreadModel types are no longer in use.")
58-
# for (key, id) in fgl.fIDs
59-
# _getCCW(fgl, key).threadmodel = model
60-
# end
61-
return nothing
62-
end
9+
# Base.getindex(mv::ManifoldsVector, inds...) = getindex(mv.mani, inds...)
10+
# Base.setindex!(mv, X, inds...) = setindex!(mv.mani, X, inds...)
6311

64-
# should have been deleted in v0.31 but no harm in keeping this one a bit longer
65-
@deprecate initManual!(w...; kw...) initVariable!(w...; kw...)
12+
# function ManifoldsVector(fg::AbstractDFG, varIds::Vector{Symbol})
13+
# manis = Bool[]
14+
# for k = varIds
15+
# push!(manis, getVariableType(fg, k) |> getManifold)
16+
# end
17+
# ManifoldsVector(manis)
18+
# end
6619

20+
# function Optim.retract!(manis::ManifoldsVector, x)
21+
# for (i,M) = enumerate(manis)
22+
# x[i] = project(M, x[i])
23+
# end
24+
# return x
25+
# end
26+
# function Optim.project_tangent!(manis::ManifoldsVector, G, x)
27+
# for (i, M) = enumerate(manis)
28+
# G[i] = project(M, x[i], G)
29+
# end
30+
# return G
31+
# end
6732

6833

6934
##==============================================================================
@@ -146,34 +111,58 @@ function solveGraphParametric2(
146111
return d, result, flatvar.idx, Σ
147112
end
148113

149-
## ================================================================================================
150-
## Manifolds.jl Consolidation
151-
## TODO: Still to be completed and tested.
152-
## ================================================================================================
153-
# struct ManifoldsVector <: Optim.Manifold
154-
# manis::Vector{Manifold}
155-
# end
156114

157-
# Base.getindex(mv::ManifoldsVector, inds...) = getindex(mv.mani, inds...)
158-
# Base.setindex!(mv, X, inds...) = setindex!(mv.mani, X, inds...)
115+
##==============================================================================
116+
## Deprecate code below before v0.34
117+
##==============================================================================
159118

160-
# function ManifoldsVector(fg::AbstractDFG, varIds::Vector{Symbol})
161-
# manis = Bool[]
162-
# for k = varIds
163-
# push!(manis, getVariableType(fg, k) |> getManifold)
164-
# end
165-
# ManifoldsVector(manis)
119+
# function approxConvOnElements!(
120+
# ccwl::Union{CommonConvWrapper{F}, CommonConvWrapper{Mixture{N_, F, S, T}}},
121+
# elements::Union{Vector{Int}, UnitRange{Int}},
122+
# ::Type{<:MultiThreaded},
123+
# _slack = nothing,
124+
# ) where {N_, F <: AbstractRelative, S, T}
125+
# #
126+
# return error(
127+
# "MultiThreaded `approxConvOnElements!` is deprecated and will soon be replaced",
128+
# )
129+
# # Threads.@threads for n in elements
130+
# # # ccwl.thrid_ = Threads.threadid()
131+
# # ccwl.cpt[Threads.threadid()].particleidx = n
132+
133+
# # # ccall(:jl_, Nothing, (Any,), "starting loop, thrid_=$(Threads.threadid()), partidx=$(ccwl.cpt[Threads.threadid()].particleidx)")
134+
# # _solveCCWNumeric!( ccwl, _slack=_slack)
135+
# # end
136+
# # nothing
166137
# end
167138

168-
# function Optim.retract!(manis::ManifoldsVector, x)
169-
# for (i,M) = enumerate(manis)
170-
# x[i] = project(M, x[i])
171-
# end
172-
# return x
173-
# end
174-
# function Optim.project_tangent!(manis::ManifoldsVector, G, x)
175-
# for (i, M) = enumerate(manis)
176-
# G[i] = project(M, x[i], G)
177-
# end
178-
# return G
139+
# function approxConvOnElements!(
140+
# ccwl::Union{CommonConvWrapper{F}, CommonConvWrapper{Mixture{N_, F, S, T}}},
141+
# elements::Union{Vector{Int}, UnitRange{Int}},
142+
# _slack = nothing,
143+
# ) where {N_, F <: AbstractRelative, S, T}
144+
# #
145+
# return approxConvOnElements!(ccwl, elements, ccwl.threadmodel, _slack)
179146
# end
147+
148+
# more legacy, dont delete yet
149+
function Base.getproperty(ccw::CommonConvWrapper, f::Symbol)
150+
if f == :threadmodel
151+
error("CommonConvWrapper.threadmodel is obsolete")
152+
# return SingleThreaded
153+
elseif f == :params
154+
error("CommonConvWrapper.params is deprecated, use .varValsAll instead")
155+
return ccw.varValsAll
156+
elseif f == :vartypes
157+
@warn "CommonConvWrapper.vartypes is deprecated, use typeof.(getVariableType.(ccw.fullvariables) instead" maxlog=3
158+
return typeof.(getVariableType.(ccw.fullvariables))
159+
else
160+
return getfield(ccw, f)
161+
end
162+
end
163+
164+
##==============================================================================
165+
## Deprecate code below before v0.35
166+
##==============================================================================
167+
168+
##

src/services/EvalFactor.jl

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,7 @@ Future work:
1414
function approxConvOnElements!(
1515
ccwl::Union{CommonConvWrapper{F}, CommonConvWrapper{Mixture{N_, F, S, T}}},
1616
elements::Union{Vector{Int}, UnitRange{Int}},
17-
::Type{<:MultiThreaded},
18-
_slack = nothing,
19-
) where {N_, F <: AbstractRelative, S, T}
20-
#
21-
return error(
22-
"MultiThreaded `approxConvOnElements!` is deprecated and will soon be replaced",
23-
)
24-
# Threads.@threads for n in elements
25-
# # ccwl.thrid_ = Threads.threadid()
26-
# ccwl.cpt[Threads.threadid()].particleidx = n
27-
28-
# # ccall(:jl_, Nothing, (Any,), "starting loop, thrid_=$(Threads.threadid()), partidx=$(ccwl.cpt[Threads.threadid()].particleidx)")
29-
# _solveCCWNumeric!( ccwl, _slack=_slack)
30-
# end
31-
# nothing
32-
end
33-
34-
function approxConvOnElements!(
35-
ccwl::Union{CommonConvWrapper{F}, CommonConvWrapper{Mixture{N_, F, S, T}}},
36-
elements::Union{Vector{Int}, UnitRange{Int}},
37-
::Type{<:SingleThreaded},
17+
# ::Type{<:SingleThreaded},
3818
_slack = nothing,
3919
) where {N_, F <: AbstractRelative, S, T}
4020
#
@@ -45,14 +25,6 @@ function approxConvOnElements!(
4525
return nothing
4626
end
4727

48-
function approxConvOnElements!(
49-
ccwl::Union{CommonConvWrapper{F}, CommonConvWrapper{Mixture{N_, F, S, T}}},
50-
elements::Union{Vector{Int}, UnitRange{Int}},
51-
_slack = nothing,
52-
) where {N_, F <: AbstractRelative, S, T}
53-
#
54-
return approxConvOnElements!(ccwl, elements, ccwl.threadmodel, _slack)
55-
end
5628

5729
"""
5830
$SIGNATURES

0 commit comments

Comments
 (0)