You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/blas/ext/base/gsumkbn/README.md
+3
Original file line number
Diff line number
Diff line change
@@ -109,6 +109,7 @@ var v = gsumkbn.ndarray( 4, x, 2, 1 );
109
109
## Notes
110
110
111
111
- If `N <= 0`, both functions return `0.0`.
112
+
- Both functions support array-like objects having getter and setter accessors for array element access (e.g., [`@stdlib/array/base/accessor`][@stdlib/array/base/accessor]).
112
113
- Depending on the environment, the typed versions ([`dsum`][@stdlib/blas/ext/base/dsum], [`ssum`][@stdlib/blas/ext/base/ssum], etc.) are likely to be significantly more performant.
* Licensed under the Apache License, Version 2.0 (the "License");
7
+
* you may not use this file except in compliance with the License.
8
+
* You may obtain a copy of the License at
9
+
*
10
+
* http://www.apache.org/licenses/LICENSE-2.0
11
+
*
12
+
* Unless required by applicable law or agreed to in writing, software
13
+
* distributed under the License is distributed on an "AS IS" BASIS,
14
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+
* See the License for the specific language governing permissions and
16
+
* limitations under the License.
17
+
*/
18
+
19
+
'use strict';
20
+
21
+
// MODULES //
22
+
23
+
varabs=require('@stdlib/math/base/special/abs');
24
+
25
+
26
+
// MAIN //
27
+
28
+
/**
29
+
* Computes the sum of strided array elements using an improved Kahan–Babuška algorithm.
30
+
*
31
+
* ## Method
32
+
*
33
+
* - This implementation uses an "improved Kahan–Babuška algorithm", as described by Neumaier (1974).
34
+
*
35
+
* ## References
36
+
*
37
+
* - Neumaier, Arnold. 1974. "Rounding Error Analysis of Some Methods for Summing Finite Sums." _Zeitschrift Für Angewandte Mathematik Und Mechanik_ 54 (1): 39–51. doi:[10.1002/zamm.19740540106](https://doi.org/10.1002/zamm.19740540106).
38
+
*
39
+
* @private
40
+
* @param {PositiveInteger} N - number of indexed elements
41
+
* @param {Object} x - input array object
42
+
* @param {Collection} x.data - input array data
43
+
* @param {Array<Function>} x.accessors - array element accessors
44
+
* @param {integer} strideX - stride length
45
+
* @param {NonNegativeInteger} offsetX - starting index
46
+
* @returns {number} sum
47
+
*
48
+
* @example
49
+
* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' );
50
+
* var arraylike2object = require( '@stdlib/array/base/arraylike2object' );
51
+
*
52
+
* var x = toAccessorArray( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
53
+
*
54
+
* var v = gsumkbn( 4, arraylike2object( x ), 2, 1 );
0 commit comments