Skip to content

Commit 546d8fa

Browse files
committed
Auto-generated commit
1 parent 3090ad3 commit 546d8fa

File tree

18 files changed

+1449
-9
lines changed

18 files changed

+1449
-9
lines changed

CHANGELOG.md

+38-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,46 @@
44

55
<section class="release" id="unreleased">
66

7-
## Unreleased (2024-12-10)
7+
## Unreleased (2024-12-11)
88

99
<section class="packages">
1010

1111
### Packages
1212

13+
<section class="package" id="stats-base-dists-arcsine-cdf-unreleased">
14+
15+
#### [@stdlib/stats/base/dists/arcsine/cdf](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/base/dists/arcsine/cdf)
16+
17+
<details>
18+
19+
<section class="features">
20+
21+
##### Features
22+
23+
- [`e7e0f46`](https://github.com/stdlib-js/stdlib/commit/e7e0f4690074d14b9e2b86a6bc3c61d75ce66ac0) - add C implementation for arcsine CDF [(#3354)](https://github.com/stdlib-js/stdlib/pull/3354)
24+
25+
</section>
26+
27+
<!-- /.features -->
28+
29+
<section class="issues">
30+
31+
##### Closed Issues
32+
33+
This release closes the following issue:
34+
35+
[#3384](https://github.com/stdlib-js/stdlib/issues/3384)
36+
37+
</section>
38+
39+
<!-- /.issues -->
40+
41+
</details>
42+
43+
</section>
44+
45+
<!-- /.package -->
46+
1347
<section class="package" id="stats-base-dists-chisquare-unreleased">
1448

1549
#### [@stdlib/stats/base/dists/chisquare](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/base/dists/chisquare)
@@ -162,9 +196,9 @@ A total of 3 issues were closed in this release:
162196

163197
### Closed Issues
164198

165-
A total of 6 issues were closed in this release:
199+
A total of 7 issues were closed in this release:
166200

167-
[#1619](https://github.com/stdlib-js/stdlib/issues/1619), [#1632](https://github.com/stdlib-js/stdlib/issues/1632), [#1633](https://github.com/stdlib-js/stdlib/issues/1633), [#3236](https://github.com/stdlib-js/stdlib/issues/3236), [#3237](https://github.com/stdlib-js/stdlib/issues/3237), [#3238](https://github.com/stdlib-js/stdlib/issues/3238)
201+
[#1619](https://github.com/stdlib-js/stdlib/issues/1619), [#1632](https://github.com/stdlib-js/stdlib/issues/1632), [#1633](https://github.com/stdlib-js/stdlib/issues/1633), [#3236](https://github.com/stdlib-js/stdlib/issues/3236), [#3237](https://github.com/stdlib-js/stdlib/issues/3237), [#3238](https://github.com/stdlib-js/stdlib/issues/3238), [#3384](https://github.com/stdlib-js/stdlib/issues/3384)
168202

169203
</section>
170204

@@ -193,6 +227,7 @@ A total of 6 people contributed to this release. Thank you to the following cont
193227

194228
<details>
195229

230+
- [`e7e0f46`](https://github.com/stdlib-js/stdlib/commit/e7e0f4690074d14b9e2b86a6bc3c61d75ce66ac0) - **feat:** add C implementation for arcsine CDF [(#3354)](https://github.com/stdlib-js/stdlib/pull/3354) _(by Philipp Burckhardt, Athan Reines, stdlib-bot)_
196231
- [`ac06419`](https://github.com/stdlib-js/stdlib/commit/ac06419c2a8358dfd80818823f571077eb58958e) - **docs:** update related packages sections [(#3387)](https://github.com/stdlib-js/stdlib/pull/3387) _(by stdlib-bot)_
197232
- [`f8dc5fc`](https://github.com/stdlib-js/stdlib/commit/f8dc5fce6476df26e8703b8af8028dfd1477a515) - **docs:** fix C lint errors [(#3249)](https://github.com/stdlib-js/stdlib/pull/3249) _(by Neeraj Pathak, Athan Reines)_
198233
- [`28bdda3`](https://github.com/stdlib-js/stdlib/commit/28bdda3affa89470bbdf531cb3bbc233c85d3d17) - **docs:** improve examples of `stats/base/dists/chisquare` namespace [(#2678)](https://github.com/stdlib-js/stdlib/pull/2678) _(by Kohantika Nath, Philipp Burckhardt)_

base/dists/arcsine/cdf/README.md

+98
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,104 @@ for ( i = 0; i < 25; i++ ) {
137137

138138
<!-- /.examples -->
139139

140+
<!-- C interface documentation. -->
141+
142+
* * *
143+
144+
<section class="c">
145+
146+
## C APIs
147+
148+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
149+
150+
<section class="intro">
151+
152+
</section>
153+
154+
<!-- /.intro -->
155+
156+
<!-- C usage documentation. -->
157+
158+
<section class="usage">
159+
160+
### Usage
161+
162+
```c
163+
#include "stdlib/stats/base/dists/arcsine/cdf.h"
164+
```
165+
166+
#### stdlib_base_dists_arcsine_cdf( x, a, b )
167+
168+
Evaluates the cumulative distribution function (CDF) for an arcsine distribution.
169+
170+
```c
171+
double out = stdlib_base_dists_arcsine_cdf( 0.5, 0.0, 2.0 );
172+
// returns ~0.333
173+
```
174+
175+
The function accepts the following arguments:
176+
177+
- **x**: `[in] double` input value.
178+
- **a**: `[in] double` minimum support.
179+
- **b**: `[in] double` maximum support.
180+
181+
```c
182+
double stdlib_base_dists_arcsine_cdf( const double x, const double a, const double b );
183+
```
184+
185+
</section>
186+
187+
<!-- /.usage -->
188+
189+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
190+
191+
<section class="notes">
192+
193+
</section>
194+
195+
<!-- /.notes -->
196+
197+
<!-- C API usage examples. -->
198+
199+
<section class="examples">
200+
201+
### Examples
202+
203+
```c
204+
#include "stdlib/stats/base/dists/arcsine/cdf.h"
205+
#include <stdlib.h>
206+
#include <stdio.h>
207+
208+
static double random_uniform( const double min, const double max ) {
209+
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
210+
return min + ( v*(max-min) );
211+
}
212+
213+
int main( void ) {
214+
double x;
215+
double a;
216+
double b;
217+
double y;
218+
int i;
219+
220+
for ( i = 0; i < 25; i++ ) {
221+
x = random_uniform( -10.0, 10.0 );
222+
a = random_uniform( -20.0, 0.0 );
223+
b = random_uniform( a, a+40.0 );
224+
y = stdlib_base_dists_arcsine_cdf( x, a, b );
225+
printf( "x: %lf, a: %lf, b: %lf, F(x;a,b): %lf\n", x, a, b, y );
226+
}
227+
}
228+
```
229+
230+
</section>
231+
232+
<!-- /.examples -->
233+
234+
</section>
235+
236+
<!-- /.c -->
237+
140238
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
141239

142240
<section class="related">

base/dists/arcsine/cdf/benchmark/benchmark.js

+16-6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench' );
24+
var Float64Array = require( '@stdlib/array/float64' );
25+
var uniform = require( '@stdlib/random/array/uniform' );
2426
var randu = require( '@stdlib/random/base/randu' );
2527
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2628
var pkg = require( './../package.json' ).name;
@@ -30,18 +32,26 @@ var cdf = require( './../lib' );
3032
// MAIN //
3133

3234
bench( pkg, function benchmark( b ) {
35+
var len;
3336
var min;
3437
var max;
3538
var x;
3639
var y;
3740
var i;
3841

42+
len = 100;
43+
x = new Float64Array( len );
44+
min = new Float64Array( len );
45+
max = new Float64Array( len );
46+
for ( i = 0; i < len; i++ ) {
47+
x[ i ] = ( randu() * 20.0 ) - 10.0;
48+
min[ i ] = ( randu() * 20.0 ) - 20.0;
49+
max[ i ] = min[ i ] + ( randu() * 40.0 );
50+
}
51+
3952
b.tic();
4053
for ( i = 0; i < b.iterations; i++ ) {
41-
x = ( randu() * 20.0 ) - 10.0;
42-
min = ( randu() * 20.0 ) - 20.0;
43-
max = min + ( randu() * 40.0 );
44-
y = cdf( x, min, max );
54+
y = cdf( x[ i % len ], min[ i % len ], max[ i % len ] );
4555
if ( isnan( y ) ) {
4656
b.fail( 'should not return NaN' );
4757
}
@@ -65,11 +75,11 @@ bench( pkg+':factory', function benchmark( b ) {
6575
min = -1.5;
6676
max = 1.5;
6777
mycdf = cdf.factory( min, max );
78+
x = uniform( 100, -2.0, 2.0 );
6879

6980
b.tic();
7081
for ( i = 0; i < b.iterations; i++ ) {
71-
x = ( randu()*2.0 ) - 2.0;
72-
y = mycdf( x );
82+
y = mycdf( x[ i % x.length ] );
7383
if ( isnan( y ) ) {
7484
b.fail( 'should not return NaN' );
7585
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2024 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var resolve = require( 'path' ).resolve;
24+
var bench = require( '@stdlib/bench' );
25+
var Float64Array = require( '@stdlib/array/float64' );
26+
var randu = require( '@stdlib/random/base/randu' );
27+
var isnan = require( '@stdlib/math/base/assert/is-nan' );
28+
var tryRequire = require( '@stdlib/utils/try-require' );
29+
var pkg = require( './../package.json' ).name;
30+
31+
32+
// VARIABLES //
33+
34+
var cdf = tryRequire( resolve( __dirname, './../lib/native.js' ) );
35+
var opts = {
36+
'skip': ( cdf instanceof Error )
37+
};
38+
39+
40+
// MAIN //
41+
42+
bench( pkg, opts, function benchmark( b ) {
43+
var len;
44+
var min;
45+
var max;
46+
var x;
47+
var y;
48+
var i;
49+
50+
len = 100;
51+
x = new Float64Array( len );
52+
min = new Float64Array( len );
53+
max = new Float64Array( len );
54+
for ( i = 0; i < len; i++ ) {
55+
x[ i ] = ( randu() * 20.0 ) - 10.0;
56+
min[ i ] = ( randu() * 20.0 ) - 20.0;
57+
max[ i ] = min[ i ] + ( randu() * 40.0 );
58+
}
59+
60+
b.tic();
61+
for ( i = 0; i < b.iterations; i++ ) {
62+
y = cdf( x[ i % len ], min[ i % len ], max[ i % len ] );
63+
if ( isnan( y ) ) {
64+
b.fail( 'should not return NaN' );
65+
}
66+
}
67+
b.toc();
68+
if ( isnan( y ) ) {
69+
b.fail( 'should not return NaN' );
70+
}
71+
b.pass( 'benchmark finished' );
72+
b.end();
73+
});

0 commit comments

Comments
 (0)