8 std::size_t
computeSum(
const std::vector< SummandDefinition > &sum_def,
9 std::size_t eta_offset,
10 std::size_t row_stride,
12 const std::vector<std::size_t> &
stat) {
15 assert( eta_offset + row_stride * summand.first + seed_i <
stat.size() );
16 sum +=
stat[eta_offset + row_stride * summand.first + seed_i ] * summand.second;
21 std::vector<float>
computeRatios(
const std::vector<RatioDefinition> &ratio_def,
23 const std::size_t sub_categories,
24 const std::vector< std::size_t> &
counter)
26 std::vector<float>
ratio;
28 std::stringstream
msg;
29 msg <<
"Category and sub category dimensions " <<
categories <<
" * " << sub_categories
30 <<
" not a common factor of the input counter vector "
32 throw std::logic_error(
msg.str());
38 std::size_t input_sub_category_stride =
categories * n_counter;
40 std::size_t ratio_sub_category_stride = ratio_stride * ratio_def.size();
42 for (std::size_t sub_category_i=0; sub_category_i < sub_categories; ++sub_category_i) {
43 for (std::size_t ratio_i=0; ratio_i<ratio_def.size(); ++ratio_i) {
44 for (std::size_t category_i=0; category_i<
categories; ++category_i) {
45 std::size_t ratio_dest_idx = sub_category_i * ratio_sub_category_stride + ratio_stride * ratio_i + category_i;
46 assert(ratio_dest_idx <
ratio.size());
47 assert( sub_category_i * input_sub_category_stride <
counter.size() );
48 assert( sub_category_i * input_sub_category_stride + n_counter * input_counter_stride <=
counter.size() );
50 sub_category_i * input_sub_category_stride,