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
1
8
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...)
63
11
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
66
19
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
67
32
68
33
69
34
# #==============================================================================
@@ -146,34 +111,102 @@ function solveGraphParametric2(
146
111
return d, result, flatvar. idx, Σ
147
112
end
148
113
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
156
114
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
+ # #==============================================================================
159
118
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 CommonConvWrapper(
120
+ # usrfnc::T,
121
+ # fullvariables, #::Tuple ::Vector{<:DFGVariable};
122
+ # varValsAll::Tuple,
123
+ # X::AbstractVector{P}; #TODO remove X completely
124
+ # # xDim::Int = size(X, 1),
125
+ # userCache::CT = nothing,
126
+ # manifold = getManifold(usrfnc),
127
+ # partialDims::AbstractVector{<:Integer} = 1:length(X),
128
+ # partial::Bool = false,
129
+ # nullhypo::Real = 0,
130
+ # inflation::Real = 3.0,
131
+ # hypotheses::H = nothing,
132
+ # certainhypo = nothing,
133
+ # activehypo = collect(1:length(varValsAll)),
134
+ # measurement::AbstractVector = Vector(Vector{Float64}()),
135
+ # varidx::Int = 1,
136
+ # particleidx::Int = 1,
137
+ # res::AbstractVector{<:Real} = zeros(manifold_dimension(manifold)), # zDim
138
+ # gradients = nothing,
139
+ # ) where {T <: AbstractFactor, P, H, CT}
140
+ # #
141
+ # return CommonConvWrapper(
142
+ # usrfnc,
143
+ # tuple(fullvariables...),
144
+ # varValsAll,
145
+ # userCache,
146
+ # manifold,
147
+ # partialDims,
148
+ # partial,
149
+ # # xDim,
150
+ # float(nullhypo),
151
+ # float(inflation),
152
+ # hypotheses,
153
+ # certainhypo,
154
+ # activehypo,
155
+ # measurement,
156
+ # Ref(varidx),
157
+ # Ref(particleidx),
158
+ # res,
159
+ # gradients,
160
+ # )
166
161
# end
167
162
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
163
+ # function approxConvOnElements!(
164
+ # ccwl::Union{CommonConvWrapper{F}, CommonConvWrapper{Mixture{N_, F, S, T}}},
165
+ # elements::Union{Vector{Int}, UnitRange{Int}},
166
+ # ::Type{<:MultiThreaded},
167
+ # _slack = nothing,
168
+ # ) where {N_, F <: AbstractRelative, S, T}
169
+ # #
170
+ # return error(
171
+ # "MultiThreaded `approxConvOnElements!` is deprecated and will soon be replaced",
172
+ # )
173
+ # # Threads.@threads for n in elements
174
+ # # # ccwl.thrid_ = Threads.threadid()
175
+ # # ccwl.cpt[Threads.threadid()].particleidx = n
176
+
177
+ # # # ccall(:jl_, Nothing, (Any,), "starting loop, thrid_=$(Threads.threadid()), partidx=$(ccwl.cpt[Threads.threadid()].particleidx)")
178
+ # # _solveCCWNumeric!( ccwl, _slack=_slack)
179
+ # # end
180
+ # # nothing
173
181
# 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
182
+
183
+ # function approxConvOnElements!(
184
+ # ccwl::Union{CommonConvWrapper{F}, CommonConvWrapper{Mixture{N_, F, S, T}}},
185
+ # elements::Union{Vector{Int}, UnitRange{Int}},
186
+ # _slack = nothing,
187
+ # ) where {N_, F <: AbstractRelative, S, T}
188
+ # #
189
+ # return approxConvOnElements!(ccwl, elements, ccwl.threadmodel, _slack)
179
190
# end
191
+
192
+ # more legacy, dont delete yet
193
+ function Base. getproperty (ccw:: CommonConvWrapper , f:: Symbol )
194
+ if f == :threadmodel
195
+ error (" CommonConvWrapper.threadmodel is obsolete" )
196
+ # return SingleThreaded
197
+ elseif f == :params
198
+ error (" CommonConvWrapper.params is deprecated, use .varValsAll instead" )
199
+ return ccw. varValsAll
200
+ elseif f == :vartypes
201
+ @warn " CommonConvWrapper.vartypes is deprecated, use typeof.(getVariableType.(ccw.fullvariables) instead" maxlog= 3
202
+ return typeof .(getVariableType .(ccw. fullvariables))
203
+ else
204
+ return getfield (ccw, f)
205
+ end
206
+ end
207
+
208
+ # #==============================================================================
209
+ # # Deprecate code below before v0.35
210
+ # #==============================================================================
211
+
212
+ # #
0 commit comments