3 #include <benchmark/benchmark.h>
5 template <
typename TYPE>
7 auto const N = state.range_x();
8 auto const epsilon = std::pow(10, -state.range_y());
12 auto const AhA = A.matrix().transpose().conjugate() * A.matrix();
13 auto const Ahb = A.matrix().transpose().conjugate() *
b.matrix();
16 while (state.KeepRunning()) cg(output, AhA, Ahb);
17 state.SetBytesProcessed(int64_t(state.iterations()) * int64_t(
N) *
sizeof(TYPE));
20 template <
typename TYPE>
22 auto const N = state.range_x();
23 auto const epsilon = std::pow(10, -state.range_y());
27 auto const AhA = A.matrix().transpose().conjugate() * A.matrix();
28 auto const Ahb = A.matrix().transpose().conjugate() *
b.matrix();
30 auto func = [&AhA](
t_Vector &out,
t_Vector const &input) { out = AhA * input; };
33 while (state.KeepRunning()) cg(output, func, Ahb);
34 state.SetBytesProcessed(int64_t(state.iterations()) * int64_t(
N) *
sizeof(TYPE));
void function_cg(benchmark::State &state)
BENCHMARK_TEMPLATE(matrix_cg, sopt::t_complex) -> RangePair(1, 256, 4, 12) ->UseRealTime()
void matrix_cg(benchmark::State &state)
sopt::Vector< Scalar > t_Vector
Solves $Ax = b$ for $x$, given $A$ and $b$.
double t_real
Root of the type hierarchy for real numbers.
Eigen::Array< T, Eigen::Dynamic, Eigen::Dynamic > Image
A 2-dimensional list of elements of given type.
real_type< T >::type epsilon(sopt::LinearTransform< Vector< T >> const &sampling, sopt::Image< T > const &image)
Eigen::Array< T, Eigen::Dynamic, 1 > Array
A 1-dimensional list of elements of given type.
Eigen::Matrix< T, Eigen::Dynamic, 1 > Vector
A vector of a given type.
std::complex< t_real > t_complex
Root of the type hierarchy for (real) complex numbers.