A factory for manifold defaults

Several components of a solver, like the stepsize, might require a manifold to fill several defaults with reasonable values. This would mean that when specifying your own step size in a high-level interface, one would have to repeat the manifold, since it is usually already the first of the arguments of that interface.

Therefore, elements like the ArmijoLinesearch allow you to provide only some of the optional and keyword arguments as well as to “skip” the manifold. Then a ManifoldDefaultsFactory is used to postpone the constructor call until later, when the manifold and other defaults are “filled in” automatically – since before passing a step size to a solver state we have the manifold available.

Manopt.ManifoldDefaultsFactoryType
ManifoldDefaultsFactory{T,TM,A,K}

A generic factory to postpone the instantiation of certain types from Manopt.jl storing keyword arguments.

The factory is especially meant to postpone the defaults that depend on a manifold, so that the manifold does not have to be explicitly provided but can be “set in” later.

For now this is established for

This factory stores necessary and optional parameters as well as keyword arguments provided by the user to later produce the type this factory is for.

Besides a manifold as a fallback, the factory can also be used for the (maybe simpler) types from the list of types that do not require the manifold.

Fields

  • M::Union{Nothing,AbstractManifold}: provide a manifold for defaults
  • args::A: arguments (args...) that are passed to the type constructor
  • kwargs::K: keyword arguments (kwargs...) that are passed to the type constructor
  • constructor_requires_manifold::Bool: indicate whether the type constructor requires the manifold or not
  • constructor_requires_point::Bool: indicate whether the type constructor requires a point or not

Constructor

ManifoldDefaultsFactory(T, args...; kwargs...)ManifoldDefaultsFactory(T, M, args...; kwargs...)

Input

  • T a subtype of types listed above that this factory is to produce
  • M (optional) a manifold used for the defaults in case no manifold is provided.
  • args... arguments to pass to the constructor of T
  • kwargs... keyword arguments to pass (overwrite) when constructing T.

Keyword arguments

  • requires_manifold=true: indicate whether the type constructor this factory wraps requires the manifold as first argument or not.
  • requires_point=false: indicate whether the type constructor this factory wraps requires a point as an argument or not.

All other keyword arguments are internally stored to be used in the type constructor, as are the arguments passed as args....

See also

_produce_type

source
Manopt._produce_typeMethod
_produce_type(t, M::AbstractManifold)
_produce_type(t, M::AbstractManifold, p)
_produce_type(t::ManifoldDefaultsFactory{T}, M::AbstractManifold)
_produce_type(t::ManifoldDefaultsFactory{T}, M::AbstractManifold, p)

Use the ManifoldDefaultsFactory{T} to produce an instance of type T. This acts transparently in the way that if you provide an instance t::T already, this will just be returned.

If a point p on manifold M is provided, it is passed to the constructor t as a template for allocating points. It is not supposed to be modified by the constructor or stored in the produced object.

source