File tree 1 file changed +6
-6
lines changed
lib/node_modules/@stdlib/stats/incr/ewmean/lib
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ).isPr
49
49
* // returns -1.5
50
50
*/
51
51
function increwmean ( alpha ) {
52
- var v ;
52
+ var m ;
53
53
if ( ! isNonNegativeNumber ( alpha ) ) {
54
54
throw new TypeError ( 'invalid input argument. Must provide a nonnegative number. Value: `' + alpha + '`.' ) ;
55
55
}
@@ -67,14 +67,14 @@ function increwmean( alpha ) {
67
67
*/
68
68
function accumulator ( x ) {
69
69
if ( arguments . length === 0 ) {
70
- return ( v === void 0 ) ? null : v ;
70
+ return ( m === void 0 ) ? null : m ;
71
71
}
72
- if ( v === void 0 ) {
73
- v = x ;
72
+ if ( m === void 0 ) {
73
+ m = x ;
74
74
} else {
75
- v = ( alpha * x ) + ( ( 1.0 - alpha ) * v ) ;
75
+ m += alpha * ( x - m ) ;
76
76
}
77
- return v ;
77
+ return m ;
78
78
}
79
79
}
80
80
You can’t perform that action at this time.
0 commit comments