diff --git a/lib/node_modules/@stdlib/math/base/special/binet/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/binet/benchmark/c/benchmark.c
index b86cc7628650..b868f1632601 100644
--- a/lib/node_modules/@stdlib/math/base/special/binet/benchmark/c/benchmark.c
+++ b/lib/node_modules/@stdlib/math/base/special/binet/benchmark/c/benchmark.c
@@ -50,7 +50,7 @@ static void print_summary( int total, int passing ) {
}
/**
-* Prints benchmarks results.
+* Prints benchmark results.
*
* @param elapsed elapsed time in seconds
*/
@@ -107,21 +107,18 @@ static double benchmark( void ) {
int i;
for ( i = 0; i < 100; i++ ) {
- x[ i ] = floor( 79.0*rand_double() );
+ x[ i ] = floor( 79.0 * rand_double() );
}
t = tic();
for ( i = 0; i < ITERATIONS; i++ ) {
- y = stdlib_base_binet( x[ i%100 ] );
+ y = binet( x[ i % 100 ] );
if ( y < 0 ) {
printf( "should return a nonnegative number\n" );
break;
}
}
elapsed = tic() - t;
- if ( y < 0 ) {
- printf( "should return a nonnegative number\n" );
- }
return elapsed;
}
@@ -143,4 +140,6 @@ int main( void ) {
printf( "ok %d benchmark finished\n", i+1 );
}
print_summary( REPEATS, REPEATS );
+
+ return 0;
}
diff --git a/lib/node_modules/@stdlib/stats/base/dists/levy/variance/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/levy/variance/benchmark/benchmark.js
index 3c565520147d..9107d169927c 100644
--- a/lib/node_modules/@stdlib/stats/base/dists/levy/variance/benchmark/benchmark.js
+++ b/lib/node_modules/@stdlib/stats/base/dists/levy/variance/benchmark/benchmark.js
@@ -22,7 +22,7 @@
var bench = require( '@stdlib/bench' );
var Float64Array = require( '@stdlib/array/float64' );
-var randu = require( '@stdlib/random/base/randu' );
+var uniform = require( '@stdlib/random/base/uniform' ); // Corrected import
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var EPS = require( '@stdlib/constants/float64/eps' );
var pkg = require( './../package.json' ).name;
@@ -32,31 +32,31 @@ var variance = require( './../lib' );
// MAIN //
bench( pkg, function benchmark( b ) {
- var len;
- var mu;
- var c;
- var y;
- var i;
-
- len = 100;
- mu = new Float64Array( len );
- c = new Float64Array( len );
- for ( i = 0; i < len; i++ ) {
- mu[ i ] = ( randu() * 100.0 ) - 50.0;
- c[ i ] = ( randu() * 20.0 ) + EPS;
- }
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- y = variance( mu[ i % len ], c[ i % len ] );
- if ( isnan( y ) ) {
- b.fail( 'should not return NaN' );
- }
- }
- b.toc();
- if ( isnan( y ) ) {
- b.fail( 'should not return NaN' );
- }
- b.pass( 'benchmark finished' );
- b.end();
+ var len;
+ var mu;
+ var c;
+ var y;
+ var i;
+
+ len = 100;
+ mu = new Float64Array( len );
+ c = new Float64Array( len );
+ for ( i = 0; i < len; i++ ) {
+ mu[ i ] = uniform( -50.0, 50.0 ); // Using uniform instead of randu
+ c[ i ] = uniform( EPS, 20.0 + EPS ); // Using uniform instead of randu
+ }
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ y = variance( mu[ i % len ], c[ i % len ] );
+ if ( isnan( y ) ) {
+ b.fail( 'should not return NaN' );
+ }
+ }
+ b.toc();
+ if ( isnan( y ) ) {
+ b.fail( 'should not return NaN' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
});
diff --git a/lib/node_modules/@stdlib/stats/base/dists/levy/variance/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/levy/variance/benchmark/benchmark.native.js
index 62dfce1f9423..b481af52d149 100644
--- a/lib/node_modules/@stdlib/stats/base/dists/levy/variance/benchmark/benchmark.native.js
+++ b/lib/node_modules/@stdlib/stats/base/dists/levy/variance/benchmark/benchmark.native.js
@@ -24,7 +24,7 @@ var resolve = require( 'path' ).resolve;
var bench = require( '@stdlib/bench' );
var Float64Array = require( '@stdlib/array/float64' );
var tryRequire = require( '@stdlib/utils/try-require' );
-var randu = require( '@stdlib/random/base/randu' );
+var uniform = require( '@stdlib/random/base/uniform' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var EPS = require( '@stdlib/constants/float64/eps' );
var pkg = require( './../package.json' ).name;
@@ -32,7 +32,8 @@ var pkg = require( './../package.json' ).name;
// VARIABLES //
-var variance = tryRequire( resolve( __dirname, './../lib/native.js' ) );
+var levy = require( resolve( __dirname, '../../lib/index.js' ) );
+var variance = levy.variance;
var opts = {
'skip': ( variance instanceof Error )
};
@@ -51,8 +52,8 @@ bench( pkg+'::native', opts, function benchmark( b ) {
mu = new Float64Array( len );
c = new Float64Array( len );
for ( i = 0; i < len; i++ ) {
- mu[ i ] = ( randu() * 100.0 ) - 50.0;
- c[ i ] = ( randu() * 20.0 ) + EPS;
+ mu[ i ] = uniform( -50.0, 50.0 );
+ c[ i ] = uniform( EPS, 20.0 );
}
b.tic();
@@ -68,4 +69,4 @@ bench( pkg+'::native', opts, function benchmark( b ) {
}
b.pass( 'benchmark finished' );
b.end();
-});
+});
\ No newline at end of file
diff --git a/lib/node_modules/@stdlib/stats/base/dists/normal/mgf/README.md b/lib/node_modules/@stdlib/stats/base/dists/normal/mgf/README.md
index e7da62468b8e..159e95b67618 100644
--- a/lib/node_modules/@stdlib/stats/base/dists/normal/mgf/README.md
+++ b/lib/node_modules/@stdlib/stats/base/dists/normal/mgf/README.md
@@ -22,33 +22,18 @@ limitations under the License.
> [Normal][normal-distribution] distribution moment-generating function (MGF).
-
-
-The [moment-generating function][mgf] for a [normal][normal-distribution] random variable is
-
-
+The [moment-generating function][mgf] for a [normal][normal-distribution] random variable is:
```math
M_X(t) := \mathbb{E}\!\left[e^{tX}\right] = \exp\{ \mu t + \frac{1}{2}\sigma^2t^2 \}
```
-
-
-
-
where `mu` is the mean and `sigma > 0` is the standard deviation.
-
-
-
-
## Usage
@@ -95,58 +80,23 @@ y = mgf( 2.0, 0.0, -1.0 );
// returns NaN
```
-#### mgf.factory( mu, sigma )
-
-Returns a function for evaluating the [moment-generating function][mgf] (MGF) of a [normal][normal-distribution] distribution with parameters `mu` and `sigma`.
-
-```javascript
-var mymgf = mgf.factory( 4.0, 2.0 );
-
-var y = mymgf( 1.0 );
-// returns ~403.429
-
-y = mymgf( 0.5 );
-// returns ~12.182
-```
-
-
-
-
-
-
-
-
-
-
-
-
-
-## Examples
+
-
+
-```javascript
-var randu = require( '@stdlib/random/base/randu' );
-var mgf = require( '@stdlib/stats/base/dists/normal/mgf' );
+
-var sigma;
-var mu;
-var t;
-var y;
-var i;
-
-for ( i = 0; i < 10; i++ ) {
- t = randu();
- mu = (randu() * 10.0) - 5.0;
- sigma = randu() * 20.0;
- y = mgf( t, mu, sigma );
- console.log( 't: %d, µ: %d, σ: %d, M_X(t;µ,σ): %d', t.toFixed( 4 ), mu.toFixed( 4 ), sigma.toFixed( 4 ), y.toFixed( 4 ) );
-}
-```
+References
+
@@ -263,10 +213,6 @@ int main( void ) {
-
-
-
-
[normal-distribution]: https://en.wikipedia.org/wiki/Normal_distribution
@@ -275,4 +221,4 @@ int main( void ) {
-
+
diff --git a/lib/node_modules/@stdlib/stats/base/dists/normal/mgf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/normal/mgf/benchmark/benchmark.js
index 3c2c881ceed3..e2cf106e2b24 100644
--- a/lib/node_modules/@stdlib/stats/base/dists/normal/mgf/benchmark/benchmark.js
+++ b/lib/node_modules/@stdlib/stats/base/dists/normal/mgf/benchmark/benchmark.js
@@ -1,3 +1,5 @@
+'use strict';
+
/**
* @license Apache-2.0
*
@@ -7,7 +9,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
-* http://www.apache.org/licenses/LICENSE-2.0
+* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,8 +18,6 @@
* limitations under the License.
*/
-'use strict';
-
// MODULES //
var bench = require( '@stdlib/bench' );
@@ -28,9 +28,20 @@ var EPS = require( '@stdlib/constants/float64/eps' );
var pkg = require( './../package.json' ).name;
var mgf = require( './../lib' );
-
// MAIN //
+bench( pkg+':factory', function benchmark( b ) {
+ var mymgf;
+ var sigma;
+ var mu;
+ var t;
+ var y;
+ var i;
+
+ mu = 0.0;
+ sigma = 1.5;
+ mymgf = mgf.factory( mu, sigma );
+
bench( pkg, function benchmark( b ) {
var sigma;
var len;
@@ -64,18 +75,46 @@ bench( pkg, function benchmark( b ) {
b.end();
});
-bench( pkg+':factory', function benchmark( b ) {
- var mymgf;
- var sigma;
- var mu;
- var t;
- var y;
- var i;
+ b.tic();
+ for ( i = 0; i < 100; i++ ) { // L63: Hardcoded 100
+ t = randu();
+ y = mymgf( t );
+ if ( isnan( y ) ) {
+ b.fail( 'should not return NaN' );
+ }
+ }
+ b.toc();
+ if ( isnan( y ) ) {
+ b.fail( 'should not return NaN' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
- mu = 0.0;
- sigma = 1.5;
- mymgf = mgf.factory( mu, sigma );
+bench( pkg, function benchmark( b ) {
+ var sigma;
+ var mu;
+ var t;
+ var y;
+ var i;
+ b.tic();
+ for ( i = 0; i < 100; i++ ) { // L97: Hardcoded 100
+ t = randu();
+ mu = ( randu()*100.0 ) - 50.0;
+ sigma = ( randu()*20.0 ) + EPS;
+ y = mgf( t, mu, sigma );
+ if ( isnan( y ) ) {
+ b.fail( 'should not return NaN' );
+ }
+ }
+ b.toc();
+ if ( isnan( y ) ) {
+ b.fail( 'should not return NaN' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
t = uniform( 0.0, 1.0 );
@@ -91,3 +130,4 @@ bench( pkg+':factory', function benchmark( b ) {
b.pass( 'benchmark finished' );
b.end();
});
+