ROOT 6.10/09 Reference Guide |
The Kahan compensate summation algorithm significantly reduces the numerical error in the total obtained by adding a sequence of finite precision floating point numbers.
This is done by keeping a separate running compensation (a variable to accumulate small errors).
The intial values of the result and the correction are set to the default value of the type it hass been instantiated with.
####Examples:
Public Member Functions | |
KahanSum (const T &initialValue=T{}) | |
Constructor accepting a initial value for the summation as parameter. More... | |
void | Add (const T &x) |
Single element accumulated addition. More... | |
template<class Iterator > | |
void | Add (const Iterator begin, const Iterator end) |
Iterate over a datastructure referenced by a pointer and accumulate on the exising result. More... | |
T | Result () |
Return the result. More... | |
Static Public Member Functions | |
template<class Iterator > | |
static T | Accumulate (const Iterator begin, const Iterator end, const T &initialValue=T{}) |
Iterate over a datastructure referenced by a pointer and return the result of its accumulation. More... | |
Private Attributes | |
T | fCorrection {} |
T | fSum {} |
#include <Math/Util.h>
|
inline |
|
inlinestatic |
|
inline |
|
inline |
|
inline |
|
private |
|
private |