Skip to content

Commit ff2931d

Browse files
committed
fix calcVariableDistanceExpectedFractional
1 parent 484aad8 commit ff2931d

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/NumericalCalculations.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ function _solveLambdaNumeric( fcttype::Union{F,<:Mixture{N_,F,S,T}},
114114
X0 = hat(M, ϵ, X0c)
115115
p0 = exp(M, ϵ, X0)
116116
r = Optim.optimize(Xc->cost(p0, X0, Xc), X0c, alg)
117-
117+
if !Optim.converged(r)
118+
@debug "Optim did not converge:" r
119+
end
118120
return exp(M, ϵ, hat(M, ϵ, r.minimizer))
119121

120122
end

src/services/EvalFactor.jl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,8 @@ function calcVariableDistanceExpectedFractional(ccwl::CommonConvWrapper,
103103
# also check distance to certainidx for general scale reference (workaround heuristic)
104104
for cidx in certainidx
105105
count += 1
106-
cerMean = zeros(length(ccwl.params[cidx][1]))
107-
# cerMean = Statistics.mean(ccwl.params[cidx], dims=2)[:]
108-
for pr in ccwl.params[cidx]
109-
cerMean .+= pr
110-
end
111-
cerMean ./= length(ccwl.params[cidx])
106+
cerMeanPnt = mean(getManifold(ccwl.vartypes[cidx]), ccwl.params[cidx])
107+
cerMean = getCoordinates(ccwl.vartypes[cidx], cerMeanPnt)
112108
dists[count] = norm(refMean[1:dims] - cerMean[1:dims])
113109
end
114110

0 commit comments

Comments
 (0)