Skip to content

Commit df35967

Browse files
committed
Auto-generated commit
1 parent 4c45add commit df35967

File tree

7 files changed

+66
-75
lines changed

7 files changed

+66
-75
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-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+
- [`6af184d`](https://github.com/stdlib-js/stdlib/commit/6af184d8a8ed89c7be0fe08dd5d87125b60c5e01) - **bench:** update random value generation [(#6953)](https://github.com/stdlib-js/stdlib/pull/6953) _(by Harsh)_
3738
- [`28f64ec`](https://github.com/stdlib-js/stdlib/commit/28f64ec05e56db3e8836cfcdfd45e27a53eda4bf) - **docs:** replace manual `for` loop in examples [(#6918)](https://github.com/stdlib-js/stdlib/pull/6918) _(by Harsh)_
3839
- [`a1e230f`](https://github.com/stdlib-js/stdlib/commit/a1e230f29297caa89880e9c194c615a0400fb7bc) - **chore:** clean up cppcheck-suppress comments _(by Karan Anand)_
3940
- [`f175cf9`](https://github.com/stdlib-js/stdlib/commit/f175cf9948ecaf9928a34777bd35967dc4bf788d) - **feat:** add C implementation of `stats/base/dists/cauchy/logcdf` [(#4390)](https://github.com/stdlib-js/stdlib/pull/4390) _(by Vinit Pandit, stdlib-bot, Philipp Burckhardt)_

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;
@@ -33,25 +32,22 @@ var logcdf = require( './../lib' );
3332

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

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

5248
b.tic();
5349
for ( i = 0; i < b.iterations; i++ ) {
54-
y = logcdf( x[ i % len ], x0[ i % len ], gamma[ i % len ] );
50+
y = logcdf( x[ i % x.length ], x0[ i % x0.length ], gamma[ i % gamma.length ] );
5551
if ( isnan( y ) ) {
5652
b.fail( 'should not return NaN' );
5753
}
@@ -67,24 +63,24 @@ bench( pkg, function benchmark( b ) {
6763
bench( pkg+':factory', function benchmark( b ) {
6864
var mylogcdf;
6965
var gamma;
70-
var len;
66+
var opts;
7167
var x0;
7268
var x;
7369
var y;
7470
var i;
7571

72+
opts = {
73+
'dtype': 'float64'
74+
};
75+
x = uniform( 100, EPS, 100.0, opts );
76+
7677
x0 = 0.0;
7778
gamma = 1.5;
7879
mylogcdf = logcdf.factory( x0, gamma );
79-
len = 100;
80-
x = new Float64Array( len );
81-
for ( i = 0; i < len; i++ ) {
82-
x[ i ] = uniform( EPS, 100.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,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;
@@ -42,25 +41,22 @@ 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 x;
4847
var y;
4948
var i;
5049

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

6157
b.tic();
6258
for ( i = 0; i < b.iterations; i++ ) {
63-
y = logcdf( x[ i % len ], x0[ i % len ], gamma[ i % len ] );
59+
y = logcdf( x[ i % x.length ], x0[ i % x0.length ], gamma[ i % gamma.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
@@ -49,14 +49,12 @@
4949
"@stdlib/utils-library-manifest": "^0.2.2"
5050
},
5151
"devDependencies": {
52-
"@stdlib/array-float64": "^0.2.2",
5352
"@stdlib/console-log-each-map": "github:stdlib-js/console-log-each-map#main",
5453
"@stdlib/constants-float64-eps": "^0.2.2",
5554
"@stdlib/constants-float64-ninf": "^0.2.2",
5655
"@stdlib/constants-float64-pinf": "^0.2.2",
5756
"@stdlib/math-base-special-abs": "^0.2.2",
5857
"@stdlib/random-array-uniform": "^0.2.1",
59-
"@stdlib/random-base-uniform": "^0.2.1",
6058
"@stdlib/utils-try-require": "^0.2.2",
6159
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
6260
"istanbul": "^0.4.1",

test/test.factory.js

Lines changed: 15 additions & 15 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 `x0` and `gamma`, the function returns a function whi
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 `x0` and `gamma`, the function returns a function whi
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
});
@@ -105,33 +105,33 @@ tape( 'if provided a nonpositive `gamma`, the created function always returns `N
105105

106106
logcdf = factory( 0.0, 0.0 );
107107
y = logcdf( 2.0 );
108-
t.equal( isnan( y ), true, 'returns NaN' );
108+
t.equal( isnan( y ), true, 'returns expected value' );
109109

110110
y = logcdf( 0.0 );
111-
t.equal( isnan( y ), true, 'returns NaN' );
111+
t.equal( isnan( y ), true, 'returns expected value' );
112112

113113
logcdf = factory( 0.0, -1.0 );
114114
y = logcdf( 2.0 );
115-
t.equal( isnan( y ), true, 'returns NaN' );
115+
t.equal( isnan( y ), true, 'returns expected value' );
116116

117117
y = logcdf( 0.0 );
118-
t.equal( isnan( y ), true, 'returns NaN' );
118+
t.equal( isnan( y ), true, 'returns expected value' );
119119

120120
logcdf = factory( 0.0, NINF );
121121
y = logcdf( 2.0 );
122-
t.equal( isnan( y ), true, 'returns NaN' );
122+
t.equal( isnan( y ), true, 'returns expected value' );
123123

124124
logcdf = factory( PINF, NINF );
125125
y = logcdf( 2.0 );
126-
t.equal( isnan( y ), true, 'returns NaN' );
126+
t.equal( isnan( y ), true, 'returns expected value' );
127127

128128
logcdf = factory( NINF, NINF );
129129
y = logcdf( 2.0 );
130-
t.equal( isnan( y ), true, 'returns NaN' );
130+
t.equal( isnan( y ), true, 'returns expected value' );
131131

132132
logcdf = factory( NaN, NINF );
133133
y = logcdf( 2.0 );
134-
t.equal( isnan( y ), true, 'returns NaN' );
134+
t.equal( isnan( y ), true, 'returns expected value' );
135135

136136
t.end();
137137
});

test/test.logcdf.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,49 +46,49 @@ 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 `x0` and `gamma`, 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 `x0` and `gamma`, 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 nonpositive `gamma`, the function always returns `NaN`', function test( t ) {
7070
var y;
7171

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

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

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

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

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

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

9090
y = logcdf( 2.0, NaN, NINF );
91-
t.equal( isnan( y ), true, 'returns NaN' );
91+
t.equal( isnan( y ), true, 'returns expected value' );
9292

9393
t.end();
9494
});

test/test.native.js

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

5656
tape( 'if provided `NaN` for any parameter, the function returns `NaN`', opts, function test( t ) {
5757
var y = logcdf( NaN, 0.0, 1.0 );
58-
t.equal( isnan( y ), true, 'returns NaN' );
58+
t.equal( isnan( y ), true, 'returns expected value' );
5959
y = logcdf( 0.0, NaN, 1.0 );
60-
t.equal( isnan( y ), true, 'returns NaN' );
60+
t.equal( isnan( y ), true, 'returns expected value' );
6161
y = logcdf( 0.0, 1.0, NaN );
62-
t.equal( isnan( y ), true, 'returns NaN' );
62+
t.equal( isnan( y ), true, 'returns expected value' );
6363
t.end();
6464
});
6565

6666
tape( 'if provided `+infinity` for `x` and a finite `x0` and `gamma`, the function returns `0`', opts, function test( t ) {
6767
var y = logcdf( PINF, 0.0, 1.0 );
68-
t.equal( y, 0.0, 'returns 0' );
68+
t.equal( y, 0.0, 'returns expected value' );
6969
t.end();
7070
});
7171

7272
tape( 'if provided `-infinity` for `x` and a finite `x0` and `gamma`, the function returns `-Infinity`', opts, function test( t ) {
7373
var y = logcdf( NINF, 0.0, 1.0 );
74-
t.equal( y, NINF, 'returns -Infinity' );
74+
t.equal( y, NINF, 'returns expected value' );
7575
t.end();
7676
});
7777

7878
tape( 'if provided a nonpositive `gamma`, the function always returns `NaN`', opts, function test( t ) {
7979
var y;
8080

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

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

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

9090
y = logcdf( 2.0, 0.0, NINF );
91-
t.equal( isnan( y ), true, 'returns NaN' );
91+
t.equal( isnan( y ), true, 'returns expected value' );
9292

9393
y = logcdf( 2.0, PINF, NINF );
94-
t.equal( isnan( y ), true, 'returns NaN' );
94+
t.equal( isnan( y ), true, 'returns expected value' );
9595

9696
y = logcdf( 2.0, NINF, NINF );
97-
t.equal( isnan( y ), true, 'returns NaN' );
97+
t.equal( isnan( y ), true, 'returns expected value' );
9898

9999
y = logcdf( 2.0, NaN, NINF );
100-
t.equal( isnan( y ), true, 'returns NaN' );
100+
t.equal( isnan( y ), true, 'returns expected value' );
101101

102102
t.end();
103103
});

0 commit comments

Comments
 (0)