[ 
https://issues.apache.org/jira/browse/NUMBERS-163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17363285#comment-17363285
 ] 

Gilles Sadowski commented on NUMBERS-163:
-----------------------------------------

bq. Can you flesh out the API you're proposing?

In part, it's the same as in you PR, minus the {{Accumulator}} class:
{code}
LinearCombination acc = LinearCombination.of(0, 0, 0, 0)
    .add(u1, v1)
    .add(u2, v2)
    .add(u3, v3)
    .add(u4, v4);
{code}

We could also provide
{code}
LinearCombination s = LinearCombination.of(u1, v1, u2, v2);
s = s.add(LinearCombination.of(u3, v3, u4, v4));
{code}


> 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
>          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)

Reply via email to