Interface TraversableModule


  • interface TraversableModule
    • Method Summary

      Static Methods 
      Modifier and Type Method Description
      static <T> double[] neumaierSum​(java.lang.Iterable<T> ts, java.util.function.ToDoubleFunction<T> toDouble)
      Uses Neumaier's variant of the Kahan summation algorithm in order to sum double values.
    • Method Detail

      • neumaierSum

        static <T> double[] neumaierSum​(java.lang.Iterable<T> ts,
                                        java.util.function.ToDoubleFunction<T> toDouble)
        Uses Neumaier's variant of the Kahan summation algorithm in order to sum double values.

        See Kahan summation algorithm.

        Type Parameters:
        T - element type
        Parameters:
        ts - the elements
        toDouble - function which maps elements to double values
        Returns:
        A pair [sum, size], where sum is the compensated sum and size is the number of elements which were summed.