Class RealSum
java.lang.Object
net.imglib2.util.RealSum
RealSum implements a method to reduce numerical instabilities when
summing up a very large number of double precision numbers. Numerical
problems occur when a small number is added to an already very large sum. In
such case, the reduced accuracy of the very large number may lead to the
small number being entirely ignored. The method here is Neumaier's
improvement of the Kahan summation algorithm.
See this
Wikipedia article for details.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
sum
private double sum -
compensation
private double compensation
-
-
Constructor Details
-
Method Details
-
getSum
public double getSum()Get the current sum. -
add
public void add(double value) Add an element to the sum.- Parameters:
value- the summand to be added
-