Adds a constant to each strided array element and computes the sum using a second-order iterative Kahan–Babuška algorithm.
number of indexed elements
constant
input array
stride length
sum
var x = [ 1.0, -2.0, 2.0 ];
var v = gapxsumkbn2( x.length, 5.0, x, 1 );
// returns 16.0
Adds a constant to each strided array element and computes the sum using a second-order iterative Kahan–Babuška algorithm and alternative indexing semantics.
number of indexed elements
constant
input array
stride length
starting index
sum
var x = [ 1.0, -2.0, 2.0 ];
var v = gapxsumkbn2.ndarray( x.length, 5.0, x, 1, 0 );
// returns 16.0
Interface describing
gapxsumkbn2
.