Skip to content

Commit 2cd4c5e

Browse files
committed
Auto-generated commit
1 parent 546d8fa commit 2cd4c5e

File tree

17 files changed

+1439
-3
lines changed

17 files changed

+1439
-3
lines changed

CHANGELOG.md

+39-3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,40 @@ This release closes the following issue:
4444

4545
<!-- /.package -->
4646

47+
<section class="package" id="stats-base-dists-arcsine-logpdf-unreleased">
48+
49+
#### [@stdlib/stats/base/dists/arcsine/logpdf](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/base/dists/arcsine/logpdf)
50+
51+
<details>
52+
53+
<section class="features">
54+
55+
##### Features
56+
57+
- [`1d283b5`](https://github.com/stdlib-js/stdlib/commit/1d283b5f174dc2ec7770bd7be861cdb2f146027d) - add C implementation of `stats/base/dists/arcsine/logpdf` [(#3454)](https://github.com/stdlib-js/stdlib/pull/3454)
58+
59+
</section>
60+
61+
<!-- /.features -->
62+
63+
<section class="issues">
64+
65+
##### Closed Issues
66+
67+
This release closes the following issue:
68+
69+
[#3401](https://github.com/stdlib-js/stdlib/issues/3401)
70+
71+
</section>
72+
73+
<!-- /.issues -->
74+
75+
</details>
76+
77+
</section>
78+
79+
<!-- /.package -->
80+
4781
<section class="package" id="stats-base-dists-chisquare-unreleased">
4882

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

197231
### Closed Issues
198232

199-
A total of 7 issues were closed in this release:
233+
A total of 8 issues were closed in this release:
200234

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)
235+
[#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), [#3401](https://github.com/stdlib-js/stdlib/issues/3401)
202236

203237
</section>
204238

@@ -208,14 +242,15 @@ A total of 7 issues were closed in this release:
208242

209243
### Contributors
210244

211-
A total of 6 people contributed to this release. Thank you to the following contributors:
245+
A total of 7 people contributed to this release. Thank you to the following contributors:
212246

213247
- Athan Reines
214248
- Kohantika Nath
215249
- Neeraj Pathak
216250
- Philipp Burckhardt
217251
- Pratyush Kumar Chouhan
218252
- Ruthwik Chikoti
253+
- Vinit Pandit
219254

220255
</section>
221256

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

228263
<details>
229264

265+
- [`1d283b5`](https://github.com/stdlib-js/stdlib/commit/1d283b5f174dc2ec7770bd7be861cdb2f146027d) - **feat:** add C implementation of `stats/base/dists/arcsine/logpdf` [(#3454)](https://github.com/stdlib-js/stdlib/pull/3454) _(by Vinit Pandit, Philipp Burckhardt)_
230266
- [`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)_
231267
- [`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)_
232268
- [`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)_

base/dists/arcsine/logpdf/README.md

+105
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,110 @@ for ( i = 0; i < 25; i++ ) {
147147

148148
<!-- /.examples -->
149149

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

152256
<section class="related">
@@ -166,3 +270,4 @@ for ( i = 0; i < 25; i++ ) {
166270
</section>
167271

168272
<!-- /.links -->
273+
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 logpdf = tryRequire( resolve( __dirname, './../lib/native.js' ) );
35+
var opts = {
36+
'skip': ( logpdf 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 = logpdf( 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)