Skip to content

Commit b1c8caf

Browse files
committed
fix ESLint issue
1 parent cc27022 commit b1c8caf

File tree

3 files changed

+22
-27
lines changed

3 files changed

+22
-27
lines changed

lib/node_modules/@stdlib/stats/base/variancewd/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ console.log( v );
233233
## See Also
234234

235235
- <span class="package-name">[`@stdlib/stats/base/dvariancewd`][@stdlib/stats/base/dvariancewd]</span><span class="delimiter">: </span><span class="description">calculate the variance of a double-precision floating-point strided array using Welford's algorithm.</span>
236-
- <span class="package-name">[`@stdlib/stats/base/nanvariancewd`][@stdlib/stats/base/nanvariancewd]</span><span class="delimiter">: </span><span class="description">calculate the variance of a strided array ignoring NaN values and using Welford's algorithm.</span>
237236
- <span class="package-name">[`@stdlib/stats/base/stdevwd`][@stdlib/stats/base/stdevwd]</span><span class="delimiter">: </span><span class="description">calculate the standard deviation of a strided array using Welford's algorithm.</span>
238237
- <span class="package-name">[`@stdlib/stats/base/variance`][@stdlib/stats/base/variance]</span><span class="delimiter">: </span><span class="description">calculate the variance of a strided array.</span>
239238

lib/node_modules/@stdlib/stats/base/variancewd/lib/accessors.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,33 +24,29 @@
2424
* @private
2525
* @param {PositiveInteger} N - number of indexed elements
2626
* @param {number} correction - degrees of freedom adjustment
27-
* @param {Object} x - input array-like object supporting the accessor protocol
27+
* @param {Object} x - input array object
2828
* @param {Collection} x.data - input array data
2929
* @param {Array<Function>} x.accessors - array element accessors
3030
* @param {integer} strideX - stride length
3131
* @param {NonNegativeInteger} offsetX - starting index
3232
* @returns {number} variance
3333
*
3434
* @example
35-
* function accessor( arr, idx ) {
36-
* return arr.get( idx );
37-
* }
38-
*
3935
* var x = {
40-
* data: [ 2.0, 4.0, 6.0, 8.0, 10.0 ],
41-
* get: function( i ) { return this.data[ i ]; }
36+
* data: [ 2.0, 4.0, 6.0, 8.0 ],
37+
* accessors: [ function get(arr, idx) { return arr[idx]; } ]
4238
* };
43-
*
44-
* var v = variancewd( 5, 1, x, 1, 0 );
39+
* var v = variancewd( x.data.length, 1, x, 1, 0 );
4540
* // returns 10.0
4641
*/
42+
4743
function variancewd(N, correction, x, strideX, offsetX) {
48-
var delta2;
4944
var xbuf;
45+
var delta2;
5046
var delta;
47+
var get;
5148
var mu;
5249
var M2;
53-
var get;
5450
var ix;
5551
var v;
5652
var n;

lib/node_modules/@stdlib/stats/base/variancewd/lib/ndarray.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -101,23 +101,23 @@ function variancewd(N, correction, x, strideX, offsetX) {
101101
return NaN;
102102
}
103103

104-
o = arraylike2object(x);
105-
if (o.accessorProtocol) {
106-
return accessors(N, correction, o, strideX, offsetX);
107-
}
104+
o = arraylike2object(x);
105+
if (o.accessorProtocol) {
106+
return accessors(N, correction, o, strideX, offsetX);
107+
}
108108

109-
ix = offsetX;
110-
M2 = 0.0;
111-
mu = 0.0;
109+
ix = offsetX;
110+
M2 = 0.0;
111+
mu = 0.0;
112112

113-
for (i = 0; i < N; i++) {
114-
v = o.data[ix];
115-
delta = v - mu;
116-
mu += delta / (i + 1);
117-
delta2 = v - mu; // Calculate second delta after mean is updated
118-
M2 += delta * delta2;
119-
ix += strideX;
120-
}
113+
for (i = 0; i < N; i++) {
114+
v = o.data[ix];
115+
delta = v - mu;
116+
mu += delta / (i + 1);
117+
delta2 = v - mu; // Calculate second delta after mean is updated
118+
M2 += delta * delta2;
119+
ix += strideX;
120+
}
121121

122122
return M2 / n;
123123
}

0 commit comments

Comments
 (0)