Skip to content

Commit bfa6293

Browse files
committed
Auto-generated commit
1 parent e34c148 commit bfa6293

File tree

8 files changed

+72
-80
lines changed

8 files changed

+72
-80
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-05-23)
7+
## Unreleased (2025-05-26)
88

99
<section class="features">
1010

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

3535
<details>
3636

37+
- [`2f1bc9e`](https://github.com/stdlib-js/stdlib/commit/2f1bc9eb0ca087fb141fd68d1fe7704317be49a1) - **bench:** update random value generation [(#7093)](https://github.com/stdlib-js/stdlib/pull/7093) _(by Harsh)_
3738
- [`6792321`](https://github.com/stdlib-js/stdlib/commit/6792321ed5029b40a9ed15ac3f2dba212eb713e0) - **docs:** replace manual `for` loop in examples [(#7074)](https://github.com/stdlib-js/stdlib/pull/7074) _(by Harsh)_
3839
- [`5f73301`](https://github.com/stdlib-js/stdlib/commit/5f73301a8509cc423a06b02140c4e316fd02ff49) - **docs:** minor clean-up _(by Philipp Burckhardt)_
3940
- [`a1e230f`](https://github.com/stdlib-js/stdlib/commit/a1e230f29297caa89880e9c194c615a0400fb7bc) - **chore:** clean up cppcheck-suppress comments _(by Karan Anand)_

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ Spandan Barve <contact@marsian.dev>
167167
Stephannie Jiménez Gacha <steff456@hotmail.com>
168168
Suhaib Ilahi <suhaib.elahi87@gmail.com>
169169
Suraj Kumar <125961509+kumarsuraj212003@users.noreply.github.com>
170+
Swapnil Hajare <69076366+Swapnil-2502@users.noreply.github.com>
170171
Tanishq Ahuja <68651083+TheGEN1U5@users.noreply.github.com>
171172
Tirtadwipa Manunggal <tirtadwipa.manunggal@gmail.com>
172173
Tudor Pagu <104032457+tudor-pagu@users.noreply.github.com>

benchmark/benchmark.js

Lines changed: 16 additions & 20 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 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;
@@ -32,26 +31,23 @@ var logcdf = require( './../lib' );
3231
// MAIN //
3332

3433
bench( pkg, function benchmark( b ) {
35-
var len;
34+
var opts;
3635
var mu;
3736
var s;
3837
var x;
3938
var y;
4039
var i;
4140

42-
len = 100;
43-
x = new Float64Array( len );
44-
mu = new Float64Array( len );
45-
s = new Float64Array( len );
46-
for ( i = 0; i < len; i++ ) {
47-
x[ i ] = uniform( -50.0, 50.0 );
48-
mu[ i ] = uniform( -10.0, 10.0 );
49-
s[ i ] = uniform( EPS, 5.0 );
50-
}
41+
opts = {
42+
'dtype': 'float64'
43+
};
44+
x = uniform( 100, -50.0, 50.0, opts );
45+
mu = uniform( 100, -10.0, 10.0, opts );
46+
s = uniform( 100, EPS, 5.0, opts );
5147

5248
b.tic();
5349
for ( i = 0; i < b.iterations; i++ ) {
54-
y = logcdf( x[ i % len ], mu[ i % len ], s[ i % len ] );
50+
y = logcdf( x[ i % x.length ], mu[ i % mu.length ], s[ i % s.length ] );
5551
if ( isnan( y ) ) {
5652
b.fail( 'should not return NaN' );
5753
}
@@ -66,25 +62,25 @@ bench( pkg, function benchmark( b ) {
6662

6763
bench( pkg+':factory', function benchmark( b ) {
6864
var mylogcdf;
69-
var len;
65+
var opts;
7066
var mu;
7167
var s;
7268
var x;
7369
var y;
7470
var i;
7571

72+
opts = {
73+
'dtype': 'float64'
74+
};
75+
x = uniform( 100, 0.0, 50.0, opts );
76+
7677
mu = 10.0;
7778
s = 4.0;
7879
mylogcdf = logcdf.factory( mu, s );
79-
len = 100;
80-
x = new Float64Array( len );
81-
for ( i = 0; i < len; i++ ) {
82-
x[ i ] = uniform( 0.0, 50.0 );
83-
}
8480

8581
b.tic();
8682
for ( i = 0; i < b.iterations; i++ ) {
87-
y = mylogcdf( x[ i % len ] );
83+
y = mylogcdf( x[ i % x.length ] );
8884
if ( isnan( y ) ) {
8985
b.fail( 'should not return NaN' );
9086
}

benchmark/benchmark.native.js

Lines changed: 9 additions & 13 deletions
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' );
@@ -41,26 +40,23 @@ var opts = {
4140
// MAIN //
4241

4342
bench( pkg+'::native', opts, function benchmark( b ) {
44-
var len;
43+
var opts;
4544
var mu;
4645
var s;
4746
var x;
4847
var y;
4948
var i;
5049

51-
len = 100;
52-
x = new Float64Array( len );
53-
mu = new Float64Array( len );
54-
s = new Float64Array( len );
55-
for ( i = 0; i < len; i++ ) {
56-
x[ i ] = uniform( -50.0, 50.0 );
57-
mu[ i ] = uniform( -10.0, 10.0 );
58-
s[ i ] = uniform( EPS, 5.0 );
59-
}
50+
opts = {
51+
'dtype': 'float64'
52+
};
53+
x = uniform( 100, -50.0, 50.0, opts );
54+
mu = uniform( 100, -10.0, 10.0, opts );
55+
s = uniform( 100, EPS, 5.0, opts );
6056

6157
b.tic();
6258
for ( i = 0; i < b.iterations; i++ ) {
63-
y = logcdf( x[ i % len ], mu[ i % len ], s[ i % len ] );
59+
y = logcdf( x[ i % x.length ], mu[ i % mu.length ], s[ i % s.length ] );
6460
if ( isnan( y ) ) {
6561
b.fail( 'should not return NaN' );
6662
}

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,10 @@
5353
"@stdlib/utils-library-manifest": "^0.2.2"
5454
},
5555
"devDependencies": {
56-
"@stdlib/array-float64": "^0.2.2",
5756
"@stdlib/console-log-each-map": "github:stdlib-js/console-log-each-map#main",
5857
"@stdlib/constants-float64-pinf": "^0.2.2",
5958
"@stdlib/math-base-special-abs": "^0.2.2",
6059
"@stdlib/random-array-uniform": "^0.2.1",
61-
"@stdlib/random-base-uniform": "^0.2.1",
6260
"@stdlib/utils-try-require": "^0.2.2",
6361
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
6462
"istanbul": "^0.4.1",

test/test.factory.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,23 @@ tape( 'if provided `NaN` for any parameter, the created function returns `NaN`',
5656

5757
logcdf = factory( 0.0, 1.0 );
5858
y = logcdf( NaN );
59-
t.equal( isnan( y ), true, 'returns NaN' );
59+
t.equal( isnan( y ), true, 'returns expected value' );
6060

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

6565
logcdf = factory( 1.0, NaN );
6666
y = logcdf( 0.0 );
67-
t.equal( isnan( y ), true, 'returns NaN' );
67+
t.equal( isnan( y ), true, 'returns expected value' );
6868

6969
logcdf = factory( NaN, NaN );
7070
y = logcdf( 0.0 );
71-
t.equal( isnan( y ), true, 'returns NaN' );
71+
t.equal( isnan( y ), true, 'returns expected value' );
7272

7373
logcdf = factory( NaN, NaN );
7474
y = logcdf( NaN );
75-
t.equal( isnan( y ), true, 'returns NaN' );
75+
t.equal( isnan( y ), true, 'returns expected value' );
7676

7777
t.end();
7878
});
@@ -83,7 +83,7 @@ tape( 'if provided a valid `mu` and `s`, the function returns a function which r
8383

8484
logcdf = factory( 0.0, 1.0 );
8585
y = logcdf( PINF );
86-
t.equal( y, 0.0, 'returns 0' );
86+
t.equal( y, 0.0, 'returns expected value' );
8787

8888
t.end();
8989
});
@@ -94,7 +94,7 @@ tape( 'if provided a valid `mu` and `s`, the function returns a function which r
9494

9595
logcdf = factory( 0.0, 1.0 );
9696
y = logcdf( NINF );
97-
t.equal( y, NINF, 'returns -infinity' );
97+
t.equal( y, NINF, 'returns expected value' );
9898

9999
t.end();
100100
});
@@ -106,26 +106,26 @@ tape( 'if provided a negative `s`, the created function always returns `NaN`', f
106106
logcdf = factory( 0.0, -1.0 );
107107

108108
y = logcdf( 2.0 );
109-
t.equal( isnan( y ), true, 'returns NaN' );
109+
t.equal( isnan( y ), true, 'returns expected value' );
110110

111111
y = logcdf( 0.0 );
112-
t.equal( isnan( y ), true, 'returns NaN' );
112+
t.equal( isnan( y ), true, 'returns expected value' );
113113

114114
logcdf = factory( 0.0, NINF );
115115
y = logcdf( 2.0 );
116-
t.equal( isnan( y ), true, 'returns NaN' );
116+
t.equal( isnan( y ), true, 'returns expected value' );
117117

118118
logcdf = factory( PINF, NINF );
119119
y = logcdf( 2.0 );
120-
t.equal( isnan( y ), true, 'returns NaN' );
120+
t.equal( isnan( y ), true, 'returns expected value' );
121121

122122
logcdf = factory( NINF, NINF );
123123
y = logcdf( 2.0 );
124-
t.equal( isnan( y ), true, 'returns NaN' );
124+
t.equal( isnan( y ), true, 'returns expected value' );
125125

126126
logcdf = factory( NaN, NINF );
127127
y = logcdf( 2.0 );
128-
t.equal( isnan( y ), true, 'returns NaN' );
128+
t.equal( isnan( y ), true, 'returns expected value' );
129129

130130
t.end();
131131
});
@@ -137,13 +137,13 @@ tape( 'if `s` equals `0`, the created function evaluates a degenerate distributi
137137
logcdf = factory( 2.0, 0.0 );
138138

139139
y = logcdf( 2.0, 2.0, 0.0 );
140-
t.equal( y, 0.0, 'returns 0 for x equal to mu' );
140+
t.equal( y, 0.0, 'returns expected value' );
141141

142142
y = logcdf( 3.0, 2.0, 0.0 );
143-
t.equal( y, 0.0, 'returns 0 for x greater than mu' );
143+
t.equal( y, 0.0, 'returns expected value' );
144144

145145
y = logcdf( 1.0, 2.0, 0.0 );
146-
t.equal( y, NINF, 'returns -infinity for x smaller than mu' );
146+
t.equal( y, NINF, 'returns expected value' );
147147

148148
t.end();
149149
});

test/test.logcdf.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,46 +46,46 @@ tape( 'main export is a function', function test( t ) {
4646

4747
tape( 'if provided `NaN` for any parameter, the function returns `NaN`', function test( t ) {
4848
var y = logcdf( NaN, 0.0, 1.0 );
49-
t.equal( isnan( y ), true, 'returns NaN' );
49+
t.equal( isnan( y ), true, 'returns expected value' );
5050
y = logcdf( 0.0, NaN, 1.0 );
51-
t.equal( isnan( y ), true, 'returns NaN' );
51+
t.equal( isnan( y ), true, 'returns expected value' );
5252
y = logcdf( 0.0, 1.0, NaN );
53-
t.equal( isnan( y ), true, 'returns NaN' );
53+
t.equal( isnan( y ), true, 'returns expected value' );
5454
t.end();
5555
});
5656

5757
tape( 'if provided `+infinity` for `x` and a finite `mu` and `s`, the function returns `0`', function test( t ) {
5858
var y = logcdf( PINF, 0.0, 1.0 );
59-
t.equal( y, 0.0, 'returns 0' );
59+
t.equal( y, 0.0, 'returns expected value' );
6060
t.end();
6161
});
6262

6363
tape( 'if provided `-infinity` for `x` and a finite `mu` and `s`, the function returns `-infinity`', function test( t ) {
6464
var y = logcdf( NINF, 0.0, 1.0 );
65-
t.equal( y, NINF, 'returns -infinity' );
65+
t.equal( y, NINF, 'returns expected value' );
6666
t.end();
6767
});
6868

6969
tape( 'if provided a negative `s`, the function returns `NaN`', function test( t ) {
7070
var y;
7171

7272
y = logcdf( 2.0, 2.0, -1.0 );
73-
t.equal( isnan( y ), true, 'returns NaN' );
73+
t.equal( isnan( y ), true, 'returns expected value' );
7474

7575
y = logcdf( 0.0, 2.0, -1.0 );
76-
t.equal( isnan( y ), true, 'returns NaN' );
76+
t.equal( isnan( y ), true, 'returns expected value' );
7777

7878
y = logcdf( 2.0, 1.0, NINF );
79-
t.equal( isnan( y ), true, 'returns NaN' );
79+
t.equal( isnan( y ), true, 'returns expected value' );
8080

8181
y = logcdf( 2.0, PINF, NINF );
82-
t.equal( isnan( y ), true, 'returns NaN' );
82+
t.equal( isnan( y ), true, 'returns expected value' );
8383

8484
y = logcdf( 2.0, NINF, NINF );
85-
t.equal( isnan( y ), true, 'returns NaN' );
85+
t.equal( isnan( y ), true, 'returns expected value' );
8686

8787
y = logcdf( 2.0, NaN, NINF );
88-
t.equal( isnan( y ), true, 'returns NaN' );
88+
t.equal( isnan( y ), true, 'returns expected value' );
8989

9090
t.end();
9191
});
@@ -94,13 +94,13 @@ tape( 'if provided `s` equals `0`, the function evaluates a degenerate distribut
9494
var y;
9595

9696
y = logcdf( 2.0, 2.0, 0.0 );
97-
t.equal( y, 0.0, 'returns 0 for x equal to mu' );
97+
t.equal( y, 0.0, 'returns expected value' );
9898

9999
y = logcdf( 3.0, 2.0, 0.0 );
100-
t.equal( y, 0.0, 'returns 0 for x greater than mu' );
100+
t.equal( y, 0.0, 'returns expected value' );
101101

102102
y = logcdf( 1.0, 2.0, 0.0 );
103-
t.equal( y, NINF, 'returns -infinity for x smaller than mu' );
103+
t.equal( y, NINF, 'returns expected value' );
104104

105105
t.end();
106106
});

0 commit comments

Comments
 (0)