| 25 | |
| 26 | template<typename ResVec, typename InVec, typename Mat> |
| 27 | struct BenchFixture : benchmark::Fixture |
| 28 | { |
| 29 | void SetUp(benchmark::State &) |
| 30 | { |
| 31 | y.reserve(N); |
| 32 | x.reserve(N); |
| 33 | t.reserve(N); |
| 34 | M.reserve(N); |
| 35 | dotprod.reserve(N); |
| 36 | for (std::size_t i = 0; i < N; ++i) |
| 37 | { |
| 38 | y.push_back(ResVec::Zero()); |
| 39 | x.push_back(InVec::Random()); |
| 40 | t.push_back(InVec::Random()); |
| 41 | M.push_back(Mat::Random()); |
| 42 | dotprod.push_back(0); |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | void TearDown(benchmark::State &) |
| 47 | { |
| 48 | } |
| 49 | |
| 50 | // y = sum_i M_i * x_i + t_i |
| 51 | std::vector<ResVec, Eigen::aligned_allocator<ResVec>> y; |
| 52 | std::vector<InVec, Eigen::aligned_allocator<InVec>> x; |
| 53 | std::vector<InVec, Eigen::aligned_allocator<InVec>> t; |
| 54 | std::vector<Mat, Eigen::aligned_allocator<Mat>> M; |
| 55 | std::vector<typename ResVec::Scalar> dotprod; |
| 56 | }; |
| 57 | |
| 58 | using Bench33f = BenchFixture<Vec3f, Vec3f, Mat3f>; |
| 59 | BENCHMARK_DEFINE_F(Bench33f, Mat3Vec3f)(benchmark::State & st) |
nothing calls this directly
no outgoing calls
no test coverage detected