The Manopt.jl Solver state

The solver state represents all parameters that determine the solver's setup as well as interim memory, e.g. to avoid allocations or to keep certain variables in between iterations. These should also allow insight into how the solver is performing.

A state contains callbacks and a stopping criterion as mandatory elements and usually the iterate is stored in the field p. A state can be decorated to add functionality.

Further elements a state can use are:

Abstract state

Manopt.AbstractManoptSolverStateType
AbstractManoptSolverState

A general super type for all solver states.

Fields

The following fields are assumed to be available by default. If you use different ones, adapt the access functions get_iterate, get_stopping_criterion, and get_callbacks accordingly.

  • p::P: a point on the manifold $\mathcal{M}$ storing the current iterate
  • callbacks::D: provided callback functions given as a dictionary with symbols as keys
  • stop::StoppingCriterion: a functor indicating that the stopping criterion is fulfilled
source

Access functions

Manopt.get_countMethod
get_count(ams::AbstractManoptSolverState, ::Symbol)

Obtain the count for a certain countable size, for example the :Iterations. This function returns 0 if there was nothing to count.

Available symbols from within the solver state:

  • :Iterations is passed on to the stop field to obtain the iteration at which the solver stopped.
source
Manopt.get_solver_resultMethod
get_solver_result(state::AbstractManoptSolverState)
get_solver_result(tos::Tuple{AbstractManifoldObjective,AbstractManoptSolverState})
get_solver_result(objective::AbstractManifoldObjective, state::AbstractManoptSolverState)
get_solver_result(problem::AbstractManoptProblem, state::AbstractManoptSolverState)

Return the final result after all iterations that is stored within the AbstractManoptSolverState state, which was modified during the iterations.

For the case that an AbstractManifoldObjective objective is passed as well – either as a tuple or as two parameters –, by default the objective is ignored, and the solver result for the state is returned; this is for display reasons in the REPL related to statistics, where such a tuple might appear.

For the case that an AbstractManoptProblem problem is passed as a first optional parameter, by default the problem is ignored. This can be used to change the representation of a result stored in a state, for example when a tangent vector is (part of) the result, changing between representations in coefficients and different tangent vector representations could be performed as a final step, depending on which problem was aimed to be solved.

Note that the returned value or point might still be aliased to the original state.

source
Manopt.get_stateFunction
get_state(s::AbstractManoptSolverState, recursive::Bool=true)

Return the undecorated AbstractManoptSolverState of the (possibly) decorated s. As long as your decorated state stores the state within s.state and dispatch_state_decorator is set to Val{true}, the internal state is extracted automatically.

By default the state that is stored within a decorated state is assumed to be at s.state. Overwrite _get_state(s, ::Val{true}, recursive) to change this behaviour for your state s for both the recursive and the direct case.

If recursive is set to false, only the most outer decorator is taken away instead of all.

source
Manopt.stopped_atMethod
stopped_at(state::AbstractManoptSolverState)

Return the number of iterations the solver represented by the state took to stop. If the solver has not yet stopped, this function returns -1.

By default, this function calls the get_count function on the state's stopping criterion to access its :Iterations count.

source

Internal functions