Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ FunctionalStateMachine = "0.2.9"
JLD2 = "0.3, 0.4"
JSON2 = "0.3"
KernelDensityEstimate = "0.5.6"
Manifolds = "0.6"
ManifoldsBase = "0.11, 0.12"
Manifolds = "0.6.3"
ManifoldsBase = "0.12.6"
MetaGraphs = "0.6.4"
NLSolversBase = "7.6"
NLsolve = "3, 4"
Expand Down
23 changes: 14 additions & 9 deletions src/NumericalCalculations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,27 @@ function _solveLambdaNumeric( fcttype::Union{F,<:Mixture{N_,F,S,T}},
# norm(M, p, X) == distance(M, p, X)
#TODO fix closure for performance
fM = getManifold(fcttype)
function cost(Xc)
p = exp(M, ϵ, hat(M, ϵ, Xc))
function cost(p, X, Xc)
hat!(M, X, ϵ, Xc)
exp!(M, p, ϵ, X)
# X = objResX(p)
# return norm(fM, p, X)^2 #TODO the manifold of p and X are not always the same
#options getPointIdentity or leave it to factor
residual = objResX(p)
return sum(residual.^2)
end

# separate statements to try improve type-stability
r = if islen1
Optim.optimize(cost, X0c, Optim.BFGS())
else
Optim.optimize(cost, X0c, Optim.NelderMead())
end

# # separate statements to try improve type-stability
# r = if islen1
# Optim.optimize(cost, X0c, Optim.BFGS())
# else
# Optim.optimize(cost, X0c, Optim.NelderMead())
# end
alg = islen1 ? Optim.BFGS() : Optim.NelderMead()
X0 = hat(M, ϵ, X0c)
p0 = exp(M, ϵ, X0)
r = Optim.optimize(Xc->cost(p0, X0, Xc), X0c, alg)
Comment on lines +107 to +116
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a merge conflict that messed this up. I will incorporate the commented code. Although, I would just like to understand why it's a problem to improve in the future.


return exp(M, ϵ, hat(M, ϵ, r.minimizer))

end
Expand Down