SOPT
Sparse OPTimisation
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
sopt::algorithm::ProximalADMM< SCALAR > Class Template Reference

Proximal Alternate Direction method of mutltipliers. More...

#include <padmm.h>

Classes

struct  Diagnostic
 Values indicating how the algorithm ran. More...
 
struct  DiagnosticAndResult
 Holds result vector as well. More...
 

Public Types

using value_type = SCALAR
 Scalar type. More...
 
using Scalar = value_type
 Scalar type. More...
 
using Real = typename real_type< Scalar >::type
 Real type. More...
 
using t_Vector = Vector< Scalar >
 Type of then underlying vectors. More...
 
using t_LinearTransform = LinearTransform< t_Vector >
 Type of the Ψ and Ψ^H operations, as well as Φ and Φ^H. More...
 
using t_IsConverged = std::function< bool(const t_Vector &, const t_Vector &)>
 Type of the convergence function. More...
 
using t_Proximal = ProximalFunction< Scalar >
 Type of the convergence function. More...
 

Public Member Functions

template<typename DERIVED >
 ProximalADMM (t_Proximal const &f_proximal, t_Proximal const &g_proximal, Eigen::MatrixBase< DERIVED > const &target)
 
virtual ~ProximalADMM ()
 
 SOPT_MACRO (itermax, t_uint)
 Maximum number of iterations. More...
 
 SOPT_MACRO (regulariser_strength, Real)
 γ parameter. More...
 
 SOPT_MACRO (lagrange_update_scale, Real)
 Lagrange update scale β More...
 
 SOPT_MACRO (is_converged, t_IsConverged)
 A function verifying convergence. More...
 
 SOPT_MACRO (Phi, t_LinearTransform)
 Measurement operator. More...
 
 SOPT_MACRO (f_proximal, t_Proximal)
 First proximal. More...
 
 SOPT_MACRO (g_proximal, t_Proximal)
 Second proximal. More...
 
void f_proximal (t_Vector &out, Real regulariser_strength, t_Vector const &x) const
 Simplifies calling the proximal of f. More...
 
void g_proximal (t_Vector &out, Real regulariser_strength, t_Vector const &x) const
 Simplifies calling the proximal of f. More...
 
ProximalADMM< Scalar > & is_converged (std::function< bool(t_Vector const &x)> const &func)
 Convergence function that takes only the output as argument. More...
 
t_Vector const & target () const
 Vector of target measurements. More...
 
template<typename DERIVED >
ProximalADMM< Scalar > & target (Eigen::MatrixBase< DERIVED > const &target)
 Sets the vector of target measurements. More...
 
bool is_converged (t_Vector const &x, t_Vector const &residual) const
 Facilitates call to user-provided convergence function. More...
 
Diagnostic operator() (t_Vector &out) const
 Calls Proximal ADMM. More...
 
Diagnostic operator() (t_Vector &out, std::tuple< t_Vector, t_Vector > const &guess) const
 Calls Proximal ADMM. More...
 
Diagnostic operator() (t_Vector &out, std::tuple< t_Vector const &, t_Vector const & > const &guess) const
 Calls Proximal ADMM. More...
 
DiagnosticAndResult operator() (std::tuple< t_Vector, t_Vector > const &guess) const
 Calls Proximal ADMM. More...
 
DiagnosticAndResult operator() (std::tuple< t_Vector const &, t_Vector const & > const &guess) const
 Calls Proximal ADMM. More...
 
DiagnosticAndResult operator() () const
 Calls Proximal ADMM. More...
 
DiagnosticAndResult operator() (DiagnosticAndResult const &warmstart) const
 Makes it simple to chain different calls to PADMM. More...
 
ProximalADMM &::type Phi (ARGS &&... args)
 
std::tuple< t_Vector, t_Vectorinitial_guess () const
 Computes initial guess for x and the residual using the targets. More...
 

Static Public Member Functions

static std::tuple< t_Vector, t_Vectorinitial_guess (t_Vector const &target, t_LinearTransform const &phi)
 Computes initial guess for x and the residual using the targets. More...
 

Detailed Description

template<typename SCALAR>
class sopt::algorithm::ProximalADMM< SCALAR >

Proximal Alternate Direction method of mutltipliers.

\(\min_{x, z} f(x) + h(z)\) subject to \(Φx + z = y\). \(y\) is a target vector.

Definition at line 19 of file padmm.h.

Member Typedef Documentation

◆ Real

template<typename SCALAR >
using sopt::algorithm::ProximalADMM< SCALAR >::Real = typename real_type<Scalar>::type

Real type.

Definition at line 26 of file padmm.h.

◆ Scalar

template<typename SCALAR >
using sopt::algorithm::ProximalADMM< SCALAR >::Scalar = value_type

Scalar type.

Definition at line 24 of file padmm.h.

◆ t_IsConverged

template<typename SCALAR >
using sopt::algorithm::ProximalADMM< SCALAR >::t_IsConverged = std::function<bool (const t_Vector &, const t_Vector &)>

Type of the convergence function.

Definition at line 32 of file padmm.h.

◆ t_LinearTransform

template<typename SCALAR >
using sopt::algorithm::ProximalADMM< SCALAR >::t_LinearTransform = LinearTransform<t_Vector>

Type of the Ψ and Ψ^H operations, as well as Φ and Φ^H.

Definition at line 30 of file padmm.h.

◆ t_Proximal

template<typename SCALAR >
using sopt::algorithm::ProximalADMM< SCALAR >::t_Proximal = ProximalFunction<Scalar>

Type of the convergence function.

Definition at line 34 of file padmm.h.

◆ t_Vector

template<typename SCALAR >
using sopt::algorithm::ProximalADMM< SCALAR >::t_Vector = Vector<Scalar>

Type of then underlying vectors.

Definition at line 28 of file padmm.h.

◆ value_type

template<typename SCALAR >
using sopt::algorithm::ProximalADMM< SCALAR >::value_type = SCALAR

Scalar type.

Definition at line 22 of file padmm.h.

Constructor & Destructor Documentation

◆ ProximalADMM()

template<typename SCALAR >
template<typename DERIVED >
sopt::algorithm::ProximalADMM< SCALAR >::ProximalADMM ( t_Proximal const &  f_proximal,
t_Proximal const &  g_proximal,
Eigen::MatrixBase< DERIVED > const &  target 
)
inline

Setups ProximalADMM

Parameters
[in]f_proximalproximal operator of the \(f\) function.
[in]g_proximalproximal operator of the \(g\) function

Definition at line 60 of file padmm.h.

62  : itermax_(std::numeric_limits<t_uint>::max()),
63  regulariser_strength_(1e-8),
64  lagrange_update_scale_(0.9),
65  is_converged_(),
66  Phi_(linear_transform_identity<Scalar>()),
67  f_proximal_(f_proximal),
68  g_proximal_(g_proximal),
69  target_(target) {}
void g_proximal(t_Vector &out, Real regulariser_strength, t_Vector const &x) const
Simplifies calling the proximal of f.
Definition: padmm.h:107
t_Vector const & target() const
Vector of target measurements.
Definition: padmm.h:117
void f_proximal(t_Vector &out, Real regulariser_strength, t_Vector const &x) const
Simplifies calling the proximal of f.
Definition: padmm.h:103

◆ ~ProximalADMM()

template<typename SCALAR >
virtual sopt::algorithm::ProximalADMM< SCALAR >::~ProximalADMM ( )
inlinevirtual

Definition at line 70 of file padmm.h.

70 {}

Member Function Documentation

◆ f_proximal()

template<typename SCALAR >
void sopt::algorithm::ProximalADMM< SCALAR >::f_proximal ( t_Vector out,
Real  regulariser_strength,
t_Vector const &  x 
) const
inline

Simplifies calling the proximal of f.

Definition at line 103 of file padmm.h.

103  {
104  f_proximal()(out, regulariser_strength, x);
105  }

◆ g_proximal()

template<typename SCALAR >
void sopt::algorithm::ProximalADMM< SCALAR >::g_proximal ( t_Vector out,
Real  regulariser_strength,
t_Vector const &  x 
) const
inline

Simplifies calling the proximal of f.

Definition at line 107 of file padmm.h.

107  {
108  g_proximal()(out, regulariser_strength, x);
109  }

◆ initial_guess() [1/2]

template<typename SCALAR >
std::tuple<t_Vector, t_Vector> sopt::algorithm::ProximalADMM< SCALAR >::initial_guess ( ) const
inline

Computes initial guess for x and the residual using the targets.

with y the vector of measurements

  • x = Φ^T y / ν
  • residuals = Φ x - y

Definition at line 183 of file padmm.h.

183  {
185  }
std::tuple< t_Vector, t_Vector > initial_guess() const
Computes initial guess for x and the residual using the targets.
Definition: padmm.h:183
ProximalADMM &::type Phi(ARGS &&... args)
Definition: padmm.h:174

References sopt::algorithm::ProximalADMM< SCALAR >::Phi(), and sopt::algorithm::ProximalADMM< SCALAR >::target().

Referenced by sopt::algorithm::ImagingProximalADMM< SCALAR >::operator()(), and sopt::algorithm::ProximalADMM< SCALAR >::operator()().

◆ initial_guess() [2/2]

template<typename SCALAR >
static std::tuple<t_Vector, t_Vector> sopt::algorithm::ProximalADMM< SCALAR >::initial_guess ( t_Vector const &  target,
t_LinearTransform const &  phi 
)
inlinestatic

Computes initial guess for x and the residual using the targets.

with y the vector of measurements

  • x = Φ^T y / ν
  • residuals = Φ x - y

This function simplifies creating overloads for operator() in PADMM wrappers.

Definition at line 193 of file padmm.h.

194  {
195  std::tuple<t_Vector, t_Vector> guess;
196  std::get<0>(guess) = static_cast<t_Vector>(phi.adjoint() * target) / phi.sq_norm();
197  std::get<1>(guess) = phi * std::get<0>(guess) - target;
198  return guess;
199  }
sopt::Vector< Scalar > t_Vector

References sopt::LinearTransform< VECTOR >::adjoint(), sopt::LinearTransform< VECTOR >::sq_norm(), and sopt::algorithm::ProximalADMM< SCALAR >::target().

◆ is_converged() [1/2]

template<typename SCALAR >
ProximalADMM<Scalar>& sopt::algorithm::ProximalADMM< SCALAR >::is_converged ( std::function< bool(t_Vector const &x)> const &  func)
inline

Convergence function that takes only the output as argument.

Definition at line 112 of file padmm.h.

112  {
113  return is_converged([func](t_Vector const &x, t_Vector const &) { return func(x); });
114  }
ProximalADMM< Scalar > & is_converged(std::function< bool(t_Vector const &x)> const &func)
Convergence function that takes only the output as argument.
Definition: padmm.h:112

Referenced by sopt::algorithm::ProximalADMM< SCALAR >::is_converged(), main(), and SCENARIO().

◆ is_converged() [2/2]

template<typename SCALAR >
bool sopt::algorithm::ProximalADMM< SCALAR >::is_converged ( t_Vector const &  x,
t_Vector const &  residual 
) const
inline

Facilitates call to user-provided convergence function.

Definition at line 126 of file padmm.h.

126  {
127  return static_cast<bool>(is_converged()) and is_converged()(x, residual);
128  }

References sopt::algorithm::ProximalADMM< SCALAR >::is_converged().

◆ operator()() [1/7]

template<typename SCALAR >
DiagnosticAndResult sopt::algorithm::ProximalADMM< SCALAR >::operator() ( ) const
inline

Calls Proximal ADMM.

Parameters
[in]guessinitial guess

Definition at line 161 of file padmm.h.

161  {
162  DiagnosticAndResult result;
163  static_cast<Diagnostic &>(result) = operator()(result.x, initial_guess());
164  return result;
165  }

References sopt::algorithm::ProximalADMM< SCALAR >::initial_guess(), and sopt::algorithm::ProximalADMM< SCALAR >::DiagnosticAndResult::x.

Referenced by sopt::algorithm::ProximalADMM< SCALAR >::operator()().

◆ operator()() [2/7]

template<typename SCALAR >
DiagnosticAndResult sopt::algorithm::ProximalADMM< SCALAR >::operator() ( DiagnosticAndResult const &  warmstart) const
inline

Makes it simple to chain different calls to PADMM.

Definition at line 167 of file padmm.h.

167  {
168  DiagnosticAndResult result = warmstart;
169  static_cast<Diagnostic &>(result) = operator()(result.x, warmstart.x, warmstart.residual);
170  return result;
171  }

References sopt::algorithm::ProximalADMM< SCALAR >::Diagnostic::residual, and sopt::algorithm::ProximalADMM< SCALAR >::DiagnosticAndResult::x.

◆ operator()() [3/7]

template<typename SCALAR >
DiagnosticAndResult sopt::algorithm::ProximalADMM< SCALAR >::operator() ( std::tuple< t_Vector const &, t_Vector const & > const &  guess) const
inline

Calls Proximal ADMM.

Parameters
[in]guessinitial guess

Definition at line 153 of file padmm.h.

154  {
155  DiagnosticAndResult result;
156  static_cast<Diagnostic &>(result) = operator()(result.x, guess);
157  return result;
158  }

References sopt::algorithm::ProximalADMM< SCALAR >::DiagnosticAndResult::x.

◆ operator()() [4/7]

template<typename SCALAR >
DiagnosticAndResult sopt::algorithm::ProximalADMM< SCALAR >::operator() ( std::tuple< t_Vector, t_Vector > const &  guess) const
inline

Calls Proximal ADMM.

Parameters
[in]guessinitial guess

Definition at line 148 of file padmm.h.

148  {
149  return operator()(std::tie(std::get<0>(guess), std::get<1>(guess)));
150  }
DiagnosticAndResult operator()() const
Calls Proximal ADMM.
Definition: padmm.h:161

References sopt::algorithm::ProximalADMM< SCALAR >::operator()().

◆ operator()() [5/7]

template<typename SCALAR >
Diagnostic sopt::algorithm::ProximalADMM< SCALAR >::operator() ( t_Vector out) const
inline

Calls Proximal ADMM.

Parameters
[out]outOutput vector x

Definition at line 132 of file padmm.h.

132 { return operator()(out, initial_guess()); }

References sopt::algorithm::ProximalADMM< SCALAR >::initial_guess(), and sopt::algorithm::ProximalADMM< SCALAR >::operator()().

Referenced by sopt::algorithm::ProximalADMM< SCALAR >::operator()().

◆ operator()() [6/7]

template<typename SCALAR >
Diagnostic sopt::algorithm::ProximalADMM< SCALAR >::operator() ( t_Vector out,
std::tuple< t_Vector const &, t_Vector const & > const &  guess 
) const
inline

Calls Proximal ADMM.

Parameters
[out]outOutput vector x
[in]guessinitial guess

Definition at line 142 of file padmm.h.

143  {
144  return operator()(out, std::get<0>(guess), std::get<1>(guess));
145  }

References sopt::algorithm::ProximalADMM< SCALAR >::operator()().

◆ operator()() [7/7]

template<typename SCALAR >
Diagnostic sopt::algorithm::ProximalADMM< SCALAR >::operator() ( t_Vector out,
std::tuple< t_Vector, t_Vector > const &  guess 
) const
inline

Calls Proximal ADMM.

Parameters
[out]outOutput vector x
[in]guessinitial guess

Definition at line 136 of file padmm.h.

136  {
137  return operator()(out, std::get<0>(guess), std::get<1>(guess));
138  }

References sopt::algorithm::ProximalADMM< SCALAR >::operator()().

◆ Phi()

template<typename SCALAR >
ProximalADMM& ::type sopt::algorithm::ProximalADMM< SCALAR >::Phi ( ARGS &&...  args)
inline

Definition at line 174 of file padmm.h.

174  {
175  Phi_ = linear_transform(std::forward<ARGS>(args)...);
176  return *this;
177  }
LinearTransform< VECTOR > linear_transform(OperatorFunction< VECTOR > const &direct, OperatorFunction< VECTOR > const &indirect, std::array< t_int, 3 > const &sizes={{1, 1, 0}})

References sopt::linear_transform().

Referenced by sopt::algorithm::ProximalADMM< SCALAR >::initial_guess(), SCENARIO(), and TEST_CASE().

◆ SOPT_MACRO() [1/7]

template<typename SCALAR >
sopt::algorithm::ProximalADMM< SCALAR >::SOPT_MACRO ( f_proximal  ,
t_Proximal   
)

First proximal.

◆ SOPT_MACRO() [2/7]

template<typename SCALAR >
sopt::algorithm::ProximalADMM< SCALAR >::SOPT_MACRO ( g_proximal  ,
t_Proximal   
)

Second proximal.

◆ SOPT_MACRO() [3/7]

template<typename SCALAR >
sopt::algorithm::ProximalADMM< SCALAR >::SOPT_MACRO ( is_converged  ,
t_IsConverged   
)

A function verifying convergence.

It takes as input two arguments: the current solution x and the current residual.

◆ SOPT_MACRO() [4/7]

template<typename SCALAR >
sopt::algorithm::ProximalADMM< SCALAR >::SOPT_MACRO ( itermax  ,
t_uint   
)

Maximum number of iterations.

◆ SOPT_MACRO() [5/7]

template<typename SCALAR >
sopt::algorithm::ProximalADMM< SCALAR >::SOPT_MACRO ( lagrange_update_scale  ,
Real   
)

Lagrange update scale β

◆ SOPT_MACRO() [6/7]

template<typename SCALAR >
sopt::algorithm::ProximalADMM< SCALAR >::SOPT_MACRO ( Phi  ,
t_LinearTransform   
)

Measurement operator.

◆ SOPT_MACRO() [7/7]

template<typename SCALAR >
sopt::algorithm::ProximalADMM< SCALAR >::SOPT_MACRO ( regulariser_strength  ,
Real   
)

γ parameter.

◆ target() [1/2]

template<typename SCALAR >
t_Vector const& sopt::algorithm::ProximalADMM< SCALAR >::target ( ) const
inline

Vector of target measurements.

Definition at line 117 of file padmm.h.

117 { return target_; }

Referenced by sopt::algorithm::ProximalADMM< SCALAR >::initial_guess(), and sopt::algorithm::ProximalADMM< SCALAR >::target().

◆ target() [2/2]

template<typename SCALAR >
template<typename DERIVED >
ProximalADMM<Scalar>& sopt::algorithm::ProximalADMM< SCALAR >::target ( Eigen::MatrixBase< DERIVED > const &  target)
inline

Sets the vector of target measurements.

Definition at line 120 of file padmm.h.

120  {
121  target_ = target;
122  return *this;
123  }

References sopt::algorithm::ProximalADMM< SCALAR >::target().


The documentation for this class was generated from the following file: