@@ -70,14 +70,14 @@ function CalcFactorResidualAP(fg::GraphsDFG, factorLabels::Vector{Symbol}, varIn
70
70
return ArrayPartition {CalcFactorResidual, typeof(parts_tuple)} (parts_tuple)
71
71
end
72
72
73
- function (cfm:: CalcFactorResidual{T} )(p) where T
73
+ function (cfm:: CalcFactorResidual )(p)
74
74
meas = cfm. meas
75
75
points = map (idx-> p[idx], cfm. varOrderIdxs)
76
- return cfm. sqrt_iΣ * cfm (meas, points... ) # 0.654783 seconds (6.75 M allocations: 531.688 MiB, 14.41% gc time)
76
+ return cfm. sqrt_iΣ * cfm (meas, points... )
77
77
end
78
78
79
79
function (cfm:: CalcFactorResidual{T} )() where T
80
- return cfm. sqrt_iΣ * cfm (cfm. meas, cfm. points... ) # 0.654783 seconds (6.75 M allocations: 531.688 MiB, 14.41% gc time)
80
+ return cfm. sqrt_iΣ * cfm (cfm. meas, cfm. points... )
81
81
end
82
82
83
83
# cost function f: M->ℝᵈ for Riemannian Levenberg-Marquardt
@@ -110,7 +110,12 @@ struct CostFres!{CFT}
110
110
# add return_ranges to allow MultiThreaded
111
111
end
112
112
113
- function calcFactorResVec! (x:: Vector{T} , cfm_part:: Vector{<:CalcFactorResidual} , p:: AbstractArray{T} , st:: Int ) where T
113
+ function calcFactorResVec! (
114
+ x:: Vector{T} ,
115
+ cfm_part:: Vector{<:CalcFactorResidual{FT}} ,
116
+ p:: AbstractArray{T} ,
117
+ st:: Int
118
+ ) where {T,FT}
114
119
l = getDimension (cfm_part[1 ]) # all should be the same
115
120
for cfm in cfm_part
116
121
x[st: st + l - 1 ] = cfm (p) # NOTE looks like do not broadcast here
@@ -289,7 +294,7 @@ function covarianceFiniteDiff(M, jacF!::JacF_RLM!, p0)
289
294
end
290
295
end
291
296
292
- @time H = FiniteDiff. finite_difference_hessian (costf, X0)
297
+ H = FiniteDiff. finite_difference_hessian (costf, X0)
293
298
294
299
# inv(H)
295
300
Σ = Matrix (H) \ Matrix {eltype(H)} (I, size (H)... )
@@ -356,7 +361,7 @@ function solve_RLM(
356
361
else
357
362
# TODO make sure J initial_jacobian_f is updated, otherwise recalc jacF!(M, J, lm_r) # lm_r === p0
358
363
J = initial_jacobian_f
359
- H = J' J
364
+ H = J' J # approx
360
365
Σ = H \ Matrix {eltype(H)} (I, size (H)... )
361
366
# Σ = pinv(H)
362
367
end
0 commit comments