#include "sopt/conjugate_gradient.h"
#include <sstream>
#include <benchmark/benchmark.h>
Go to the source code of this file.
|
template<typename TYPE > |
void | matrix_cg (benchmark::State &state) |
|
template<typename TYPE > |
void | function_cg (benchmark::State &state) |
|
| BENCHMARK_TEMPLATE (matrix_cg, sopt::t_complex) -> RangePair(1, 256, 4, 12) ->UseRealTime() |
|
| BENCHMARK_TEMPLATE (matrix_cg, sopt::t_real) -> RangePair(1, 256, 4, 12) ->UseRealTime() |
|
| BENCHMARK_TEMPLATE (function_cg, sopt::t_complex) -> RangePair(1, 256, 4, 12) ->UseRealTime() |
|
| BENCHMARK_TEMPLATE (function_cg, sopt::t_real) -> RangePair(1, 256, 4, 12) ->UseRealTime() |
|
| BENCHMARK_MAIN () |
|
◆ BENCHMARK_MAIN()
◆ BENCHMARK_TEMPLATE() [1/4]
◆ BENCHMARK_TEMPLATE() [2/4]
◆ BENCHMARK_TEMPLATE() [3/4]
◆ BENCHMARK_TEMPLATE() [4/4]
◆ function_cg()
template<typename TYPE >
void function_cg |
( |
benchmark::State & |
state | ) |
|
Definition at line 21 of file conjugate_gradient.cc.
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));
sopt::Vector< Scalar > t_Vector
Solves $Ax = b$ for $x$, given $A$ and $b$.
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.
References b, sopt::epsilon(), and N.
◆ matrix_cg()
template<typename TYPE >
void matrix_cg |
( |
benchmark::State & |
state | ) |
|
Definition at line 6 of file conjugate_gradient.cc.
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));
References b, sopt::epsilon(), and N.