The Debug decorator for solver states
Manopt.DebugAction — Type
DebugActionA DebugAction is a small functor to print/issue debug output. The usual call is given by (p::AbstractManoptProblem, s::AbstractManoptSolverState, k) -> s, where k is the current iteration.
By convention k=0 is interpreted as “for initialization only”: only debug info that prints initialization reacts. k<0 triggers updates of variables internally but does not trigger any output.
Fields (assumed by subtypes to exist)
print: method to perform the actual print. Can for example be set to a file export, or to@info. The default is theprintfunction on the defaultBase.stdout.
Manopt.DebugEvery — Type
DebugEvery <: DebugActionEvaluate and print debug only every $k$-th iteration. Otherwise no print is performed. Whether internal variables are updated is determined by always_update.
This method does not perform any print itself but relies on its children's print.
It also sets the sub solvers active parameter, see DebugWhenActive. Here, the activation_offset can be used to specify whether it refers to this iteration, the $k$-th: when this call is before the iteration, then the offset should be 0; for the next iteration, that is if this is called after an iteration, it has to be set to 1. Since usual debug is happening after the iteration, 1 is the default.
Constructor
DebugEvery(d::DebugAction, every=1, always_update=true; activation_offset=1)Manopt.DebugGroup — Type
DebugGroup <: DebugActionGroup a set of DebugActions into one action, where the internal prints are removed by default and the resulting strings are concatenated.
Constructor
DebugGroup(g)Construct a group consisting of an Array of DebugActions g, that are evaluated en bloc; the method does not perform any print itself, but relies on the internal prints. It still concatenates the result and returns the complete string.
Manopt.DebugSolverState — Type
DebugSolverState <: AbstractManoptSolverStateThe debug state appends debug to any state; it acts as a decorator. Internally a dictionary is kept that stores a DebugAction for several occasions using a Symbol as reference.
The original state can still be accessed using the get_state function.
Fields
state: the state that is extended by debug informationdebug_dictionary: aDict{Symbol,DebugAction}to keep track of debug output for different occasions
Constructors
DebugSolverState(st, dD)Construct a debug decorated state, where dD can be
- a
DebugAction, then it is stored within the dictionary at:Iteration. - an
ArrayofDebugActions. - a
Dict{Symbol,DebugAction}. - an
ArrayofSymbols,Strings and anIntfor theDebugFactory. - a
Functionused as a callback, which is passed to theDebugFactory.
The solver implementation
Manopt.initialize_solver! — Method
initialize_solver!(amp::AbstractManoptProblem, dss::DebugSolverState)Extend the initialization of the solver by a hook to run the DebugAction that was added to the :Start entry of the debug lists. All others are triggered (with iteration number 0) to trigger possible resets
Manopt.step_solver! — Method
step_solver!(amp::AbstractManoptProblem, dss::DebugSolverState, k)Extend the ith step of the solver by a hook to run debug prints, that were added to the :BeforeIteration and :Iteration entries of the debug lists.
Manopt.stop_solver! — Method
stop_solver!(amp::AbstractManoptProblem, dss::DebugSolverState, k)Extend the stop_solver!, whether to stop the solver by a hook to run debug, that were added to the :Stop entry of the debug lists.
Internal functions
Manopt.set_parameter! — Method
set_parameter!(dss::DebugSolverState, ::Val{:Debug}, args...)Set certain values specified by args... into the elements of the debug_dictionary.
Further reading
For concrete debug actions available, see the common debugs.