Skip to content

Commit 21b4e64

Browse files
committed
Auto-generated commit
1 parent ea05e24 commit 21b4e64

File tree

6 files changed

+42
-49
lines changed

6 files changed

+42
-49
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2025-04-23)
7+
## Unreleased (2025-04-26)
88

99
<section class="features">
1010

@@ -34,6 +34,7 @@ This release closes the following issue:
3434

3535
<details>
3636

37+
- [`58636bd`](https://github.com/stdlib-js/stdlib/commit/58636bd810b01e44e6b3f5b987bcfc3da3f53d25) - **bench:** update random value generation [(#6813)](https://github.com/stdlib-js/stdlib/pull/6813) _(by Harsh)_
3738
- [`b7ca1bd`](https://github.com/stdlib-js/stdlib/commit/b7ca1bd43ab7777ea30f52b4f1392a78f3ad7b1b) - **docs:** replace manual `for` loop in examples [(#6793)](https://github.com/stdlib-js/stdlib/pull/6793) _(by Harsh)_
3839
- [`a1e230f`](https://github.com/stdlib-js/stdlib/commit/a1e230f29297caa89880e9c194c615a0400fb7bc) - **chore:** clean up cppcheck-suppress comments _(by Karan Anand)_
3940
- [`e61b1de`](https://github.com/stdlib-js/stdlib/commit/e61b1dee3334bacf30d213de5b5f1c7868c0753b) - **docs:** clean-up of C docstrings _(by Philipp Burckhardt)_

benchmark/benchmark.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench-harness' );
24-
var uniform = require( '@stdlib/random-base-uniform' );
25-
var Float64Array = require( '@stdlib/array-float64' );
24+
var uniform = require( '@stdlib/random-array-uniform' );
2625
var isnan = require( '@stdlib/math-base-assert-is-nan' );
2726
var EPS = require( '@stdlib/constants-float64-eps' );
2827
var pkg = require( './../package.json' ).name;
@@ -34,21 +33,19 @@ var variance = require( './../lib' );
3433
bench( pkg, function benchmark( b ) {
3534
var alpha;
3635
var beta;
37-
var len;
36+
var opts;
3837
var y;
3938
var i;
4039

41-
len = 100;
42-
alpha = new Float64Array( len );
43-
beta = new Float64Array( len );
44-
for ( i = 0; i < len; i++ ) {
45-
alpha[ i ] = uniform( EPS, 10.0 );
46-
beta[ i ] = uniform( EPS, 10.0 );
47-
}
40+
opts = {
41+
'dtype': 'float64'
42+
};
43+
alpha = uniform( 100, EPS, 10.0, opts );
44+
beta = uniform( 100, EPS, 10.0, opts );
4845

4946
b.tic();
5047
for ( i = 0; i < b.iterations; i++ ) {
51-
y = variance( alpha[ i % len ], beta[ i % len ] );
48+
y = variance( alpha[ i % alpha.length ], beta[ i % beta.length ] );
5249
if ( isnan( y ) ) {
5350
b.fail( 'should not return NaN' );
5451
}

benchmark/benchmark.native.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@
2222

2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench-harness' );
25-
var Float64Array = require( '@stdlib/array-float64' );
2625
var EPS = require( '@stdlib/constants-float64-eps' );
27-
var uniform = require( '@stdlib/random-base-uniform' );
26+
var uniform = require( '@stdlib/random-array-uniform' );
2827
var isnan = require( '@stdlib/math-base-assert-is-nan' );
2928
var tryRequire = require( '@stdlib/utils-try-require' );
3029
var pkg = require( './../package.json' ).name;
@@ -43,21 +42,19 @@ var opts = {
4342
bench( pkg+'::native', opts, function benchmark( b ) {
4443
var alpha;
4544
var beta;
46-
var len;
45+
var opts;
4746
var y;
4847
var i;
4948

50-
len = 100;
51-
alpha = new Float64Array( len );
52-
beta = new Float64Array( len );
53-
for ( i = 0; i < len; i++ ) {
54-
alpha[ i ] = uniform( EPS, 10.0 );
55-
beta[ i ] = uniform( EPS, 10.0 );
56-
}
49+
opts = {
50+
'dtype': 'float64'
51+
};
52+
alpha = uniform( 100, EPS, 10.0, opts );
53+
beta = uniform( 100, EPS, 10.0, opts );
5754

5855
b.tic();
5956
for ( i = 0; i < b.iterations; i++ ) {
60-
y = variance( alpha[ i % len ], beta[ i % len ] );
57+
y = variance( alpha[ i % alpha.length ], beta[ i % beta.length ] );
6158
if ( isnan( y ) ) {
6259
b.fail( 'should not return NaN' );
6360
}

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,12 @@
4545
"@stdlib/utils-library-manifest": "^0.2.2"
4646
},
4747
"devDependencies": {
48-
"@stdlib/array-float64": "^0.2.2",
4948
"@stdlib/console-log-each-map": "github:stdlib-js/console-log-each-map#main",
5049
"@stdlib/constants-float64-ninf": "^0.2.2",
5150
"@stdlib/constants-float64-pinf": "^0.2.2",
5251
"@stdlib/math-base-assert-is-nan": "^0.2.2",
5352
"@stdlib/math-base-special-abs": "^0.2.2",
5453
"@stdlib/random-array-uniform": "^0.2.1",
55-
"@stdlib/random-base-uniform": "^0.2.1",
5654
"@stdlib/utils-try-require": "^0.2.2",
5755
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
5856
"istanbul": "^0.4.1",

test/test.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ tape( 'main export is a function', function test( t ) {
4444

4545
tape( 'if provided `NaN` for any parameter, the function returns `NaN`', function test( t ) {
4646
var v = variance( NaN, 0.5 );
47-
t.equal( isnan( v ), true, 'returns NaN' );
47+
t.equal( isnan( v ), true, 'returns expected value' );
4848

4949
v = variance( 10.0, NaN );
50-
t.equal( isnan( v ), true, 'returns NaN' );
50+
t.equal( isnan( v ), true, 'returns expected value' );
5151

5252
t.end();
5353
});
@@ -56,19 +56,19 @@ tape( 'if provided `alpha <= 0`, the function returns `NaN`', function test( t )
5656
var y;
5757

5858
y = variance( -1.0, 2.0 );
59-
t.equal( isnan( y ), true, 'returns NaN' );
59+
t.equal( isnan( y ), true, 'returns expected value' );
6060

6161
y = variance( NINF, 1.0 );
62-
t.equal( isnan( y ), true, 'returns NaN' );
62+
t.equal( isnan( y ), true, 'returns expected value' );
6363

6464
y = variance( NINF, PINF );
65-
t.equal( isnan( y ), true, 'returns NaN' );
65+
t.equal( isnan( y ), true, 'returns expected value' );
6666

6767
y = variance( NINF, NINF );
68-
t.equal( isnan( y ), true, 'returns NaN' );
68+
t.equal( isnan( y ), true, 'returns expected value' );
6969

7070
y = variance( NINF, NaN );
71-
t.equal( isnan( y ), true, 'returns NaN' );
71+
t.equal( isnan( y ), true, 'returns expected value' );
7272

7373
t.end();
7474
});
@@ -77,19 +77,19 @@ tape( 'if provided `beta <= 0`, the function returns `NaN`', function test( t )
7777
var y;
7878

7979
y = variance( 2.0, -1.0 );
80-
t.equal( isnan( y ), true, 'returns NaN' );
80+
t.equal( isnan( y ), true, 'returns expected value' );
8181

8282
y = variance( 1.0, NINF );
83-
t.equal( isnan( y ), true, 'returns NaN' );
83+
t.equal( isnan( y ), true, 'returns expected value' );
8484

8585
y = variance( PINF, NINF );
86-
t.equal( isnan( y ), true, 'returns NaN' );
86+
t.equal( isnan( y ), true, 'returns expected value' );
8787

8888
y = variance( NINF, NINF );
89-
t.equal( isnan( y ), true, 'returns NaN' );
89+
t.equal( isnan( y ), true, 'returns expected value' );
9090

9191
y = variance( NaN, NINF );
92-
t.equal( isnan( y ), true, 'returns NaN' );
92+
t.equal( isnan( y ), true, 'returns expected value' );
9393

9494
t.end();
9595
});

test/test.native.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ tape( 'main export is a function', opts, function test( t ) {
5353

5454
tape( 'if provided `NaN` for any parameter, the function returns `NaN`', opts, function test( t ) {
5555
var v = variance( NaN, 0.5 );
56-
t.equal( isnan( v ), true, 'returns NaN' );
56+
t.equal( isnan( v ), true, 'returns expected value' );
5757

5858
v = variance( 10.0, NaN );
59-
t.equal( isnan( v ), true, 'returns NaN' );
59+
t.equal( isnan( v ), true, 'returns expected value' );
6060

6161
t.end();
6262
});
@@ -65,19 +65,19 @@ tape( 'if provided `alpha <= 0`, the function returns `NaN`', opts, function tes
6565
var y;
6666

6767
y = variance( -1.0, 2.0 );
68-
t.equal( isnan( y ), true, 'returns NaN' );
68+
t.equal( isnan( y ), true, 'returns expected value' );
6969

7070
y = variance( NINF, 1.0 );
71-
t.equal( isnan( y ), true, 'returns NaN' );
71+
t.equal( isnan( y ), true, 'returns expected value' );
7272

7373
y = variance( NINF, PINF );
74-
t.equal( isnan( y ), true, 'returns NaN' );
74+
t.equal( isnan( y ), true, 'returns expected value' );
7575

7676
y = variance( NINF, NINF );
77-
t.equal( isnan( y ), true, 'returns NaN' );
77+
t.equal( isnan( y ), true, 'returns expected value' );
7878

7979
y = variance( NINF, NaN );
80-
t.equal( isnan( y ), true, 'returns NaN' );
80+
t.equal( isnan( y ), true, 'returns expected value' );
8181

8282
t.end();
8383
});
@@ -86,19 +86,19 @@ tape( 'if provided `beta <= 0`, the function returns `NaN`', opts, function test
8686
var y;
8787

8888
y = variance( 2.0, -1.0 );
89-
t.equal( isnan( y ), true, 'returns NaN' );
89+
t.equal( isnan( y ), true, 'returns expected value' );
9090

9191
y = variance( 1.0, NINF );
92-
t.equal( isnan( y ), true, 'returns NaN' );
92+
t.equal( isnan( y ), true, 'returns expected value' );
9393

9494
y = variance( PINF, NINF );
95-
t.equal( isnan( y ), true, 'returns NaN' );
95+
t.equal( isnan( y ), true, 'returns expected value' );
9696

9797
y = variance( NINF, NINF );
98-
t.equal( isnan( y ), true, 'returns NaN' );
98+
t.equal( isnan( y ), true, 'returns expected value' );
9999

100100
y = variance( NaN, NINF );
101-
t.equal( isnan( y ), true, 'returns NaN' );
101+
t.equal( isnan( y ), true, 'returns expected value' );
102102

103103
t.end();
104104
});

0 commit comments

Comments
 (0)