Skip to content

Commit

Permalink
update vstat
Browse files Browse the repository at this point in the history
  • Loading branch information
takenori-y committed Nov 8, 2024
1 parent 330f7d8 commit c0f0f9d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/math/statistics_accumulation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit c0f0f9d

Please sign in to comment.