SOPT
Sparse OPTimisation
Public Member Functions | List of all members
sopt::proximal::EuclidianNorm Class Reference

Proximal of euclidian norm. More...

#include <proximal.h>

Public Member Functions

template<typename T0 >
void operator() (Vector< typename T0::Scalar > &out, typename real_type< typename T0::Scalar >::type const &t, Eigen::MatrixBase< T0 > const &x) const
 
template<typename T0 >
ProximalExpression< EuclidianNorm, T0 > operator() (typename T0::Scalar const &t, Eigen::MatrixBase< T0 > const &x) const
 Lazy version. More...
 

Detailed Description

Proximal of euclidian norm.

Definition at line 18 of file proximal.h.

Member Function Documentation

◆ operator()() [1/2]

template<typename T0 >
ProximalExpression<EuclidianNorm, T0> sopt::proximal::EuclidianNorm::operator() ( typename T0::Scalar const &  t,
Eigen::MatrixBase< T0 > const &  x 
) const
inline

Lazy version.

Definition at line 45 of file proximal.h.

46  {
47  return {*this, t, x};
48  }

◆ operator()() [2/2]

template<typename T0 >
void sopt::proximal::EuclidianNorm::operator() ( Vector< typename T0::Scalar > &  out,
typename real_type< typename T0::Scalar >::type const &  t,
Eigen::MatrixBase< T0 > const &  x 
) const
inline

Definition at line 29 of file proximal.h.

31  {
32  using Scalar = typename T0::Scalar;
33 #ifdef SOPT_MPI
34  auto const norm = mpi::l2_norm(x, comm_);
35 #else
36  auto const norm = x.norm();
37 #endif
38  if (norm > t)
39  out = (Scalar(1) - t / norm) * x;
40  else
41  out.fill(0);
42  }
sopt::t_real Scalar
void l2_norm(Eigen::DenseBase< T0 > &out, Eigen::DenseBase< T2 > const &gamma, Eigen::DenseBase< T1 > const &x)
Definition: proximal.h:90

References sopt::proximal::l2_norm().


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