From c0f0f9d0402b1a42ebb1294a12d6323bb68e01de Mon Sep 17 00:00:00 2001 From: takenori-y Date: Sat, 9 Nov 2024 02:25:09 +0900 Subject: [PATCH] update vstat --- src/math/statistics_accumulation.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/math/statistics_accumulation.cc b/src/math/statistics_accumulation.cc index eea8541..c81897b 100644 --- a/src/math/statistics_accumulation.cc +++ b/src/math/statistics_accumulation.cc @@ -401,12 +401,10 @@ bool StatisticsAccumulation::Merge( // Merge 1st order statistics. if (!first.empty()) { if (numerically_stable_) { - const double a(n / mpn); - const double b(m / mpn); - std::transform(first.begin(), first.end(), - buffer->first_order_statistics_.begin(), - buffer->first_order_statistics_.begin(), - [a, b](double x, double y) { return a * x + b * y; }); + const double c(m / mpn); + std::transform(buffer->delta_.begin(), buffer->delta_.end(), + first.begin(), buffer->first_order_statistics_.begin(), + [c](double x, double y) { return c * x + y; }); } else { std::transform( first.begin(), first.end(), buffer->first_order_statistics_.begin(),