49 #include <unordered_map>
50 #include <unordered_set>
68 for(
auto const& name : pqry.
names() ) {
69 mult += name.multiplicity;
77 for(
auto const& pqry : sample.
pqueries() ) {
89 auto result = std::vector<double>( sample.
tree().
edge_count(), 0.0 );
91 for(
auto const& pqry : sample.
pqueries() ) {
93 for(
auto const& place : pqry.placements() ) {
94 result[ place.edge().index() ] += place.like_weight_ratio * mult;
106 if( sample_set.
size() == 0 ) {
111 auto const set_size = sample_set.
size();
115 if( result.rows() == 0 || result.cols() == 0 ) {
120 #pragma omp parallel for schedule(dynamic)
121 for(
size_t i = 0; i < set_size; ++i ) {
122 auto const& smp = sample_set[ i ];
124 if( smp.tree().edge_count() != result.cols() ) {
125 throw std::runtime_error(
126 "Cannot calculate placement weights per edge matrix "
127 "for Samples with Trees of different size."
131 for(
auto const& pqry : smp.pqueries() ) {
133 for(
auto const& place : pqry.placements() ) {
134 result( i, place.edge().index() ) += place.like_weight_ratio * mult;
145 for(
const auto& pqry : smp.
pqueries() ) {
147 for(
auto const& name : pqry.names() ) {
148 mult += name.multiplicity;
151 double lwr_sum = 0.0;
152 for(
auto const& place : pqry.placements() ) {
153 lwr_sum += place.like_weight_ratio;
155 sum += lwr_sum * mult;
166 auto result = std::vector<double>( sample.
tree().
edge_count(), 0.0 );
168 for(
auto const& pqry : sample.
pqueries() ) {
169 for(
auto const& place : pqry.placements() ) {
170 result[ place.edge().index() ] += place.like_weight_ratio;
182 if( sample_set.
size() == 0 ) {
187 auto const set_size = sample_set.
size();
191 if( result.rows() == 0 || result.cols() == 0 ) {
196 #pragma omp parallel for schedule(dynamic)
197 for(
size_t i = 0; i < set_size; ++i ) {
198 auto const& smp = sample_set[ i ];
200 if( smp.tree().edge_count() != result.cols() ) {
201 throw std::runtime_error(
202 "Cannot calculate placement weights per edge matrix "
203 "for Samples with Trees of different size."
207 for(
auto const& pqry : smp.pqueries() ) {
208 for(
auto const& place : pqry.placements() ) {
209 result( i, place.edge().index() ) += place.like_weight_ratio;
220 for(
const auto& pqry : smp.
pqueries() ) {
221 for(
auto& place : pqry.placements() ) {
222 sum += place.like_weight_ratio;