Skip to content

Commit 7f5b3b4

Browse files
committed
Auto-generated commit
1 parent 8c4a055 commit 7f5b3b4

File tree

6 files changed

+32
-39
lines changed

6 files changed

+32
-39
lines changed

CHANGELOG.md

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

7-
## Unreleased (2025-05-04)
7+
## Unreleased (2025-05-08)
88

99
<section class="features">
1010

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

3535
<details>
3636

37+
- [`f025bc3`](https://github.com/stdlib-js/stdlib/commit/f025bc39e4761a1c7dee8bf781581b75868b3a89) - **bench:** update random value generation [(#6954)](https://github.com/stdlib-js/stdlib/pull/6954) _(by Harsh)_
3738
- [`ca3d958`](https://github.com/stdlib-js/stdlib/commit/ca3d958f22927d6a6d4af71f50b92b5f7be27d7c) - **docs:** replace manual `for` loop in examples [(#6919)](https://github.com/stdlib-js/stdlib/pull/6919) _(by Harsh, Philipp Burckhardt)_
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

+8-11
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench-harness' );
24-
var Float64Array = require( '@stdlib/array-float64' );
25-
var uniform = require( '@stdlib/random-base-uniform' );
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;
@@ -33,22 +32,20 @@ var median = require( './../lib' );
3332

3433
bench( pkg, function benchmark( b ) {
3534
var gamma;
36-
var len;
35+
var opts;
3736
var x0;
3837
var y;
3938
var i;
4039

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

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

benchmark/benchmark.native.js

+8-11
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222

2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench-harness' );
25-
var Float64Array = require( '@stdlib/array-float64' );
26-
var uniform = require( '@stdlib/random-base-uniform' );
25+
var uniform = require( '@stdlib/random-array-uniform' );
2726
var EPS = require( '@stdlib/constants-float64-eps' );
2827
var isnan = require( '@stdlib/math-base-assert-is-nan' );
2928
var tryRequire = require( '@stdlib/utils-try-require' );
@@ -42,22 +41,20 @@ var opts = {
4241

4342
bench( pkg+'::native', opts, function benchmark( b ) {
4443
var gamma;
45-
var len;
44+
var opts;
4645
var x0;
4746
var y;
4847
var i;
4948

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

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

package.json

-2
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,11 @@
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-eps": "^0.2.2",
5150
"@stdlib/constants-float64-ninf": "^0.2.2",
5251
"@stdlib/constants-float64-pinf": "^0.2.2",
5352
"@stdlib/random-array-uniform": "^0.2.1",
54-
"@stdlib/random-base-uniform": "^0.2.1",
5553
"@stdlib/utils-try-require": "^0.2.2",
5654
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
5755
"istanbul": "^0.4.1",

test/test.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ tape( 'main export is a function', function test( t ) {
4242

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

4747
v = median( 10, NaN );
48-
t.equal( isnan( v ), true, 'returns NaN' );
48+
t.equal( isnan( v ), true, 'returns expected value' );
4949

5050
v = median( NaN, NaN );
51-
t.equal( isnan( v ), true, 'returns NaN' );
51+
t.equal( isnan( v ), true, 'returns expected value' );
5252

5353
t.end();
5454
});
@@ -57,16 +57,16 @@ tape( 'if provided a nonpositive `gamma`, the function always returns `NaN`', fu
5757
var y;
5858

5959
y = median( 0.0, 0.0 );
60-
t.equal( isnan( y ), true, 'returns NaN' );
60+
t.equal( isnan( y ), true, 'returns expected value' );
6161

6262
y = median( 0.0, -1.0 );
63-
t.equal( isnan( y ), true, 'returns NaN' );
63+
t.equal( isnan( y ), true, 'returns expected value' );
6464

6565
y = median( 0.0, NINF );
66-
t.equal( isnan( y ), true, 'returns NaN' );
66+
t.equal( isnan( y ), true, 'returns expected value' );
6767

6868
y = median( PINF, NINF );
69-
t.equal( isnan( y ), true, 'returns NaN' );
69+
t.equal( isnan( y ), true, 'returns expected value' );
7070

7171
t.end();
7272
});

test/test.native.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ tape( 'main export is a function', opts, function test( t ) {
5151

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

5656
v = median( 10, NaN );
57-
t.equal( isnan( v ), true, 'returns NaN' );
57+
t.equal( isnan( v ), true, 'returns expected value' );
5858

5959
v = median( NaN, NaN );
60-
t.equal( isnan( v ), true, 'returns NaN' );
60+
t.equal( isnan( v ), true, 'returns expected value' );
6161

6262
t.end();
6363
});
@@ -66,16 +66,16 @@ tape( 'if provided a nonpositive `gamma`, the function always returns `NaN`', op
6666
var y;
6767

6868
y = median( 0.0, 0.0 );
69-
t.equal( isnan( y ), true, 'returns NaN' );
69+
t.equal( isnan( y ), true, 'returns expected value' );
7070

7171
y = median( 0.0, -1.0 );
72-
t.equal( isnan( y ), true, 'returns NaN' );
72+
t.equal( isnan( y ), true, 'returns expected value' );
7373

7474
y = median( 0.0, NINF );
75-
t.equal( isnan( y ), true, 'returns NaN' );
75+
t.equal( isnan( y ), true, 'returns expected value' );
7676

7777
y = median( PINF, NINF );
78-
t.equal( isnan( y ), true, 'returns NaN' );
78+
t.equal( isnan( y ), true, 'returns expected value' );
7979

8080
t.end();
8181
});

0 commit comments

Comments
 (0)