From c5090dfa6b92fb6bca7c54a9288787ecc38c495d Mon Sep 17 00:00:00 2001 From: Nahuel Espinosa Date: Tue, 9 Jul 2024 19:29:28 -0300 Subject: [PATCH] Fix Noetic builds Signed-off-by: Nahuel Espinosa --- .../include/beluga/algorithm/cluster_based_estimation.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/beluga/include/beluga/algorithm/cluster_based_estimation.hpp b/beluga/include/beluga/algorithm/cluster_based_estimation.hpp index 150aa0e57..6c1e18ee0 100644 --- a/beluga/include/beluga/algorithm/cluster_based_estimation.hpp +++ b/beluga/include/beluga/algorithm/cluster_based_estimation.hpp @@ -381,13 +381,17 @@ template #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)}; }) |