Common Record Actions

Recordings during the iteration can be added to any solver run, since all solvers accept the record= keyword. This is handled by the RecordActionFactory.

Manopt.RecordChangeType
RecordChange <: RecordAction

debug for the amount of change of the iterate (see get_iterate(s) of the AbstractManoptSolverState) during the last iteration.

Fields

Constructor

RecordChange(M=DefaultManifold();    inverse_retraction_method = default_inverse_retraction_method(M),    storage                   = StoreStateAction(M; store_points=Tuple{:Iterate}))

with the previous fields as keywords. For the DefaultManifold only the field storage is used. Providing the actual manifold moves the default storage to the efficient point storage.

source
Manopt.RecordCostType
RecordCost <: RecordAction

Record the current cost function value, see get_cost.

Fields

  • recorded_values : to store the recorded values

Constructor

RecordCost()
source
Manopt.RecordEntryType
RecordEntry{T} <: RecordAction

record a certain fields entry of type {T} during the iterates

Fields

Constructor

RecordEntry(::T, f::Symbol)RecordEntry(T::DataType, f::Symbol)

Initialize the record action to record the state field f, and initialize the recorded_values to be a vector of element type T.

Examples

  • RecordEntry(rand(M), :q) to record the points from M stored in some states s.q
  • RecordEntry(SVDMPoint, :p) to record the field s.p which takes values of type SVDMPoint.
source
Manopt.RecordEntryChangeType
RecordEntryChange{T} <: RecordAction

record a certain entries change during iterates

Additional fields

  • recorded_values : the recorded Iterates
  • field : Symbol the field can be accessed with within AbstractManoptSolverState
  • distance : function (p,o,x1,x2) to compute the change/distance between two values of the entry
  • storage : a StoreStateAction to store (at least) getproperty(o, d.field)

Constructor

RecordEntryChange(f::Symbol, d, a::StoreStateAction=StoreStateAction([f]))
source
Manopt.RecordGradientType
RecordGradient <: RecordAction

record the gradient evaluated at the current iterate

Constructors

RecordGradient(ξ)

initialize the RecordAction to the corresponding type of the tangent vector.

source
Manopt.RecordGradientNormType
RecordGradientNorm{R<:Real} <: RecordAction

record the norm of the current gradient

Constructor

RecordGradientNorm(r::Type{<:Real}=Float64)
source
Manopt.RecordIterateType
RecordIterate <: RecordAction

record the iterate

Constructors

RecordIterate(x0)

initialize the iterate record array to the type of x0, which indicates the kind of iterate

RecordIterate(P)

initialize the iterate record array to the data type T.

source
Manopt.RecordStepsizeType
RecordStepsize <: RecordAction

Record the step size.

Constructor

RecordStepsize(r::Type{<:Real}=Float64)
source
Manopt.RecordTimeType
RecordTime <: RecordAction

record the time elapsed during the current iteration.

The three possible modes are

  • :cumulative record times without resetting the timer
  • :iterative record times with resetting the timer
  • :total record a time only at the end of an algorithm (see stop_solver!)

The default is :cumulative, and any non-listed symbol default to using this mode.

Constructor

RecordTime(; mode::Symbol=:cumulative)
source
Manopt.RecordDualChangeMethod
RecordDualChange()

Create the action either with a given (shared) Storage, which can be set to the values Tuple, if that is provided).

source

Internal functions

Manopt.RecordActionFactoryMethod
RecordActionFactory(s::AbstractManoptSolverState, a)

create a RecordAction where

  • a RecordAction is passed through
  • a [Symbol] creates
    • :Change to record the change of the iterates, see RecordChange
    • :Cost to record the current cost function value
    • :Gradient to record the gradient, see RecordGradient
    • :GradientNorm to record the norm of the gradient, see [RecordGradientNorm`](@ref)
    • :Iterate to record the iterate
    • :Iteration to record the current iteration number
    • :IterativeTime to record the times taken for each iteration.
    • :ProximalParameter to record the proximal parameter, see RecordProximalParameter
    • :Stepsize to record the current step size
    • :Time to record the total time taken after every iteration

and every other symbol is passed to RecordEntry, which results in recording the field of the state with the symbol indicating the field of the solver to record.

source
Manopt.RecordFactoryMethod
RecordFactory(s::AbstractManoptSolverState, a)

Generate a dictionary of RecordActions.

First all Symbols String, RecordActions and numbers are collected, excluding :Stop and :WhenActive. This collected vector is added to the :Iteration => [...] pair. :Stop is added as :StoppingCriterion to the :Stop => [...] pair. If any of these two pairs does not exist, it is pairs are created when adding the corresponding symbols

For each Pair of a Symbol and a Vector, the RecordGroupFactory is called for the Vector and the result is added to the debug dictionary's entry with said symbol. This is wrapped into the RecordWhenActive, when the :WhenActive symbol is present

Return value

A dictionary for the different entry points where debug can happen, each containing a RecordAction to call.

Note that upon the initialization all dictionaries but the :StartAlgorithm one are called with an i=0 for reset.

source
Manopt.RecordGroupFactoryMethod
RecordGroupFactory(s::AbstractManoptSolverState, a)

Generate a [RecordGroup] of RecordActions. The following rules are used

  1. Any Symbol contained in a is passed to RecordActionFactory
  2. Any RecordAction is included as is.

Any Pair of a RecordAction and a symbol, that is in order RecordCost() => :A is handled, that the corresponding record action can later be accessed as g[:A], where gis the record group generated here.

If this results in more than one RecordAction a RecordGroup of these is build.

If any integers are present, the last of these is used to wrap the group in a RecordEvery(k).

If :WhenActive is present, the resulting Action is wrapped in RecordWhenActive, making it deactivatable by its parent solver.

source