Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed the summation for non-real types
  • Loading branch information
xvallspl committed Apr 6, 2017
commit 1f0f1e663fa726bd3f6259e16382bb1d8b95d21b
9 changes: 5 additions & 4 deletions math/mathcore/inc/Math/Util.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,22 @@ namespace ROOT {
this->Add(e);
}

static double Accumulate(const std::vector<T> &elements)
static T Accumulate(const std::vector<T> &elements)
{

KahanSum init;
init.Add(elements);
return init.sum;
}

double Result()
T Result()
{
return sum;
}

private:
double sum = 0.;
double correction = 0.;
T sum{};
T correction{};
};

} // end namespace Math
Expand Down