SOPT
Sparse OPTimisation
Functions
l1_proximal.cc File Reference
#include <sstream>
#include <benchmark/benchmark.h>
#include "sopt/l1_proximal.h"
#include "sopt/real_type.h"
#include "sopt/types.h"
+ Include dependency graph for l1_proximal.cc:

Go to the source code of this file.

Functions

template<typename TYPE >
void function_l1p (benchmark::State &state)
 
 BENCHMARK_TEMPLATE (function_l1p, sopt::t_complex) -> RangePair(1, 256, 4, 12) ->UseRealTime()
 
 BENCHMARK_TEMPLATE (function_l1p, sopt::t_real) -> RangePair(1, 256, 4, 12) ->UseRealTime()
 
 BENCHMARK_MAIN ()
 

Function Documentation

◆ BENCHMARK_MAIN()

BENCHMARK_MAIN ( )

◆ BENCHMARK_TEMPLATE() [1/2]

BENCHMARK_TEMPLATE ( function_l1p  ,
sopt::t_complex   
) -> RangePair(1, 256, 4, 12) ->UseRealTime()

◆ BENCHMARK_TEMPLATE() [2/2]

BENCHMARK_TEMPLATE ( function_l1p  ,
sopt::t_real   
) -> RangePair(1, 256, 4, 12) ->UseRealTime()

◆ function_l1p()

template<typename TYPE >
void function_l1p ( benchmark::State &  state)

Definition at line 8 of file l1_proximal.cc.

8  {
9  using Real = typename sopt::real_type<TYPE>::type;
10  auto const N = state.range_x();
11  auto const input = sopt::Vector<TYPE>::Random(N).eval();
12  auto const Psi = sopt::Matrix<TYPE>::Random(input.size(), input.size() * 10).eval();
13  sopt::Vector<Real> const weights =
14  sopt::Vector<TYPE>::Random(Psi.cols()).normalized().array().abs();
15 
16  auto const l1 = sopt::proximal::L1<TYPE>()
17  .tolerance(std::pow(10, -state.range_y()))
18  .itermax(100)
19  .fista_mixing(true)
20  .positivity_constraint(true)
21  .nu(1)
22  .Psi(Psi)
23  .weights(weights);
24 
25  Real const gamma = 1e-2 / Psi.array().abs().sum();
26  auto output = sopt::Vector<TYPE>::Zero(N).eval();
27  while (state.KeepRunning()) l1(output, gamma, input);
28  state.SetBytesProcessed(int64_t(state.iterations()) * int64_t(N) * sizeof(TYPE));
29 }
constexpr auto N
Definition: wavelets.cc:57
Computes inner-most element type.
Definition: real_type.h:42
L1 proximal, including linear transform.
Definition: l1_proximal.h:169
Real nu() const
Bounds on the squared norm of the operator Ψ
Definition: l1_proximal.h:294
Eigen::Matrix< T, Eigen::Dynamic, 1 > Vector
A vector of a given type.
Definition: types.h:24
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > Matrix
A matrix of a given type.
Definition: types.h:29

References N, and sopt::proximal::L1< SCALAR >::nu().