| 28 | |
| 29 | template<class Stats, class T> |
| 30 | boost::accumulators::accumulator_set<T, Stats> |
| 31 | accumulate_statistics(const boost::compute::vector<T>& vector, |
| 32 | boost::compute::command_queue& queue) { |
| 33 | // copy vector to the host |
| 34 | std::vector<T> host_vector(vector.size()); |
| 35 | boost::compute::copy( |
| 36 | vector.begin(), vector.end(), host_vector.begin(), queue |
| 37 | ); |
| 38 | |
| 39 | // compute desired statistics and return accumulator object |
| 40 | return std::for_each( |
| 41 | host_vector.begin(), |
| 42 | host_vector.end(), |
| 43 | boost::accumulators::accumulator_set<T, Stats>() |
| 44 | ); |
| 45 | } |
| 46 | |
| 47 | BOOST_AUTO_TEST_CASE(normal_distribution_doctest) |
| 48 | { |