Skip to content

Commit

Permalink
Fix Noetic builds
Browse files Browse the repository at this point in the history
Signed-off-by: Nahuel Espinosa <[email protected]>
  • Loading branch information
nahueespinosa committed Jul 9, 2024
1 parent 054dd02 commit 8d62ed1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions beluga/include/beluga/algorithm/cluster_based_estimation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ template <class States, class Weights, class Clusters>
return particles |
#if RANGE_V3_MAJOR == 0 && RANGE_V3_MINOR < 12
// Compatibility support for old Range-v3 versions that don't have a `chunk_by` view.
// The difference with between the deprecated `group_by` and the standard `chunk_by` is:
// The difference between the deprecated `group_by` and the standard `chunk_by` is:
// - group_by: The predicate is evaluated between the first element in the group and the current one.
// - chunk_by: The predicate is evaluated between adjacent elements.
//
Expand All @@ -381,13 +381,17 @@ template <class States, class Weights, class Clusters>
#endif
ranges::views::cache1 | //
ranges::views::filter([](auto subrange) {
#if RANGE_V3_MAJOR == 0 && RANGE_V3_MINOR < 11
return ranges::distance(subrange) > 1;
#else
// If there's only one sample in the cluster we can't estimate the covariance.
return subrange.size() > 1;
#endif
}) |
ranges::views::transform([](auto subrange) {
auto states = subrange | ranges::views::transform(&Particle::state);
auto weights = subrange | ranges::views::transform(&Particle::weight);
const auto [mean, covariance] = estimate(states, weights);
const auto [mean, covariance] = beluga::estimate(states, weights);
const auto total_weight = ranges::accumulate(weights, 0.0);
return Estimate{total_weight, std::move(mean), std::move(covariance)};
}) |
Expand Down

0 comments on commit 8d62ed1

Please sign in to comment.