Re: Initial request for review of JDK-8006572 DoubleStream.sum()/average() implementations that reduce numerical errors

2013-12-02 Thread Mike Duigou
On Dec 1 2013, at 23:34 , Joe Darcy wrote: > Hello, > > I've heard back from my numerical reviewer. Given the signs of the terms, he > recommend when two partial sums are combined, the leading word be added in > first. I've reflected this change in the revision I'm about to push: > >http

Re: Initial request for review of JDK-8006572 DoubleStream.sum()/average() implementations that reduce numerical errors

2013-12-01 Thread Joe Darcy
Hello, I've heard back from my numerical reviewer. Given the signs of the terms, he recommend when two partial sums are combined, the leading word be added in first. I've reflected this change in the revision I'm about to push: http://cr.openjdk.java.net/~darcy/8006572.5 He had some sug

Re: Initial request for review of JDK-8006572 DoubleStream.sum()/average() implementations that reduce numerical errors

2013-11-25 Thread Mike Duigou
Looks good Mike On Nov 22 2013, at 23:06 , Joe Darcy wrote: > Hello Mike and Paul, > > Thanks for reviewing the earlier versions of the change; I've posted an > update revision for your consideration at > >http://cr.openjdk.java.net/~darcy/8006572.4/ > > Two numerical aspects of the cha

Re: Initial request for review of JDK-8006572 DoubleStream.sum()/average() implementations that reduce numerical errors

2013-11-25 Thread Paul Sandoz
+1 Paul. On Nov 23, 2013, at 8:06 AM, Joe Darcy wrote: > Hello Mike and Paul, > > Thanks for reviewing the earlier versions of the change; I've posted an > update revision for your consideration at > >http://cr.openjdk.java.net/~darcy/8006572.4/ > > Two numerical aspects of the change a

Re: Initial request for review of JDK-8006572 DoubleStream.sum()/average() implementations that reduce numerical errors

2013-11-22 Thread Joe Darcy
Hello Mike and Paul, Thanks for reviewing the earlier versions of the change; I've posted an update revision for your consideration at http://cr.openjdk.java.net/~darcy/8006572.4/ Two numerical aspects of the change are different in this iteration: * when two running compensated sums

Re: Initial request for review of JDK-8006572 DoubleStream.sum()/average() implementations that reduce numerical errors

2013-11-20 Thread Joe Darcy
Hi Mike, On 11/20/2013 10:31 AM, Mike Duigou wrote: - Collectors averagingDouble could use the same @implNote as in DoublePipeline. - DoublePipeline implementation could document the usage of the double array indices. - @summary in test. I'll reflect these in the next iteration. - I agre

Re: Initial request for review of JDK-8006572 DoubleStream.sum()/average() implementations that reduce numerical errors

2013-11-20 Thread Mike Duigou
- Collectors averagingDouble could use the same @implNote as in DoublePipeline. - DoublePipeline implementation could document the usage of the double array indices. - @summary in test. - I agree with Paul that refactoring as a testNG test would be nice. - I wondered at the mechanism for comb

Re: Initial request for review of JDK-8006572 DoubleStream.sum()/average() implementations that reduce numerical errors

2013-11-20 Thread Paul Sandoz
Hi Joe, On Nov 20, 2013, at 9:21 AM, Joe Darcy wrote: > Hi Paul, > > On 11/18/2013 07:38 AM, Paul Sandoz wrote: >> Hi Joe, >> >> You can use the three arg form of collect for DoublePipeline.sum/average >> impls, which is already used for average: >> >> public final OptionalDouble average

Re: Initial request for review of JDK-8006572 DoubleStream.sum()/average() implementations that reduce numerical errors

2013-11-20 Thread Joe Darcy
Hi Paul, On 11/18/2013 07:38 AM, Paul Sandoz wrote: Hi Joe, You can use the three arg form of collect for DoublePipeline.sum/average impls, which is already used for average: public final OptionalDouble average() { double[] avg = collect(() -> new double[2],

Re: Initial request for review of JDK-8006572 DoubleStream.sum()/average() implementations that reduce numerical errors

2013-11-18 Thread Paul Sandoz
Hi Joe, You can use the three arg form of collect for DoublePipeline.sum/average impls, which is already used for average: public final OptionalDouble average() { double[] avg = collect(() -> new double[2], (ll, i) -> {

Re: Initial request for review of JDK-8006572 DoubleStream.sum()/average() implementations that reduce numerical errors

2013-11-14 Thread Brian Goetz
You are right that collect() would be a good start, but sadly there is no DoubleCollector which trucks in doubles. So the concept is right but it doesn't quite get you all the way there. Looking one level down, you'll find a nicer answer. I would look at ReduceOps.makeDouble(), which ultimatl

Initial request for review of JDK-8006572 DoubleStream.sum()/average() implementations that reduce numerical errors

2013-11-14 Thread Joe Darcy
Hello, Please take an initial look over a fix for JDK-8006572 DoubleStream.sum() & DoubleSummaryStats implementations that reduce numerical errors http://cr.openjdk.java.net/~darcy/8006572.0/ The basic approach is to use compensated summation http://en.wikipedia.org/wiki/Kahan_su