[
https://issues.apache.org/jira/browse/NUMBERS-163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17365898#comment-17365898
]
Gilles Sadowski commented on NUMBERS-163:
-----------------------------------------
Re. your benchmark "SumPerformance.fmaSum" vs "SumPerformance.sum", the cause
is probably due to at least twice as many (useless) operations in {{FMA}} in
the equivalent of your {{add(double t)}}. [Although in my timings, the gap is
~2, not ~3.6. And it goes down to ~0.1 by defining an additional method.]
Re. "SumPerformance.fmaSumOfProducts" vs "SumPerformance.sumOfProducts", I
consistently get better results with {{FMA}}
So I don't think that there is a performance issue with immutability.
> Summation and LinearCombination Accumulators
> --------------------------------------------
>
> Key: NUMBERS-163
> URL: https://issues.apache.org/jira/browse/NUMBERS-163
> Project: Commons Numbers
> Issue Type: New Feature
> Reporter: Matt Juntunen
> Priority: Major
> Attachments: FMA.java, Sum.java
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> It would be useful to have simple accumulator classes in {{Summation}} and
> {{LinearCombination}} to perform extended precision operations on arbitrary
> collections of values without requiring conversion to {{double[]}}. Ex:
> {code:java}
> Summation.Accumulator sum= Summation.accumulator(1d);
> sum.add(x)
> .add(y)
> .add(z)
> .add(w);
> double sumResult = sum.get();
> LinearCombination.Accumulator comb = LinearCombination.accumulator(1d);
> comb.add(x, scale)
> .add(y, scale)
> .add(z, scale)
> .add(w, scale);
> double combResult = comb.get();
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)