elsa Proximal Operators¶
Table of Contents
ProximalOperator¶
-
template<typename
data_t
= real_t>
classelsa
::
ProximalOperator
¶ Base class representing a proximal operator prox.
This class represents a proximal operator prox, expressed through its apply methods, which implement the proximal operator of f with penalty r i.e. $ prox_{f,\rho}(v) = argmin_{x}(f(x) + (\rho/2)·\| x - v \|^2_2). $
The class implements type erasure. Classes, that bind to this wrapper should overload either the
applyProximal
, or implement theapply
member function, with the signature given in this class. Base types also are assumed to be Semi-Regular.References: https://stanford.edu/~boyd/papers/pdf/admm_distr_stats.pdf
- Author
Andi Braimllari - initial code
David Frank - Type Erasure
- Template Parameters
data_t
: data type for the values of the operator, defaulting to real_t
Public Functions
-
ProximalOperator
() = default¶ defaulted default constructor for base-class (will point to nothing)
-
template<typename
T
>ProximalOperator
(T proxOp)¶ Type erasure constructor, taking everything that kan bind to the above provided interface
-
ProximalOperator
(const ProximalOperator &other)¶ Copy constructor.
-
ProximalOperator
(ProximalOperator &&other) noexcept = default¶ Default move constructor.
-
ProximalOperator &
operator=
(const ProximalOperator &other)¶ Copy assignment.
-
ProximalOperator &
operator=
(ProximalOperator &&other) noexcept = default¶ Default move assignment.
-
~ProximalOperator
() = default¶ default destructor
-
auto
apply
(const DataContainer<data_t> &v, SelfType_t<data_t> t) const -> DataContainer<data_t>¶ apply the proximal operator to an element in the operator’s domain
Please note: this method uses apply(v, t, prox(v)) to perform the actual operation.
- Return
prox DataContainer containing the application of the proximal operator to data v, i.e. in the range of the operator
- Parameters
[in] v
: input DataContainer[in] t
: input Threshold
-
void
apply
(const DataContainer<data_t> &v, SelfType_t<data_t> t, DataContainer<data_t> &prox) const¶ apply the proximal operator to an element in the operator’s domain
Please note: this method calls the method applyImpl that has to be overridden in derived classes. (Why is this method not virtual itself? Because you cannot have a non-virtual function overloading a virtual one [apply with one vs. two arguments]).
- Parameters
[in] v
: input DataContainer[in] t
: input Threshold[out] prox
: output DataContainer
-
struct
ProxConcept
¶ Concept for proximal operators, they should be cloneable, and have an apply method.
-
template<class
T
>
structProxModel
: public elsa::ProximalOperator<data_t>::ProxConcept¶ Bridge wrapper for concrete types.
Public Functions
-
std::unique_ptr<ProxConcept>
clone
() const override¶ Just clone the type (assumes regularity, i.e. copy constructible)
-
void
apply
(const DataContainer<data_t> &v, SelfType_t<data_t> t, DataContainer<data_t> &out) const override¶ Apply proximal by calling
apply_proximal
, this enables flexible extension, without classes as well. The default implementation ofapply_proximal
, just calls the member function
-
std::unique_ptr<ProxConcept>
ProximalL1¶
-
template<typename
data_t
= real_t>
classelsa
::
ProximalL1
¶ Class representing the proximal operator of the l1 norm.
This class represents the soft thresholding operator, expressed by its apply method through the function i.e.
$ prox(v) = sign(v)·(|v| - t)_+. $- Author
Andi Braimllari - initial code
- Template Parameters
data_t
: data type for the values of the operator, defaulting to real_t
References: http://sfb649.wiwi.hu-berlin.de/fedc_homepage/xplore/tutorials/xlghtmlnode93.html
Public Functions
-
~ProximalL1
() = default¶ default destructor
-
void
apply
(const DataContainer<data_t> &v, SelfType_t<data_t> t, DataContainer<data_t> &prox) const¶ apply the proximal operator of the l1 norm to an element in the operator’s domain
- Parameters
[in] v
: input DataContainer[in] t
: input Threshold[out] prox
: output DataContainer
ProximalL0¶
-
template<typename
data_t
= real_t>
classelsa
::
ProximalL0
¶ Class representing the proximal operator of the l0 pseudo-norm.
This class represents the hard thresholding operator, expressed by its apply method through the function i.e.
$ prox(v) = v·1_{\{|v| > t\}}. $- Author
Andi Braimllari - initial code
- Template Parameters
data_t
: data type for the values of the operator, defaulting to real_t
References: http://sfb649.wiwi.hu-berlin.de/fedc_homepage/xplore/tutorials/xlghtmlnode93.html
Public Functions
-
~ProximalL0
() = default¶ default destructor
-
DataContainer<data_t>
apply
(const DataContainer<data_t> &v, SelfType_t<data_t> t) const¶ apply the proximal operator of the l0 pseudo-norm to an element in the operator’s domain
- Parameters
[in] v
: input DataContainer[in] t
: input Threshold
-
void
apply
(const DataContainer<data_t> &v, SelfType_t<data_t> t, DataContainer<data_t> &prox) const¶ apply the proximal operator of the l0 pseudo-norm to an element in the operator’s domain
- Parameters
[in] v
: input DataContainer[in] t
: input Threshold[out] prox
: output DataContainer
CombinedProximal¶
-
template<class
data_t
>
classelsa
::
CombinedProximal
¶ Combine multiple proximals operators into a diagnional operator, or as a block operator.
Given the proximal operators for a sequence of $k$ functions $ (g_i)_{i=1}^k$, then the combined proximal $prox_{G}$ is
\[ prox_{G}(x) = diag( prox_{g_1}(x_1), \cdots, prox_{g_k}(x_k)) \]where $x = (x_1, \dots, x_k)$, i.e. represented as a blockedDataContainer
The proximal operator of a separable sum of functionals, is the combined proximal.
- See
Public Functions
-
CombinedProximal
(ProximalOperator<data_t> prox)¶ Construct a combined proximal from a single proximal.
-
CombinedProximal
(ProximalOperator<data_t> prox1, ProximalOperator<data_t> prox2)¶ Construct a combined proximal from a two proximal.
-
CombinedProximal
(ProximalOperator<data_t> prox1, ProximalOperator<data_t> prox2, ProximalOperator<data_t> prox3)¶ Construct a combined proximal from a three proximal.
-
CombinedProximal
(ProximalOperator<data_t> prox1, ProximalOperator<data_t> prox2, ProximalOperator<data_t> prox3, ProximalOperator<data_t> prox4)¶ Construct a combined proximal from a four proximal.
-
template<class ...
Args
>CombinedProximal
(ProximalOperator<data_t> prox1, ProximalOperator<data_t> prox2, ProximalOperator<data_t> prox3, ProximalOperator<data_t> prox4, ProximalOperator<data_t> prox5, Args... args)¶ Construct a combined proximal from a variadic amount of proximal.
-
DataContainer<data_t>
apply
(const DataContainer<data_t> &v, SelfType_t<data_t> t) const¶ Apply proximal operator to the given
DataContainer
. It applies each proximal operator to the corresponding block of theDataContainer
. Throws, if the givenDataContainer
does not have aBlockDataDescriptor
.
-
void
apply
(const DataContainer<data_t> &v, SelfType_t<data_t> t, DataContainer<data_t> &prox) const¶ Apply the proximal operator the to given out parameter.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
-
ProximalOperator<data_t>
getIthProximal
(index_t i)¶ Get the
i
-th proximal operator.
-
void
addProximal
(ProximalOperator<data_t> prox)¶ Add an additional proximal operator.