Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Riemannian Levenberg-Marquardt initial residual and jacobian as kwargs #268

Merged
merged 5 commits into from
Jun 15, 2023
Merged
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
10 changes: 8 additions & 2 deletions src/solvers/LevenbergMarquardt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ then the keyword `jacobian_tangent_basis` below is ignored
a functor inheriting from [`StoppingCriterion`](@ref) indicating when to stop.
* `expect_zero_residual` – (`false`) whether or not the algorithm might expect that the value of
residual (objective) at mimimum is equal to 0.
* `initial_residual_values` – the initial residual vector of the cost function `f`.
* `initial_jacobian_f` – the initial Jacobian of the cost function `f`.

All other keyword arguments are passed to [`decorate_state!`](@ref) for decorators or
[`decorate_objective!`](@ref), respectively.
Expand Down Expand Up @@ -167,6 +169,10 @@ function LevenbergMarquardt!(
StopWhenStepsizeLess(1e-12),
debug=[DebugWarnIfCostIncreases()],
expect_zero_residual::Bool=false,
initial_residual_values=similar(p, get_objective(nlso).num_components),
initial_jacobian_f=similar(
p, get_objective(nlso).num_components, manifold_dimension(M)
),
kwargs..., #collect rest
) where {O<:Union{NonlinearLeastSquaresObjective,AbstractDecoratedManifoldObjective}}
i_nlso = get_objective(nlso) # undeecorate – for safety
Expand All @@ -175,8 +181,8 @@ function LevenbergMarquardt!(
lms = LevenbergMarquardtState(
M,
p,
similar(p, i_nlso.num_components),
similar(p, i_nlso.num_components, manifold_dimension(M));
initial_residual_values,
initial_jacobian_f;
stopping_criterion=stopping_criterion,
retraction_method=retraction_method,
expect_zero_residual=expect_zero_residual,
Expand Down