[ https://issues.apache.org/jira/browse/NUMBERS-163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17362553#comment-17362553 ]
Matt Juntunen commented on NUMBERS-163: --------------------------------------- I agree that we should keep the static methods. There is no need to instantiate an object to perform the computation in the simple cases. Additionally, I don't see how this addresses my use cases. Specifically, I want to replace the use of {{double}} accumulators [here|https://github.com/apache/commons-geometry/blob/master/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/RegionBSPTree2S.java#L173] (technically a {{Vector3D}} accumulator) with extended precision accumulators. The result would look something like this: {code:java} Summation.Accumulator xacc = Summation.accumulator(); Summation.Accumulator yacc = Summation.accumulator(); Summation.Accumulator zacc = Summation.accumulator(); for (final ConvexArea2S area : areas) { // ... xacc.add(centroidVector.getX()); yacc.add(centroidVector.getY()); zacc.add(centroidVector.getZ()); } Vector3D centroidVectorSum = Vector3D.of( xacc.get(), yacc.get(), zacc.get()); {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)