Skip to content

Commit 528b491

Browse files
committed
docs/chore(ndarray/meankbn): align README, index.js, and example with project conventions
1 parent 5d3c0d6 commit 528b491

File tree

2 files changed

+34
-14
lines changed

2 files changed

+34
-14
lines changed
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
/* eslint-disable no-console */
12
'use strict';
2-
var ndarray = require('@stdlib/ndarray/base/ctor');
3-
var Float64Array = require('@stdlib/array/float64');
4-
var meankbn = require('@stdlib/stats/base/ndarray/meankbn');
53

6-
var buf = new Float64Array([1.0, 3.0, 4.0, 2.0]);
7-
var x = new ndarray('float64', buf, [buf.length], [1], 0, 'row-major');
4+
var ndarray = require( '@stdlib/ndarray/base/ctor' );
5+
var Float64Array = require( '@stdlib/array/float64' );
6+
var meankbn = require( '@stdlib/stats/base/ndarray/meankbn' );
87

9-
console.log('mean:', meankbn([x]));
8+
var buf = new Float64Array( [ 1.0, 3.0, 4.0, 2.0 ] );
9+
var x = new ndarray( 'float64', buf, [ buf.length ], [ 1 ], 0, 'row-major' );
10+
11+
console.log( 'mean: %d', meankbn( [ x ] ) );
Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,39 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* 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+
119
'use strict';
220

321
/**
4-
* Compute the arithmetic mean of a one dimensional ndarray using improved Kahan-Babuska compensation.
22+
* Compute the arithmetic mean of a one-dimensional ndarray using the improved Kahan–Babuška algorithm.
523
*
624
* @module @stdlib/stats/base/ndarray/meankbn
725
*
826
* @example
9-
* var ndarray = require('@stdlib/ndarray/base/ctor');
10-
* var Float64Array = require('@stdlib/array/float64');
11-
* var meankbn = require('@stdlib/stats/base/ndarray/meankbn');
27+
* var ndarray = require( '@stdlib/ndarray/base/ctor' );
28+
* var Float64Array = require( '@stdlib/array/float64' );
29+
* var meankbn = require( '@stdlib/stats/base/ndarray/meankbn' );
1230
*
13-
* var buf = new Float64Array([ 1.0, 3.0, 4.0, 2.0 ]);
14-
* var x = new ndarray('float64', buf, [buf.length], [1], 0, 'row-major');
31+
* var buf = new Float64Array( [ 1.0, 3.0, 4.0, 2.0 ] );
32+
* var x = new ndarray( 'float64', buf, [ buf.length ], [ 1 ], 0, 'row-major' );
1533
*
16-
* var v = meankbn([ x ]);
34+
* var v = meankbn( [ x ] );
1735
* // returns 2.5
1836
*/
19-
var main = require('./lib/main.js');
37+
var main = require( './lib' );
2038

2139
module.exports = main;

0 commit comments

Comments
 (0)