Package net.imglib2.util
Class RealSum
- java.lang.Object
-
- net.imglib2.util.RealSum
-
public class RealSum extends java.lang.ObjectRealSumimplements 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 Modifier and Type Field Description private doublecompensationprivate doublesum
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(double value)Add an element to the sum.doublegetSum()Get the current sum.
-
-
-
Constructor Detail
-
RealSum
public RealSum()
Create a newRealSuminitialized to zero.
-
-