import mir.math.sum: Summation; import mir.ndslice.slice: sliced; import mir.test: should; WSummator!(double, Summation.pairwise) x; x.put([0.0, 1, 2, 3, 4].sliced, [1, 2, 3, 4, 5].sliced); x.wsum.should == 40; x.put(5, 6); x.wsum.should == 70;
Assume no weights, like Summator
import mir.math.sum: Summation; import mir.ndslice.slice: sliced; import mir.test: should; WSummator!(double, Summation.pairwise) x; x.put([0.0, 1, 2, 3, 4].sliced); x.wsum.should == 10; x.put(5); x.wsum.should == 15;
Output range for wsum.