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

Proximal for indicator function of L2 ball. More...

#include <proximal.h>

+ Inheritance diagram for sopt::proximal::L2Ball< T >:

Public Types

using Real = typename real_type< T >::type
 

Public Member Functions

 L2Ball (Real epsilon)
 Constructs an L2 ball proximal of size epsilon. More...
 
void operator() (Vector< T > &out, typename real_type< T >::type, Vector< T > const &x) const
 Calls proximal function. More...
 
void operator() (Vector< T > &out, Vector< T > const &x) const
 Calls proximal function. More...
 
template<typename T0 >
EnveloppeExpression< L2Ball, T0 > operator() (Real const &, Eigen::MatrixBase< T0 > const &x) const
 Lazy version. More...
 
template<typename T0 >
EnveloppeExpression< L2Ball, T0 > operator() (Eigen::MatrixBase< T0 > const &x) const
 Lazy version. More...
 
Real epsilon () const
 Size of the ball. More...
 
L2Ball< T > & epsilon (Real eps)
 Size of the ball. More...
 

Detailed Description

template<typename T>
class sopt::proximal::L2Ball< T >

Proximal for indicator function of L2 ball.

Definition at line 182 of file proximal.h.

Member Typedef Documentation

◆ Real

template<typename T >
using sopt::proximal::L2Ball< T >::Real = typename real_type<T>::type

Definition at line 184 of file proximal.h.

Constructor & Destructor Documentation

◆ L2Ball()

template<typename T >
sopt::proximal::L2Ball< T >::L2Ball ( Real  epsilon)
inline

Constructs an L2 ball proximal of size epsilon.

Definition at line 190 of file proximal.h.

190 : epsilon_(epsilon) {}
Real epsilon() const
Size of the ball.
Definition: proximal.h:222

Member Function Documentation

◆ epsilon() [1/2]

template<typename T >
Real sopt::proximal::L2Ball< T >::epsilon ( ) const
inline

Size of the ball.

Definition at line 222 of file proximal.h.

222 { return epsilon_; }

Referenced by sopt::proximal::WeightedL2Ball< T >::epsilon(), sopt::proximal::L2Ball< T >::operator()(), and TEST_CASE().

◆ epsilon() [2/2]

template<typename T >
L2Ball<T>& sopt::proximal::L2Ball< T >::epsilon ( Real  eps)
inline

Size of the ball.

Definition at line 224 of file proximal.h.

224  {
225  epsilon_ = eps;
226  return *this;
227  }

◆ operator()() [1/4]

template<typename T >
template<typename T0 >
EnveloppeExpression<L2Ball, T0> sopt::proximal::L2Ball< T >::operator() ( Eigen::MatrixBase< T0 > const &  x) const
inline

Lazy version.

Definition at line 217 of file proximal.h.

217  {
218  return {*this, x};
219  }

◆ operator()() [2/4]

template<typename T >
template<typename T0 >
EnveloppeExpression<L2Ball, T0> sopt::proximal::L2Ball< T >::operator() ( Real const &  ,
Eigen::MatrixBase< T0 > const &  x 
) const
inline

Lazy version.

Definition at line 211 of file proximal.h.

211  {
212  return {*this, x};
213  }

◆ operator()() [3/4]

template<typename T >
void sopt::proximal::L2Ball< T >::operator() ( Vector< T > &  out,
typename real_type< T >::type  ,
Vector< T > const &  x 
) const
inline

Calls proximal function.

Definition at line 194 of file proximal.h.

194  {
195  return operator()(out, x);
196  }
void operator()(Vector< T > &out, typename real_type< T >::type, Vector< T > const &x) const
Calls proximal function.
Definition: proximal.h:194

◆ operator()() [4/4]

template<typename T >
void sopt::proximal::L2Ball< T >::operator() ( Vector< T > &  out,
Vector< T > const &  x 
) const
inline

Calls proximal function.

Definition at line 198 of file proximal.h.

198  {
199 #ifdef SOPT_MPI
200  auto const norm = mpi::l2_norm(x, comm_);
201 #else
202  auto const norm = x.stableNorm();
203 #endif
204  if (norm > epsilon())
205  out = x * (epsilon() / norm);
206  else
207  out = x;
208  }
void l2_norm(Eigen::DenseBase< T0 > &out, Eigen::DenseBase< T2 > const &gamma, Eigen::DenseBase< T1 > const &x)
Definition: proximal.h:90

References sopt::proximal::L2Ball< T >::epsilon(), and sopt::proximal::l2_norm().


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