Skip to content

Commit 17836de

Browse files
committed
Auto-generated commit
1 parent fb1f3bc commit 17836de

File tree

21 files changed

+1506
-12
lines changed

21 files changed

+1506
-12
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/base/dists/triangular/logcdf) of the main repository where we’ll review and provide feedback.
44

5-
If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib.
5+
If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib.
66

77
We look forward to receiving your contribution! :smiley:

CHANGELOG.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,37 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2025-02-19)
7+
## Unreleased (2025-03-07)
8+
9+
<section class="features">
10+
11+
### Features
12+
13+
- [`be656a1`](https://github.com/stdlib-js/stdlib/commit/be656a143216896aa6b1ce0df89646e6a3565ec9) - add C implementation for `stats/base/dists/triangular/logcdf` [(#4326)](https://github.com/stdlib-js/stdlib/pull/4326)
14+
15+
</section>
16+
17+
<!-- /.features -->
18+
19+
<section class="issues">
20+
21+
### Closed Issues
22+
23+
This release closes the following issue:
24+
25+
[#3814](https://github.com/stdlib-js/stdlib/issues/3814)
26+
27+
</section>
28+
29+
<!-- /.issues -->
830

931
<section class="commits">
1032

1133
### Commits
1234

1335
<details>
1436

37+
- [`be656a1`](https://github.com/stdlib-js/stdlib/commit/be656a143216896aa6b1ce0df89646e6a3565ec9) - **feat:** add C implementation for `stats/base/dists/triangular/logcdf` [(#4326)](https://github.com/stdlib-js/stdlib/pull/4326) _(by Prashant Kumar Yadav, Philipp Burckhardt, stdlib-bot)_
1538
- [`c7bfa92`](https://github.com/stdlib-js/stdlib/commit/c7bfa923af0c5346766c90300e0d0a3c2188d438) - **docs:** fix missing ending `section` in various READMEs [(#5292)](https://github.com/stdlib-js/stdlib/pull/5292) _(by Saurabh Singh)_
1639

1740
</details>
@@ -24,8 +47,10 @@
2447

2548
### Contributors
2649

27-
A total of 1 person contributed to this release. Thank you to this contributor:
50+
A total of 3 people contributed to this release. Thank you to the following contributors:
2851

52+
- Philipp Burckhardt
53+
- Prashant Kumar Yadav
2954
- Saurabh Singh
3055

3156
</section>

CONTRIBUTORS

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,21 @@
44

55
Aadish Jain <jain.aadishj@gmail.com>
66
Aayush Khanna <aayushiitbhu23@gmail.com>
7+
Abdelrahman Samir <60700731+abdelrahman04@users.noreply.github.com>
8+
Abhay Punia <156515195+Hecker165@users.noreply.github.com>
79
Abhijit Raut <abhijitmraut8010@gmail.com>
10+
Abhishek Jain <40913033+abhishekblue@users.noreply.github.com>
811
Adarsh Palaskar <adarshpalaskar99@gmail.com>
912
Aditya Sapra <adityaework@gmail.com>
1013
Ahmed Atwa <Ahmedatwa866@yahoo.com>
1114
Ahmed Kashkoush <ahmedkashkoush464@gmail.com>
1215
Ahmed Khaled <kahmd1444@gmail.com>
16+
Aksshay Balasubramanian <119944779+Aksshay88@users.noreply.github.com>
1317
Aleksandr <112382387+alextes90@users.noreply.github.com>
1418
Ali Salesi <ali_sal1381@yahoo.com>
1519
Aman Bhansali <bhansali.1@iitj.ac.in>
1620
Amit Jimiwal <amitjimiwal45@gmail.com>
21+
Anshu Kumar <132515490+anxhukumar@users.noreply.github.com>
1722
Anudeep Sanapala <anudeep0306@gmail.com>
1823
Athan Reines <kgryte@gmail.com>
1924
Ayaka <73595362+USERSATOSHI@users.noreply.github.com>
@@ -29,6 +34,7 @@ Debashis Maharana <debashismaharana7854@gmail.com>
2934
Desh Deepak Kant <118960904+DeshDeepakKant@users.noreply.github.com>
3035
Dev Goel <135586571+corsairier@users.noreply.github.com>
3136
Dhruv Arvind Singh <154677013+DhruvArvindSingh@users.noreply.github.com>
37+
Dhruvil Mehta <68022411+dhruvilmehta@users.noreply.github.com>
3238
Divyansh Seth <59174836+sethdivyansh@users.noreply.github.com>
3339
Dominic Lim <46486515+domlimm@users.noreply.github.com>
3440
Dominik Moritz <domoritz@gmail.com>
@@ -37,14 +43,17 @@ EuniceSim142 <77243938+EuniceSim142@users.noreply.github.com>
3743
Frank Kovacs <fran70kk@gmail.com>
3844
GK Bishnoi <gkishan1kyt@gmail.com>
3945
Gaurav <gaurav70380@gmail.com>
46+
Gautam sharma <gautamkrishnasharma1@gmail.com>
4047
Golden Kumar <103646877+AuenKr@users.noreply.github.com>
4148
Gunj Joshi <gunjjoshi8372@gmail.com>
4249
Gururaj Gurram <gururajgurram1512@gmail.com>
4350
Harsh <149176984+hrshya@users.noreply.github.com>
4451
HarshaNP <96897754+GittyHarsha@users.noreply.github.com>
4552
Harshita Kalani <harshitakalani02@gmail.com>
53+
Hemant M Mehta <92446645+hemantmm@users.noreply.github.com>
4654
Hridyanshu <124202756+HRIDYANSHU054@users.noreply.github.com>
4755
Jaimin Godhani <112328542+Jai0401@users.noreply.github.com>
56+
Jalaj Kumar <142599224+jalajk3004@users.noreply.github.com>
4857
James Gelok <jdgelok@gmail.com>
4958
Jaysukh Makvana <jaysukhmakvana2004@gmail.com>
5059
Jenish Thapa <141203631+jenish-thapa@users.noreply.github.com>
@@ -54,9 +63,11 @@ Joey Reed <joeyrreed@gmail.com>
5463
Jordan Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com>
5564
Joris Labie <joris.labie1@gmail.com>
5665
Justin Dennison <justin1dennison@gmail.com>
66+
Justyn Shelby <96994781+ShelbyJustyn@users.noreply.github.com>
5767
Karan Anand <119553199+anandkaranubc@users.noreply.github.com>
5868
Karthik Prakash <116057817+skoriop@users.noreply.github.com>
5969
Kohantika Nath <145763549+kohantikanath@users.noreply.github.com>
70+
Krishnam Agarwal <83017176+888krishnam@users.noreply.github.com>
6071
Krishnendu Das <86651039+itskdhere@users.noreply.github.com>
6172
Kshitij-Dale <152467202+Kshitij-Dale@users.noreply.github.com>
6273
Lovelin Dhoni J B <100030865+lovelindhoni@users.noreply.github.com>
@@ -74,6 +85,7 @@ Naresh Jagadeesan <naresh.naresh000@gmail.com>
7485
Naveen Kumar <stupiddint@gmail.com>
7586
Neeraj Pathak <neerajrpathak710@gmail.com>
7687
Nishant Shinde <97207366+nishant-s7@users.noreply.github.com>
88+
Nishchay Rajput <121144841+NishchayRajput@users.noreply.github.com>
7789
Nithin Katta <88046362+nithinkatta@users.noreply.github.com>
7890
Nourhan Hasan <109472010+TheNourhan@users.noreply.github.com>
7991
Ognjen Jevremović <ognjenjevremovic@users.noreply.github.com>
@@ -94,6 +106,7 @@ Rejoan Sardar <119718513+Rejoan-Sardar@users.noreply.github.com>
94106
Ricky Reusser <rsreusser@gmail.com>
95107
Ridam Garg <67867319+RidamGarg@users.noreply.github.com>
96108
Rishav <115060907+rishav2404@users.noreply.github.com>
109+
Rishav Tarway <rishavtarway@gmail.com>
97110
Robert Gislason <gztown2216@yahoo.com>
98111
Roman Stetsyk <25715951+romanstetsyk@users.noreply.github.com>
99112
Rutam Kathale <138517416+performant23@users.noreply.github.com>
@@ -117,6 +130,7 @@ Spandan Barve <contact@marsian.dev>
117130
Stephannie Jiménez Gacha <steff456@hotmail.com>
118131
Suhaib Ilahi <suhaib.elahi87@gmail.com>
119132
Suraj Kumar <125961509+kumarsuraj212003@users.noreply.github.com>
133+
Tanishq Ahuja <68651083+TheGEN1U5@users.noreply.github.com>
120134
Tirtadwipa Manunggal <tirtadwipa.manunggal@gmail.com>
121135
Tudor Pagu <104032457+tudor-pagu@users.noreply.github.com>
122136
Tufailahmed Bargir <142114244+Tufailahmed-Bargir@users.noreply.github.com>
@@ -130,9 +144,13 @@ Vivek Maurya <vm8118134@gmail.com>
130144
Xiaochuan Ye <tap91624@gmail.com>
131145
Yaswanth Kosuru <116426380+yaswanthkosuru@users.noreply.github.com>
132146
Yernar Yergaziyev <yernar.yergaziyev@erg.kz>
147+
Yugal Kaushik <yugalkaushik14@gmail.com>
133148
Yuvi Mittal <128018763+yuvi-mittal@users.noreply.github.com>
149+
ditsu <170345142+ditsus@users.noreply.github.com>
134150
ekambains <bainsinbusiness@gmail.com>
151+
fadiothman22 <48636283+fadiothman22@users.noreply.github.com>
135152
olenkabilonizhka <62379231+olenkabilonizhka@users.noreply.github.com>
136153
pranav-1720 <123018993+pranav-1720@users.noreply.github.com>
154+
rahulrangers <127782777+rahulrangers@users.noreply.github.com>
137155
rainn <88160429+AmCodesLame@users.noreply.github.com>
138156
rei2hu <reimu@reimu.ws>

README.md

Lines changed: 100 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ y = mylogcdf( 8.0 );
154154

155155
## Notes
156156

157-
- In virtually all cases, using the `logpdf` or `logcdf` functions is preferable to manually computing the logarithm of the `pdf` or `cdf`, respectively, since the latter is prone to overflow and underflow.
157+
- In virtually all cases, using the `logcdf` or `logcdf` functions is preferable to manually computing the logarithm of the `pdf` or `cdf`, respectively, since the latter is prone to overflow and underflow.
158158

159159
</section>
160160

@@ -191,6 +191,105 @@ for ( i = 0; i < 25; i++ ) {
191191

192192
<!-- /.examples -->
193193

194+
<!-- C interface documentation. -->
195+
196+
* * *
197+
198+
<section class="c">
199+
200+
## C APIs
201+
202+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
203+
204+
<section class="intro">
205+
206+
</section>
207+
208+
<!-- /.intro -->
209+
210+
<!-- C usage documentation. -->
211+
212+
<section class="usage">
213+
214+
### Usage
215+
216+
```c
217+
#include "stdlib/stats/base/dists/geometric/logcdf.h"
218+
```
219+
220+
#### stdlib_base_dists_geometric_logcdf( x, a, b, c )
221+
222+
Evaluates the natural logarithm of the [cumulative distribution function][cdf] (CDF) for a [triangular][triangular-distribution] distribution with parameters `a` (lower limit), `b` (upper limit) and `c` (mode).
223+
224+
```c
225+
double y = stdlib_base_dists_geometric_logcdf( 0.5, -1.0, 1.0, 0.0 );
226+
// returns ~-0.134
227+
```
228+
229+
The function accepts the following arguments:
230+
231+
- **x**: `[in] double` input value.
232+
- **a**: `[in] double` lower limit.
233+
- **b**: `[in] double` upper limit.
234+
- **c**: `[in] double` mode.
235+
236+
```c
237+
double stdlib_base_dists_geometric_logcdf( const double x, const double a, const double b, const double c );
238+
```
239+
240+
</section>
241+
242+
<!-- /.usage -->
243+
244+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
245+
246+
<section class="notes">
247+
248+
</section>
249+
250+
<!-- /.notes -->
251+
252+
<!-- C API usage examples. -->
253+
254+
<section class="examples">
255+
256+
### Examples
257+
258+
```c
259+
#include "stdlib/stats/base/dists/triangular/logcdf.h"
260+
#include "stdlib/constants/float64/eps.h"
261+
#include <stdlib.h>
262+
#include <stdio.h>
263+
#include <math.h>
264+
265+
static double random_uniform( const double min, const double max ) {
266+
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
267+
return min + ( v*(max-min) );
268+
}
269+
270+
int main( void ) {
271+
double a;
272+
double b;
273+
double c;
274+
double x;
275+
double y;
276+
int i;
277+
278+
for ( i = 0; i < 25; i++ ) {
279+
x = random_uniform( 0.0, 30.0 );
280+
a = random_uniform( 0.0, 10.0 );
281+
b = random_uniform( a + STDLIB_CONSTANT_FLOAT64_EPS, 40.0 );
282+
c = random_uniform( a, b );
283+
y = stdlib_base_dists_triangular_logcdf( x, a, b, c );
284+
printf( "x: %lf, a: %lf, b: %lf, c: %lf, ln(F(x;a,b,c)): %lf\n", x, a, b, c, y );
285+
}
286+
}
287+
```
288+
289+
</section>
290+
291+
<!-- /.examples -->
292+
194293
</section>
195294

196295
<!-- /.c -->

benchmark/benchmark.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench-harness' );
24-
var randu = require( '@stdlib/random-base-randu' );
24+
var uniform = require( '@stdlib/random-base-uniform' );
2525
var isnan = require( '@stdlib/math-base-assert-is-nan' );
26+
var Float64Array = require( '@stdlib/array-float64' );
2627
var EPS = require( '@stdlib/constants-float64-eps' );
2728
var pkg = require( './../package.json' ).name;
2829
var logcdf = require( './../lib' );
@@ -34,17 +35,26 @@ bench( pkg, function benchmark( b ) {
3435
var mode;
3536
var min;
3637
var max;
38+
var len;
3739
var x;
3840
var y;
3941
var i;
4042

43+
len = 100;
44+
x = new Float64Array( len );
45+
min = new Float64Array( len );
46+
max = new Float64Array( len );
47+
mode = new Float64Array( len );
48+
for ( i = 0; i < len; i++ ) {
49+
x[ i ] = uniform( 0.0, 30.0 );
50+
min[ i ] = uniform( 0.0, 10.0 );
51+
max[ i ] = uniform( min[ i ] + EPS, min[ i ] + 40.0 );
52+
mode[ i ] = uniform( min[ i ], max[ i ] );
53+
}
54+
4155
b.tic();
4256
for ( i = 0; i < b.iterations; i++ ) {
43-
x = randu() * 30.0;
44-
min = randu() * 10.0;
45-
max = min + ( randu() * 40.0 ) + EPS;
46-
mode = min + ( ( max - min ) * randu() );
47-
y = logcdf( x, min, max, mode );
57+
y = logcdf( x[ i%len ], min[ i%len ], max[ i%len ], mode[ i%len ] );
4858
if ( isnan( y ) ) {
4959
b.fail( 'should not return NaN' );
5060
}
@@ -73,7 +83,7 @@ bench( pkg+':factory', function benchmark( b ) {
7383

7484
b.tic();
7585
for ( i = 0; i < b.iterations; i++ ) {
76-
x = ( randu()*2.0 ) - 2.0;
86+
x = uniform( -2.0, 2.0 );
7787
y = mylogcdf( x );
7888
if ( isnan( y ) ) {
7989
b.fail( 'should not return NaN' );

0 commit comments

Comments
 (0)