3#ifndef cMHN_UTILITY_COMBINE_PDS_H
4#define cMHN_UTILITY_COMBINE_PDS_H
21 template<
class T,
class S>
22 static inline auto combinePDs(std::vector<std::map<S, T>>
const &pDs,
23 std::vector<pRC::Index>
const &lengths)
25 std::map<S, T> res_pD;
27 T sum = pRC::zero<T>();
29 for(pRC::Index i = 0; i < pDs.size(); ++i)
31 auto const pD = pDs[i];
32 auto const length = lengths[i];
33 for(
auto const &[k, v] : pD)
35 res_pD.try_emplace(k, pRC::zero<T>());
36 res_pD[k] +=
T(length) * v;
41 for(
auto &[k, v] : res_pD)
pRC::Float<> T
Definition: externs_nonTT.hpp:1
Definition: calculate_pTheta.hpp:15
static auto combinePDs(std::vector< std::map< S, T > > const &pDs, std::vector< pRC::Index > const &lengths)
Combines multiple data distributions into a single distribution.
Definition: combine_pDs.hpp:22