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
* Computes the arithmetic mean of a strided array using a two-pass error correction algorithm.
31
-
*
32
-
* ## Method
33
-
*
34
-
* - This implementation uses a two-pass approach, as suggested by Neely (1966).
35
-
*
36
-
* ## References
37
-
*
38
-
* - Neely, Peter M. 1966. "Comparison of Several Algorithms for Computation of Means, Standard Deviations and Correlation Coefficients." _Communications of the ACM_ 9 (7). Association for Computing Machinery: 496–99. doi:[10.1145/365719.365958](https://doi.org/10.1145/365719.365958).
39
-
* - Schubert, Erich, and Michael Gertz. 2018. "Numerically Stable Parallel Computation of (Co-)Variance." In _Proceedings of the 30th International Conference on Scientific and Statistical Database Management_. New York, NY, USA: Association for Computing Machinery. doi:[10.1145/3221269.3223036](https://doi.org/10.1145/3221269.3223036).
40
-
*
41
-
* @param {PositiveInteger} N - number of indexed elements
42
-
* @param {NumericArray} x - input array
43
-
* @param {integer} stride - stride length
44
-
* @param {NonNegativeInteger} offset - starting index
45
-
* @returns {number} arithmetic mean
46
-
*
47
-
* @example
48
-
* var floor = require( '@stdlib/math/base/special/floor' );
49
-
*
50
-
* var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ];
51
-
* var N = floor( x.length / 2 );
52
-
*
53
-
* var v = meanpn( N, x, 2, 1 );
54
-
* // returns 1.25
55
-
*/
29
+
* Computes the arithmetic mean of a strided array using a two-pass error correction algorithm.
30
+
*
31
+
* ## Method
32
+
*
33
+
* - This implementation uses a two-pass approach, as suggested by Neely (1966).
34
+
*
35
+
* ## References
36
+
*
37
+
* - Neely, Peter M. 1966. "Comparison of Several Algorithms for Computation of Means, Standard Deviations and Correlation Coefficients." _Communications of the ACM_ 9 (7). Association for Computing Machinery: 496–99. doi:[10.1145/365719.365958](https://doi.org/10.1145/365719.365958).
38
+
* - Schubert, Erich, and Michael Gertz. 2018. "Numerically Stable Parallel Computation of (Co-)Variance." In _Proceedings of the 30th International Conference on Scientific and Statistical Database Management_. New York, NY, USA: Association for Computing Machinery. doi:[10.1145/3221269.3223036](https://doi.org/10.1145/3221269.3223036).
39
+
*
40
+
* @param {PositiveInteger} N - number of indexed elements
41
+
* @param {NumericArray} x - input array
42
+
* @param {integer} stride - stride length
43
+
* @param {NonNegativeInteger} offset - starting index
44
+
* @returns {number} arithmetic mean
45
+
*
46
+
* @example
47
+
* var floor = require( '@stdlib/math/base/special/floor' );
48
+
*
49
+
* var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ];
50
+
* var N = floor( x.length / 2 );
51
+
*
52
+
* var v = meanpn( N, x, 2, 1 );
53
+
* // returns 1.25
54
+
*/
56
55
// cspell:ignore meanpn
57
56
functionmeanpn(N,x,stride,offset){
58
57
varmu;
@@ -64,7 +63,7 @@ function meanpn( N, x, stride, offset ) {
64
63
if(N===1||stride===0){
65
64
returnx[offset];
66
65
}
67
-
// Compute an estimate for the meanpn:
66
+
// Compute an estimate for the mean:
68
67
mu=gsumpw(N,x,stride,offset)/N;
69
68
70
69
// Compute an error term:
@@ -73,7 +72,6 @@ function meanpn( N, x, stride, offset ) {
0 commit comments