[ https://issues.apache.org/jira/browse/NUMBERS-163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17362551#comment-17362551 ]
Gilles Sadowski edited comment on NUMBERS-163 at 6/13/21, 2:29 PM: ------------------------------------------------------------------- {quote}I don't think the static method should be replaced. {quote} What's the problem with writing {code:java} double r = LinearCombination.of(a, b, c, d).getAsDouble(); {code} in place of {code:java} double = LinearCombination.value(a, b, c, d); {code} ? I'd be more wary about creating a supplementary {{Accumulator}} class in order to hold the state required to provide Matt's feature, whereas it could be readily stored within a {{LinearCombination}} instance (IIUC). was (Author: erans): bq. I don't think the static method should be replaced. What's the problem with writing {code} double r = LinearCombination.of(a, b, c, d).getAsDouble(); {code} in place of {code} double = LinearCombination.value(a, b, c, d); {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 > > 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)