SOPT
Sparse OPTimisation
Public Types | Public Member Functions | List of all members
sopt::proximal::L1TightFrame< SCALAR > Class Template Reference

L1 proximal, including linear transform. More...

#include <l1_proximal.h>

+ Inheritance diagram for sopt::proximal::L1TightFrame< SCALAR >:

Public Types

using Scalar = SCALAR
 Underlying scalar type. More...
 
using Real = typename real_type< Scalar >::type
 Underlying real scalar type. More...
 

Public Member Functions

 L1TightFrame ()
 
 SOPT_MACRO (Psi, LinearTransform< Vector< Scalar >>)
 Linear transform applied to input prior to L1 norm. More...
 
 SOPT_MACRO (nu, Real)
 Bound on the squared norm of the operator Ψ More...
 
Vector< Real > const & weights () const
 Weights of the l1 norm. More...
 
template<typename T >
L1TightFrame< Scalar > & weights (Eigen::MatrixBase< T > const &w)
 Weights of the l1 norm. More...
 
L1TightFrame< Scalar > & weights (Real const &value)
 Set weights to a single value. More...
 
L1TightFrame &::type Psi (ARGS &&... args)
 
template<typename T0 , typename T1 >
std::enable_if< is_complex< Scalar >::value==is_complex< typename T0::Scalar >::value and is_complex< Scalar >::value==is_complex< typename T1::Scalar >::value >::type operator() (Eigen::MatrixBase< T0 > &out, Real gamma, Eigen::MatrixBase< T1 > const &x) const
 Computes proximal for given γ More...
 
template<typename T0 >
ProximalExpression< L1TightFrame< Scalar > const &, T0 > operator() (Real const &gamma, Eigen::MatrixBase< T0 > const &x) const
 Lazy version. More...
 
template<typename T0 , typename T1 >
std::enable_if< is_complex< Scalar >::value==is_complex< typename T0::Scalar >::value and is_complex< Scalar >::value==is_complex< typename T1::Scalar >::value, Real >::type objective (Eigen::MatrixBase< T0 > const &x, Eigen::MatrixBase< T1 > const &z, Real const &gamma) const
 

Detailed Description

template<typename SCALAR>
class sopt::proximal::L1TightFrame< SCALAR >

L1 proximal, including linear transform.

This function computes the prox operator of the l1 norm for the input vector \(x\). It solves the problem:

\[ min_{z} 0.5||x - z||_2^2 + γ ||Ψ^† z||_w1 \]

where \(Ψ \in C^{N_x \times N_r} \) is the sparsifying operator, and

\[|| ||_w1\]

is the weighted L1 norm.

Definition at line 26 of file l1_proximal.h.

Member Typedef Documentation

◆ Real

template<typename SCALAR >
using sopt::proximal::L1TightFrame< SCALAR >::Real = typename real_type<Scalar>::type

Underlying real scalar type.

Definition at line 31 of file l1_proximal.h.

◆ Scalar

template<typename SCALAR >
using sopt::proximal::L1TightFrame< SCALAR >::Scalar = SCALAR

Underlying scalar type.

Definition at line 29 of file l1_proximal.h.

Constructor & Destructor Documentation

◆ L1TightFrame()

template<typename SCALAR >
sopt::proximal::L1TightFrame< SCALAR >::L1TightFrame ( )
inline

Definition at line 47 of file l1_proximal.h.

48  : Psi_(linear_transform_identity<Scalar>()), nu_(1e0), weights_(Vector<Real>::Ones(1)) {}
sopt::Vector< Scalar > Vector
Definition: inpainting.cc:28

Member Function Documentation

◆ objective()

template<typename SCALAR >
template<typename T0 , typename T1 >
std::enable_if< is_complex< SCALAR >::value==is_complex< typename T0::Scalar >::value and is_complex< SCALAR >::value==is_complex< typename T1::Scalar >::value, typename real_type< SCALAR >::type >::type sopt::proximal::L1TightFrame< SCALAR >::objective ( Eigen::MatrixBase< T0 > const &  x,
Eigen::MatrixBase< T1 > const &  z,
Real const &  gamma 
) const

\[ 0.5||x - z||_2^2 + γ||Ψ^† z||_w1 \]

Definition at line 149 of file l1_proximal.h.

150  {
151 #ifdef SOPT_MPI
152  auto const adj = gamma * sopt::mpi::l1_norm(static_cast<T1>(Psi().adjoint() * z), weights(),
153  adjoint_space_comm());
154  auto const dir = direct_space_comm().all_sum_all(0.5 * (x - z).squaredNorm());
155  return adj + dir;
156 #else
157  return 0.5 * (x - z).squaredNorm() +
158  gamma * sopt::l1_norm(static_cast<T1>(Psi().adjoint() * z), weights());
159 #endif
160 }
Vector< Real > const & weights() const
Weights of the l1 norm.
Definition: l1_proximal.h:74
L1TightFrame &::type Psi(ARGS &&... args)
Definition: l1_proximal.h:93
real_type< typename T0::Scalar >::type l1_norm(Eigen::ArrayBase< T0 > const &input, Eigen::ArrayBase< T1 > const &weights)
Computes weighted L1 norm.
Definition: maths.h:116

References sopt::l1_norm().

Referenced by sopt::proximal::L1< SCALAR >::Breaker::Breaker(), and sopt::proximal::L1< SCALAR >::Breaker::operator()().

◆ operator()() [1/2]

template<typename SCALAR >
template<typename T0 , typename T1 >
std::enable_if< is_complex< SCALAR >::value==is_complex< typename T0::Scalar >::value and is_complex< SCALAR >::value==is_complex< typename T1::Scalar >::value >::type sopt::proximal::L1TightFrame< SCALAR >::operator() ( Eigen::MatrixBase< T0 > &  out,
Real  gamma,
Eigen::MatrixBase< T1 > const &  x 
) const

Computes proximal for given γ

Definition at line 128 of file l1_proximal.h.

129  {
130  Vector<Scalar> const psit_x = Psi().adjoint() * x;
131  if (weights().size() == 1)
132  out = static_cast<Vector<Scalar>>(
133  Psi() * (soft_threshhold(psit_x, nu() * gamma * weights()(0)) - psit_x)) /
134  nu() +
135  x;
136  else
137  out = static_cast<Vector<Scalar>>(
138  Psi() * (soft_threshhold(psit_x, nu() * gamma * weights()) - psit_x)) /
139  nu() +
140  x;
141  SOPT_LOW_LOG("Prox L1: objective = {}", objective(x, out, gamma));
142 }
std::enable_if< is_complex< Scalar >::value==is_complex< typename T0::Scalar >::value and is_complex< Scalar >::value==is_complex< typename T1::Scalar >::value, Real >::type objective(Eigen::MatrixBase< T0 > const &x, Eigen::MatrixBase< T1 > const &z, Real const &gamma) const
Definition: l1_proximal.h:149
#define SOPT_LOW_LOG(...)
Low priority message.
Definition: logging.h:227
std::enable_if< std::is_arithmetic< SCALAR >::value or is_complex< SCALAR >::value, SCALAR >::type soft_threshhold(SCALAR const &x, typename real_type< SCALAR >::type const &threshhold)
abs(x) < threshhold ? 0: x - sgn(x) * threshhold
Definition: maths.h:29

References sopt::soft_threshhold(), and SOPT_LOW_LOG.

Referenced by sopt::proximal::L1< SCALAR >::tight_frame().

◆ operator()() [2/2]

template<typename SCALAR >
template<typename T0 >
ProximalExpression<L1TightFrame<Scalar> const &, T0> sopt::proximal::L1TightFrame< SCALAR >::operator() ( Real const &  gamma,
Eigen::MatrixBase< T0 > const &  x 
) const
inline

Lazy version.

Definition at line 106 of file l1_proximal.h.

107  {
108  return {*this, gamma, x};
109  }

◆ Psi()

template<typename SCALAR >
L1TightFrame& ::type sopt::proximal::L1TightFrame< SCALAR >::Psi ( ARGS &&...  args)
inline

Definition at line 93 of file l1_proximal.h.

93  {
94  Psi_ = linear_transform(std::forward<ARGS>(args)...);
95  return *this;
96  }
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::proximal::L1< SCALAR >::Psi().

◆ SOPT_MACRO() [1/2]

template<typename SCALAR >
sopt::proximal::L1TightFrame< SCALAR >::SOPT_MACRO ( nu  ,
Real   
)

Bound on the squared norm of the operator Ψ

◆ SOPT_MACRO() [2/2]

template<typename SCALAR >
sopt::proximal::L1TightFrame< SCALAR >::SOPT_MACRO ( Psi  ,
LinearTransform< Vector< Scalar >>   
)

Linear transform applied to input prior to L1 norm.

◆ weights() [1/3]

template<typename SCALAR >
Vector<Real> const& sopt::proximal::L1TightFrame< SCALAR >::weights ( ) const
inline

Weights of the l1 norm.

Definition at line 74 of file l1_proximal.h.

74 { return weights_; }

Referenced by sopt::proximal::L1< SCALAR >::weights().

◆ weights() [2/3]

template<typename SCALAR >
template<typename T >
L1TightFrame<Scalar>& sopt::proximal::L1TightFrame< SCALAR >::weights ( Eigen::MatrixBase< T > const &  w)
inline

Weights of the l1 norm.

Definition at line 77 of file l1_proximal.h.

77  {
78  if ((w.array() < 0e0).any()) SOPT_THROW("Weights cannot be negative");
79  if (w.stableNorm() < 1e-12) SOPT_THROW("Weights cannot be null");
80  weights_ = w;
81  return *this;
82  }
#define SOPT_THROW(MSG)
Definition: exception.h:46

References SOPT_THROW.

◆ weights() [3/3]

template<typename SCALAR >
L1TightFrame<Scalar>& sopt::proximal::L1TightFrame< SCALAR >::weights ( Real const &  value)
inline

Set weights to a single value.

Definition at line 85 of file l1_proximal.h.

85  {
86  if (value <= 0e0) SOPT_THROW("Weight cannot be negative or null");
87  weights_ = Vector<Real>::Ones(1) * value;
88  return *this;
89  }

References SOPT_THROW.


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