diff --git a/lib/node_modules/@stdlib/stats/base/ndarray/smean/README.md b/lib/node_modules/@stdlib/stats/base/ndarray/smeanors/README.md similarity index 81% rename from lib/node_modules/@stdlib/stats/base/ndarray/smean/README.md rename to lib/node_modules/@stdlib/stats/base/ndarray/smeanors/README.md index fc48d5c9ff3e..4fbe51efc662 100644 --- a/lib/node_modules/@stdlib/stats/base/ndarray/smean/README.md +++ b/lib/node_modules/@stdlib/stats/base/ndarray/smeanors/README.md @@ -18,9 +18,9 @@ limitations under the License. --> -# smean +# smeanors -> Compute the [arithmetic mean][arithmetic-mean] of a one-dimensional single-precision floating-point ndarray. +> Compute the [arithmetic mean][arithmetic-mean] of a one-dimensional single-precision floating-point ndarray using ordinary recursive summation.
@@ -48,12 +48,12 @@ The [arithmetic mean][arithmetic-mean] is defined as ## Usage ```javascript -var smean = require( '@stdlib/stats/base/ndarray/smean' ); +var smeanors = require( '@stdlib/stats/base/ndarray/smeanors' ); ``` -#### smean( arrays ) +#### smeanors( arrays ) -Computes the [arithmetic mean][arithmetic-mean] of a one-dimensional single-precision floating-point ndarray. +Computes the [arithmetic mean][arithmetic-mean] of a one-dimensional single-precision floating-point ndarray using ordinary recursive summation. ```javascript var Float32Array = require( '@stdlib/array/float32' ); @@ -62,7 +62,7 @@ var ndarray = require( '@stdlib/ndarray/base/ctor' ); var xbuf = new Float32Array( [ 1.0, 3.0, 4.0, 2.0 ] ); var x = new ndarray( 'float32', xbuf, [ 4 ], [ 1 ], 0, 'row-major' ); -var v = smean( [ x ] ); +var v = smeanors( [ x ] ); // returns 2.5 ``` @@ -79,6 +79,7 @@ The function has the following parameters: ## Notes - If provided an empty one-dimensional ndarray, the function returns `NaN`. +- Ordinary recursive summation (i.e., a "simple" sum) is performant, but can incur significant numerical error. If performance is paramount and error tolerated, using ordinary recursive summation to compute an arithmetic mean is acceptable; in all other cases, exercise due caution.
@@ -94,7 +95,7 @@ The function has the following parameters: var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var ndarray = require( '@stdlib/ndarray/base/ctor' ); var ndarray2array = require( '@stdlib/ndarray/to-array' ); -var smean = require( '@stdlib/stats/base/ndarray/smean' ); +var smeanors = require( '@stdlib/stats/base/ndarray/smeanors' ); var xbuf = discreteUniform( 10, -50, 50, { 'dtype': 'float32' @@ -102,7 +103,7 @@ var xbuf = discreteUniform( 10, -50, 50, { var x = new ndarray( 'float32', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' ); console.log( ndarray2array( x ) ); -var v = smean( [ x ] ); +var v = smeanors( [ x ] ); console.log( v ); ``` diff --git a/lib/node_modules/@stdlib/stats/base/ndarray/smean/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/ndarray/smeanors/benchmark/benchmark.js similarity index 96% rename from lib/node_modules/@stdlib/stats/base/ndarray/smean/benchmark/benchmark.js rename to lib/node_modules/@stdlib/stats/base/ndarray/smeanors/benchmark/benchmark.js index 8bcaa80d5d0b..961d0b60eeb5 100644 --- a/lib/node_modules/@stdlib/stats/base/ndarray/smean/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/ndarray/smeanors/benchmark/benchmark.js @@ -26,7 +26,7 @@ var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); var ndarray = require( '@stdlib/ndarray/base/ctor' ); var pkg = require( './../package.json' ).name; -var smean = require( './../lib' ); +var smeanors = require( './../lib' ); // VARIABLES // @@ -60,7 +60,7 @@ function createBenchmark( len ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - v = smean( [ x ] ); + v = smeanors( [ x ] ); if ( isnan( v ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/ndarray/smean/docs/img/equation_arithmetic_mean.svg b/lib/node_modules/@stdlib/stats/base/ndarray/smeanors/docs/img/equation_arithmetic_mean.svg similarity index 100% rename from lib/node_modules/@stdlib/stats/base/ndarray/smean/docs/img/equation_arithmetic_mean.svg rename to lib/node_modules/@stdlib/stats/base/ndarray/smeanors/docs/img/equation_arithmetic_mean.svg diff --git a/lib/node_modules/@stdlib/stats/base/ndarray/smean/docs/repl.txt b/lib/node_modules/@stdlib/stats/base/ndarray/smeanors/docs/repl.txt similarity index 93% rename from lib/node_modules/@stdlib/stats/base/ndarray/smean/docs/repl.txt rename to lib/node_modules/@stdlib/stats/base/ndarray/smeanors/docs/repl.txt index bc6abcc82d7a..2c76e92b6d0d 100644 --- a/lib/node_modules/@stdlib/stats/base/ndarray/smean/docs/repl.txt +++ b/lib/node_modules/@stdlib/stats/base/ndarray/smeanors/docs/repl.txt @@ -1,7 +1,7 @@ {{alias}}( arrays ) Computes the arithmetic mean of a one-dimensional single-precision floating- - point ndarray. + point ndarray using ordinary recursive summation. If provided an empty ndarray, the function returns `NaN`. diff --git a/lib/node_modules/@stdlib/stats/base/ndarray/smean/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/base/ndarray/smeanors/docs/types/index.d.ts similarity index 87% rename from lib/node_modules/@stdlib/stats/base/ndarray/smean/docs/types/index.d.ts rename to lib/node_modules/@stdlib/stats/base/ndarray/smeanors/docs/types/index.d.ts index d2ed098267fe..83fee705f410 100644 --- a/lib/node_modules/@stdlib/stats/base/ndarray/smean/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/stats/base/ndarray/smeanors/docs/types/index.d.ts @@ -23,7 +23,7 @@ import { float32ndarray } from '@stdlib/types/ndarray'; /** -* Computes the arithmetic mean of a one-dimensional single-precision floating-point ndarray. +* Computes the arithmetic mean of a one-dimensional single-precision floating-point ndarray using ordinary recursive summation. * * @param arrays - array-like object containing an input ndarray * @returns arithmetic mean @@ -35,12 +35,12 @@ import { float32ndarray } from '@stdlib/types/ndarray'; * var xbuf = new Float32Array( [ 1.0, 3.0, 4.0, 2.0 ] ); * var x = new ndarray( 'float32', xbuf, [ 4 ], [ 1 ], 0, 'row-major' ); * -* var v = smean( [ x ] ); +* var v = smeanors( [ x ] ); * // returns 2.5 */ -declare function smean( arrays: [ float32ndarray ] ): number; +declare function smeanors( arrays: [ float32ndarray ] ): number; // EXPORTS // -export = smean; +export = smeanors; diff --git a/lib/node_modules/@stdlib/stats/base/ndarray/smean/docs/types/test.ts b/lib/node_modules/@stdlib/stats/base/ndarray/smeanors/docs/types/test.ts similarity index 69% rename from lib/node_modules/@stdlib/stats/base/ndarray/smean/docs/types/test.ts rename to lib/node_modules/@stdlib/stats/base/ndarray/smeanors/docs/types/test.ts index 4e147783558e..61a59d0af647 100644 --- a/lib/node_modules/@stdlib/stats/base/ndarray/smean/docs/types/test.ts +++ b/lib/node_modules/@stdlib/stats/base/ndarray/smeanors/docs/types/test.ts @@ -19,7 +19,7 @@ /* eslint-disable space-in-parens */ import zeros = require( '@stdlib/ndarray/zeros' ); -import smean = require( './index' ); +import smeanors = require( './index' ); // TESTS // @@ -30,20 +30,20 @@ import smean = require( './index' ); 'dtype': 'float32' }); - smean( [ x ] ); // $ExpectType number + smeanors( [ x ] ); // $ExpectType number } // The compiler throws an error if the function is provided a first argument which is not an array of ndarrays... { - smean( '10' ); // $ExpectError - smean( 10 ); // $ExpectError - smean( true ); // $ExpectError - smean( false ); // $ExpectError - smean( null ); // $ExpectError - smean( undefined ); // $ExpectError - smean( [] ); // $ExpectError - smean( {} ); // $ExpectError - smean( ( x: number ): number => x ); // $ExpectError + smeanors( '10' ); // $ExpectError + smeanors( 10 ); // $ExpectError + smeanors( true ); // $ExpectError + smeanors( false ); // $ExpectError + smeanors( null ); // $ExpectError + smeanors( undefined ); // $ExpectError + smeanors( [] ); // $ExpectError + smeanors( {} ); // $ExpectError + smeanors( ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the function is provided an unsupported number of arguments... @@ -52,6 +52,6 @@ import smean = require( './index' ); 'dtype': 'float32' }); - smean(); // $ExpectError - smean( [ x ], {} ); // $ExpectError + smeanors(); // $ExpectError + smeanors( [ x ], {} ); // $ExpectError } diff --git a/lib/node_modules/@stdlib/stats/base/ndarray/smean/examples/index.js b/lib/node_modules/@stdlib/stats/base/ndarray/smeanors/examples/index.js similarity index 94% rename from lib/node_modules/@stdlib/stats/base/ndarray/smean/examples/index.js rename to lib/node_modules/@stdlib/stats/base/ndarray/smeanors/examples/index.js index ce25addfd46a..9c95a9ca819e 100644 --- a/lib/node_modules/@stdlib/stats/base/ndarray/smean/examples/index.js +++ b/lib/node_modules/@stdlib/stats/base/ndarray/smeanors/examples/index.js @@ -21,7 +21,7 @@ var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var ndarray = require( '@stdlib/ndarray/base/ctor' ); var ndarray2array = require( '@stdlib/ndarray/to-array' ); -var smean = require( './../lib' ); +var smeanors = require( './../lib' ); var xbuf = discreteUniform( 10, -50, 50, { 'dtype': 'float32' @@ -29,5 +29,5 @@ var xbuf = discreteUniform( 10, -50, 50, { var x = new ndarray( 'float32', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' ); console.log( ndarray2array( x ) ); -var v = smean( [ x ] ); +var v = smeanors( [ x ] ); console.log( v ); diff --git a/lib/node_modules/@stdlib/stats/base/ndarray/smean/lib/index.js b/lib/node_modules/@stdlib/stats/base/ndarray/smeanors/lib/index.js similarity index 83% rename from lib/node_modules/@stdlib/stats/base/ndarray/smean/lib/index.js rename to lib/node_modules/@stdlib/stats/base/ndarray/smeanors/lib/index.js index 1e0fd4340cc8..bad312ae57bc 100644 --- a/lib/node_modules/@stdlib/stats/base/ndarray/smean/lib/index.js +++ b/lib/node_modules/@stdlib/stats/base/ndarray/smeanors/lib/index.js @@ -19,19 +19,19 @@ 'use strict'; /** -* Compute the arithmetic mean of a one-dimensional single-precision floating-point ndarray. +* Compute the arithmetic mean of a one-dimensional single-precision floating-point ndarray using ordinary recursive summation. * -* @module @stdlib/stats/base/ndarray/smean +* @module @stdlib/stats/base/ndarray/smeanors * * @example * var Float32Array = require( '@stdlib/array/float32' ); * var ndarray = require( '@stdlib/ndarray/base/ctor' ); -* var smean = require( '@stdlib/stats/base/ndarray/smean' ); +* var smeanors = require( '@stdlib/stats/base/ndarray/smeanors' ); * * var xbuf = new Float32Array( [ 1.0, 3.0, 4.0, 2.0 ] ); * var x = new ndarray( 'float32', xbuf, [ 4 ], [ 1 ], 0, 'row-major' ); * -* var v = smean( [ x ] ); +* var v = smeanors( [ x ] ); * // returns 2.5 */ diff --git a/lib/node_modules/@stdlib/stats/base/ndarray/smean/lib/main.js b/lib/node_modules/@stdlib/stats/base/ndarray/smeanors/lib/main.js similarity index 87% rename from lib/node_modules/@stdlib/stats/base/ndarray/smean/lib/main.js rename to lib/node_modules/@stdlib/stats/base/ndarray/smeanors/lib/main.js index b1b995cd3663..3f9687e29cb4 100644 --- a/lib/node_modules/@stdlib/stats/base/ndarray/smean/lib/main.js +++ b/lib/node_modules/@stdlib/stats/base/ndarray/smeanors/lib/main.js @@ -24,13 +24,13 @@ var numelDimension = require( '@stdlib/ndarray/base/numel-dimension' ); var getStride = require( '@stdlib/ndarray/base/stride' ); var getOffset = require( '@stdlib/ndarray/base/offset' ); var getData = require( '@stdlib/ndarray/base/data-buffer' ); -var strided = require( '@stdlib/stats/strided/smean' ).ndarray; +var strided = require( '@stdlib/stats/strided/smeanors' ).ndarray; // MAIN // /** -* Computes the arithmetic mean of a one-dimensional single-precision floating-point ndarray. +* Computes the arithmetic mean of a one-dimensional single-precision floating-point ndarray using ordinary recursive summation. * * @param {ArrayLikeObject} arrays - array-like object containing an input ndarray * @returns {number} arithmetic mean @@ -42,10 +42,10 @@ var strided = require( '@stdlib/stats/strided/smean' ).ndarray; * var xbuf = new Float32Array( [ 1.0, 3.0, 4.0, 2.0 ] ); * var x = new ndarray( 'float32', xbuf, [ 4 ], [ 1 ], 0, 'row-major' ); * -* var v = smean( [ x ] ); +* var v = smeanors( [ x ] ); * // returns 2.5 */ -function smean( arrays ) { +function smeanors( arrays ) { var x = arrays[ 0 ]; return strided( numelDimension( x, 0 ), getData( x ), getStride( x, 0 ), getOffset( x ) ); // eslint-disable-line max-len } @@ -53,4 +53,4 @@ function smean( arrays ) { // EXPORTS // -module.exports = smean; +module.exports = smeanors; diff --git a/lib/node_modules/@stdlib/stats/base/ndarray/smean/package.json b/lib/node_modules/@stdlib/stats/base/ndarray/smeanors/package.json similarity index 90% rename from lib/node_modules/@stdlib/stats/base/ndarray/smean/package.json rename to lib/node_modules/@stdlib/stats/base/ndarray/smeanors/package.json index 894942b5b6bb..e5e2fbf90d94 100644 --- a/lib/node_modules/@stdlib/stats/base/ndarray/smean/package.json +++ b/lib/node_modules/@stdlib/stats/base/ndarray/smeanors/package.json @@ -1,7 +1,7 @@ { - "name": "@stdlib/stats/base/ndarray/smean", + "name": "@stdlib/stats/base/ndarray/smeanors", "version": "0.0.0", - "description": "Compute the arithmetic mean of a one-dimensional single-precision floating-point ndarray.", + "description": "Compute the arithmetic mean of a one-dimensional single-precision floating-point ndarray using ordinary recursive summation.", "license": "Apache-2.0", "author": { "name": "The Stdlib Authors", diff --git a/lib/node_modules/@stdlib/stats/base/ndarray/smean/test/test.js b/lib/node_modules/@stdlib/stats/base/ndarray/smeanors/test/test.js similarity index 80% rename from lib/node_modules/@stdlib/stats/base/ndarray/smean/test/test.js rename to lib/node_modules/@stdlib/stats/base/ndarray/smeanors/test/test.js index 87fdd85477b1..c2064b9c7370 100644 --- a/lib/node_modules/@stdlib/stats/base/ndarray/smean/test/test.js +++ b/lib/node_modules/@stdlib/stats/base/ndarray/smeanors/test/test.js @@ -25,7 +25,7 @@ var isnan = require( '@stdlib/math/base/assert/is-nan' ); var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' ); var Float32Array = require( '@stdlib/array/float32' ); var ndarray = require( '@stdlib/ndarray/base/ctor' ); -var smean = require( './../lib' ); +var smeanors = require( './../lib' ); // FUNCTIONS // @@ -49,12 +49,12 @@ function vector( buffer, length, stride, offset ) { tape( 'main export is a function', function test( t ) { t.ok( true, __filename ); - t.strictEqual( typeof smean, 'function', 'main export is a function' ); + t.strictEqual( typeof smeanors, 'function', 'main export is a function' ); t.end(); }); tape( 'the function has an arity of 1', function test( t ) { - t.strictEqual( smean.length, 1, 'has expected arity' ); + t.strictEqual( smeanors.length, 1, 'has expected arity' ); t.end(); }); @@ -63,47 +63,47 @@ tape( 'the function calculates the arithmetic mean of a one-dimensional ndarray' var v; x = new Float32Array( [ 1.0, -2.0, -4.0, 5.0, 0.0, 3.0 ] ); - v = smean( [ vector( x, 6, 1, 0 ) ] ); + v = smeanors( [ vector( x, 6, 1, 0 ) ] ); t.strictEqual( v, 0.5, 'returns expected value' ); x = new Float32Array( [ -4.0, -5.0 ] ); - v = smean( [ vector( x, 2, 1, 0 ) ] ); + v = smeanors( [ vector( x, 2, 1, 0 ) ] ); t.strictEqual( v, -4.5, 'returns expected value' ); x = new Float32Array( [ -0.0, 0.0, -0.0 ] ); - v = smean( [ vector( x, 3, 1, 0 ) ] ); + v = smeanors( [ vector( x, 3, 1, 0 ) ] ); t.strictEqual( isPositiveZero( v ), true, 'returns expected value' ); x = new Float32Array( [ NaN ] ); - v = smean( [ vector( x, 1, 1, 0 ) ] ); + v = smeanors( [ vector( x, 1, 1, 0 ) ] ); t.strictEqual( isnan( v ), true, 'returns expected value' ); x = new Float32Array( [ NaN, NaN ] ); - v = smean( [ vector( x, 2, 1, 0 ) ] ); + v = smeanors( [ vector( x, 2, 1, 0 ) ] ); t.strictEqual( isnan( v ), true, 'returns expected value' ); t.end(); }); -tape( 'if provided an empty vector, the function returns `NaN`', function test( t ) { +tape( 'if provided an empty ndarray, the function returns `NaN`', function test( t ) { var x; var v; x = new Float32Array( [] ); - v = smean( [ vector( x, 0, 1, 0 ) ] ); + v = smeanors( [ vector( x, 0, 1, 0 ) ] ); t.strictEqual( isnan( v ), true, 'returns expected value' ); t.end(); }); -tape( 'if provided a vector containing a single element, the function returns that element', function test( t ) { +tape( 'if provided an ndarray containing a single element, the function returns that element', function test( t ) { var x; var v; x = new Float32Array( [ 1.0 ] ); - v = smean( [ vector( x, 1, 1, 0 ) ] ); + v = smeanors( [ vector( x, 1, 1, 0 ) ] ); t.strictEqual( v, 1.0, 'returns expected value' ); t.end(); @@ -124,7 +124,7 @@ tape( 'the function supports one-dimensional ndarrays having non-unit strides', 2.0 ]); - v = smean( [ vector( x, 4, 2, 0 ) ] ); + v = smeanors( [ vector( x, 4, 2, 0 ) ] ); t.strictEqual( v, 1.25, 'returns expected value' ); t.end(); @@ -145,7 +145,7 @@ tape( 'the function supports one-dimensional ndarrays having negative strides', 2.0 ]); - v = smean( [ vector( x, 4, -2, 6 ) ] ); + v = smeanors( [ vector( x, 4, -2, 6 ) ] ); t.strictEqual( v, 1.25, 'returns expected value' ); t.end(); @@ -166,7 +166,7 @@ tape( 'the function supports one-dimensional ndarrays having non-zero offsets', 4.0 // 3 ]); - v = smean( [ vector( x, 4, 2, 1 ) ] ); + v = smeanors( [ vector( x, 4, 2, 1 ) ] ); t.strictEqual( v, 1.25, 'returns expected value' ); t.end();