Skip to content

Commit 8ac01c6

Browse files
committed
Auto-generated commit
1 parent 4b2ba60 commit 8ac01c6

18 files changed

Lines changed: 1456 additions & 4 deletions

File tree

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-04-29)
7+
## Unreleased (2025-07-25)
8+
9+
<section class="features">
10+
11+
### Features
12+
13+
- [`394df9c`](https://github.com/stdlib-js/stdlib/commit/394df9cbfe1e319625331814813bfffb5113d8d6) - add C implementation for `stats/base/dists/binomial/entropy` [(#4016)](https://github.com/stdlib-js/stdlib/pull/4016)
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+
[#3466](https://github.com/stdlib-js/stdlib/issues/3466)
26+
27+
</section>
28+
29+
<!-- /.issues -->
830

931
<section class="commits">
1032

1133
### Commits
1234

1335
<details>
1436

37+
- [`394df9c`](https://github.com/stdlib-js/stdlib/commit/394df9cbfe1e319625331814813bfffb5113d8d6) - **feat:** add C implementation for `stats/base/dists/binomial/entropy` [(#4016)](https://github.com/stdlib-js/stdlib/pull/4016) _(by Divyansh Seth, Philipp Burckhardt, stdlib-bot)_
1538
- [`c1df69c`](https://github.com/stdlib-js/stdlib/commit/c1df69ccf92f1ce80f08883226dd4252644f0324) - **docs:** replace manual `for` loop in examples [(#6848)](https://github.com/stdlib-js/stdlib/pull/6848) _(by Harsh, Athan Reines)_
1639
- [`7279e43`](https://github.com/stdlib-js/stdlib/commit/7279e433dc1936056560624b5892eea8d9350ef1) - **bench:** update random value generation [(#6853)](https://github.com/stdlib-js/stdlib/pull/6853) _(by Harsh)_
1740
- [`af55f0d`](https://github.com/stdlib-js/stdlib/commit/af55f0d6d6b4d06c36f46357740ea89a4639ab5b) - **bench:** refactor random number generation in `stats/base/dists/binomial` [(#4841)](https://github.com/stdlib-js/stdlib/pull/4841) _(by Karan Anand)_
@@ -26,11 +49,13 @@
2649

2750
### Contributors
2851

29-
A total of 3 people contributed to this release. Thank you to the following contributors:
52+
A total of 5 people contributed to this release. Thank you to the following contributors:
3053

3154
- Athan Reines
55+
- Divyansh Seth
3256
- Harsh
3357
- Karan Anand
58+
- Philipp Burckhardt
3459

3560
</section>
3661

CONTRIBUTORS

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,17 @@ Ali Salesi <ali_sal1381@yahoo.com>
2121
AlyAbdelmoneim <148393799+AlyAbdelmoneim@users.noreply.github.com>
2222
Aman Bhansali <bhansali.1@iitj.ac.in>
2323
AmanBhadkariya <140033975+AmanBhadkariya@users.noreply.github.com>
24+
Amisha Chhajed <136238836+amishhaa@users.noreply.github.com>
2425
Amit Jimiwal <amitjimiwal45@gmail.com>
26+
Anmol Sah <113588714+anmolsah@users.noreply.github.com>
27+
Annamalai Prabu <apfossdev@gmail.com>
2528
Anshu Kumar <132515490+anxhukumar@users.noreply.github.com>
2629
Anshu Kumar <contact.anshukumar@protonmail.com>
2730
Anudeep Sanapala <anudeep0306@gmail.com>
31+
Arihant Pal <arihant0pal@gmail.com>
32+
Aryan Bhirud <112156883+AryanBhirud@users.noreply.github.com>
2833
Athan Reines <kgryte@gmail.com>
34+
Atharva Patil <124063987+atharva-patil-23@users.noreply.github.com>
2935
Ayaka <73595362+USERSATOSHI@users.noreply.github.com>
3036
Bhavishy Agrawal <90029607+bhavishy2801@users.noreply.github.com>
3137
Brendan Graetz <bguiz@users.noreply.github.com>
@@ -34,10 +40,13 @@ Bryan Elee <rxbryn@gmail.com>
3440
Chinmay Joshi <86140365+JawHawk@users.noreply.github.com>
3541
Christopher Dambamuromo <chridam@gmail.com>
3642
Dan Rose <danoftheroses@gmail.com>
43+
Daniel Hernandez Gomez <156333015+dhernandeez13@users.noreply.github.com>
3744
Daniel Killenberger <daniel.killenberger@gmail.com>
3845
Daniel Yu <40680511+Daniel777y@users.noreply.github.com>
3946
Debashis Maharana <debashismaharana7854@gmail.com>
4047
Deep Trivedi <128926685+thedeeppp@users.noreply.github.com>
48+
Deepak Singh <78257493+Deepak91168@users.noreply.github.com>
49+
Deepak Singh <negid0253@gmail.com>
4150
Desh Deepak Kant <118960904+DeshDeepakKant@users.noreply.github.com>
4251
Dev Goel <135586571+corsairier@users.noreply.github.com>
4352
Dhanyabad behera <110620935+dhanyabad11@users.noreply.github.com>
@@ -53,14 +62,19 @@ Frank Kovacs <fran70kk@gmail.com>
5362
GK Bishnoi <gkishan1kyt@gmail.com>
5463
GURU PRASAD SHARMA <168292003+GURUPRASADSHARMA@users.noreply.github.com>
5564
Gaurav <gaurav70380@gmail.com>
65+
Gautam Kaushik <162317291+Kaushikgtm@users.noreply.github.com>
5666
Gautam sharma <gautamkrishnasharma1@gmail.com>
67+
GeoDaoyu <geodaoyu@foxmail.com>
68+
Girish Garg <garggirish2020@gmail.com>
5769
Golden Kumar <103646877+AuenKr@users.noreply.github.com>
5870
Gunj Joshi <gunjjoshi8372@gmail.com>
5971
Gururaj Gurram <gururajgurram1512@gmail.com>
72+
Harishchandra Reddy <harish.7000@gmail.com>
6073
Haroon Rasheed <51189276+haroon26@users.noreply.github.com>
61-
Harsh <149176984+hrshya@users.noreply.github.com>
74+
Harsh <harshyadav6078@gmail.com>
6275
HarshaNP <96897754+GittyHarsha@users.noreply.github.com>
6376
Harshita Kalani <harshitakalani02@gmail.com>
77+
Hemang Choudhary <coehemang@gmail.com>
6478
Hemant M Mehta <92446645+hemantmm@users.noreply.github.com>
6579
Hridyanshu <124202756+HRIDYANSHU054@users.noreply.github.com>
6680
Jaimin Godhani <112328542+Jai0401@users.noreply.github.com>
@@ -78,6 +92,7 @@ Joris Labie <joris.labie1@gmail.com>
7892
Justin Dennison <justin1dennison@gmail.com>
7993
Justyn Shelby <96994781+ShelbyJustyn@users.noreply.github.com>
8094
Karan Anand <anandkarancompsci@gmail.com>
95+
Karan Vasudevamurthy <karanlvm123@gmail.com>
8196
Karan Yadav <77043443+karanBRAVO@users.noreply.github.com>
8297
Karthik Prakash <116057817+skoriop@users.noreply.github.com>
8398
Kaushikgtm <162317291+Kaushikgtm@users.noreply.github.com>
@@ -86,6 +101,8 @@ Kohantika Nath <145763549+kohantikanath@users.noreply.github.com>
86101
Krishnam Agarwal <83017176+888krishnam@users.noreply.github.com>
87102
Krishnendu Das <86651039+itskdhere@users.noreply.github.com>
88103
Kshitij-Dale <152467202+Kshitij-Dale@users.noreply.github.com>
104+
Lalit Narayan Yadav <162928571+LalitNarayanYadav@users.noreply.github.com>
105+
Lokesh Ranjan <lokesh.ranjan.phe23@itbhu.ac.in>
89106
Lovelin Dhoni J B <100030865+lovelindhoni@users.noreply.github.com>
90107
MANI <77221000+Eternity0207@users.noreply.github.com>
91108
Mahfuza Humayra Mohona <mhmohona@gmail.com>
@@ -114,6 +131,7 @@ Ognjen Jevremović <ognjenjevremovic@users.noreply.github.com>
114131
Oneday12323 <107678750+Oneday12323@users.noreply.github.com>
115132
Ori Miles <97595296+orimiles5@users.noreply.github.com>
116133
Philipp Burckhardt <pburckhardt@outlook.com>
134+
Pierre Forstmann <15964998+pierreforstmann@users.noreply.github.com>
117135
Prajjwal Bajpai <142303989+prajjwalbajpai@users.noreply.github.com>
118136
Prajwal Kulkarni <prajwalkulkarni76@gmail.com>
119137
Pranav Goswami <pranavchiku11@gmail.com>
@@ -143,16 +161,19 @@ Ryan Seal <splrk@users.noreply.github.com>
143161
Rylan Yang <137365285+rylany27@users.noreply.github.com>
144162
SAHIL KUMAR <168997976+sahilk45@users.noreply.github.com>
145163
SHIVAM YADAV <120725381+Shivam-1827@users.noreply.github.com>
164+
Sachin Raj <120590207+schnrj@users.noreply.github.com>
146165
Sahil Goyal <87982509+sahil20021008@users.noreply.github.com>
147166
Sai Avinash <120403424+nasarobot@users.noreply.github.com>
148167
Sai Srikar Dumpeti <80447788+the-r3aper7@users.noreply.github.com>
149168
Sanchay Ketan Sinha <122982233+satansin123@users.noreply.github.com>
150169
Sarthak Paandey <145528240+SarthakPaandey@users.noreply.github.com>
170+
Satyajeet Chavan <chavansatyajeet2004@gmail.com>
151171
Saurabh Singh <saurabhsraghuvanshi@gmail.com>
152172
Seyyed Parsa Neshaei <spneshaei@users.noreply.github.com>
153173
Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com>
154174
Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
155175
Shivam Ahir <11shivam00@gmail.com>
176+
Shivansh <114570926+shiv343@users.noreply.github.com>
156177
Shraddheya Shendre <shendreshraddheya@gmail.com>
157178
Shubh Mehta <93862397+Shubh942@users.noreply.github.com>
158179
Shubham Mishra <shubh622005@gmail.com>
@@ -163,14 +184,19 @@ Spandan Barve <contact@marsian.dev>
163184
Stephannie Jiménez Gacha <steff456@hotmail.com>
164185
Suhaib Ilahi <suhaib.elahi87@gmail.com>
165186
Suraj Kumar <125961509+kumarsuraj212003@users.noreply.github.com>
187+
Swapnil Hajare <69076366+Swapnil-2502@users.noreply.github.com>
166188
Tanishq Ahuja <68651083+TheGEN1U5@users.noreply.github.com>
167189
Tirtadwipa Manunggal <tirtadwipa.manunggal@gmail.com>
168190
Tudor Pagu <104032457+tudor-pagu@users.noreply.github.com>
169191
Tufailahmed Bargir <142114244+Tufailahmed-Bargir@users.noreply.github.com>
192+
Tushar Bhardwaj <155543597+TusharBhardwaj441@users.noreply.github.com>
193+
Uday Kakade <141299403+udaykakade25@users.noreply.github.com>
194+
Ujjwal Kirti <64329707+ujjwalkirti@users.noreply.github.com>
170195
Utkarsh <http://utkarsh11105@gmail.com>
171196
Utkarsh Raj <rajutkarsh2505@gmail.com>
172197
UtkershBasnet <119008923+UtkershBasnet@users.noreply.github.com>
173198
Vaibhav Patel <98279986+noobCoderVP@users.noreply.github.com>
199+
Vara Rahul Rajana <123227543+rajanarahul93@users.noreply.github.com>
174200
Varad Gupta <varadgupta21@gmail.com>
175201
Vinit Pandit <106718914+MeastroZI@users.noreply.github.com>
176202
Vivek Maurya <vm8118134@gmail.com>
@@ -179,14 +205,17 @@ Yaswanth Kosuru <116426380+yaswanthkosuru@users.noreply.github.com>
179205
Yernar Yergaziyev <yernar.yergaziyev@erg.kz>
180206
Yugal Kaushik <yugalkaushik14@gmail.com>
181207
Yuvi Mittal <128018763+yuvi-mittal@users.noreply.github.com>
208+
deepak427 <62477872+deepak427@users.noreply.github.com>
182209
devshree-bhati <147095250+devshree-bhati@users.noreply.github.com>
183210
ditsu <170345142+ditsus@users.noreply.github.com>
184211
ekambains <bainsinbusiness@gmail.com>
185212
fadiothman22 <48636283+fadiothman22@users.noreply.github.com>
186213
iraandrushko <71790513+iraandrushko@users.noreply.github.com>
214+
jsai28 <54253219+jsai28@users.noreply.github.com>
187215
lohithganni <116790357+lohithganni@users.noreply.github.com>
188216
olenkabilonizhka <62379231+olenkabilonizhka@users.noreply.github.com>
189217
pranav-1720 <123018993+pranav-1720@users.noreply.github.com>
190218
rahulrangers <127782777+rahulrangers@users.noreply.github.com>
191219
rainn <88160429+AmCodesLame@users.noreply.github.com>
192220
rei2hu <reimu@reimu.ws>
221+
zhanggy <geodaoyu@foxmail.com>

README.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,106 @@ logEachMap( 'n: %0.4f, p: %0.4f, H(X;n,p): %0.4f', n, p, entropy );
171171

172172
<!-- /.examples -->
173173

174+
<!-- C interface documentation. -->
175+
176+
* * *
177+
178+
<section class="c">
179+
180+
## C APIs
181+
182+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
183+
184+
<section class="intro">
185+
186+
</section>
187+
188+
<!-- /.intro -->
189+
190+
<!-- C usage documentation. -->
191+
192+
<section class="usage">
193+
194+
### Usage
195+
196+
```c
197+
#include "stdlib/stats/base/dists/binomial/entropy.h"
198+
```
199+
200+
#### stdlib_base_dists_binomial_entropy( n, p )
201+
202+
Evaluates the [entropy][entropy] of a [Binomial][binomial-distribution] distribution with `n` the number of trials and `p` the success probability.
203+
204+
```c
205+
double out = stdlib_base_dists_binomial_entropy( 20, 0.1 );
206+
// returns ~1.667
207+
```
208+
209+
The function accepts the following arguments:
210+
211+
- **n**: `[in] int32_t` number of trials.
212+
- **p**: `[in] double` success probability.
213+
214+
```c
215+
double stdlib_base_dists_binomial_entropy( const int32_t n, const double p );
216+
```
217+
218+
</section>
219+
220+
<!-- /.usage -->
221+
222+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
223+
224+
<section class="notes">
225+
226+
</section>
227+
228+
<!-- /.notes -->
229+
230+
<!-- C API usage examples. -->
231+
232+
<section class="examples">
233+
234+
### Examples
235+
236+
```c
237+
#include "stdlib/stats/base/dists/binomial/entropy.h"
238+
#include <stdlib.h>
239+
#include <stdio.h>
240+
#include <stdint.h>
241+
242+
static double random_uniform( const double min, const double max ) {
243+
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
244+
return min + ( v*(max-min) );
245+
}
246+
247+
static int32_t random_int( const int32_t min, const int32_t max ) {
248+
return min + (int32_t)( random_uniform( 0.0, 1.0 ) * ( max - min + 1 ) );
249+
}
250+
251+
int main( void ) {
252+
int32_t n;
253+
double p;
254+
double v;
255+
int i;
256+
257+
for ( i = 0; i < 25; i++ ) {
258+
n = random_int( 0, 100 );
259+
p = random_uniform( 0.0, 1.0 );
260+
v = stdlib_base_dists_binomial_entropy( n, p );
261+
printf( "n: %d, p: %lf, H(X;n,p): %lf\n", n, p, v );
262+
}
263+
}
264+
```
265+
266+
</section>
267+
268+
<!-- /.examples -->
269+
270+
</section>
271+
272+
<!-- /.c -->
273+
174274
<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
175275

176276
<section class="references">

benchmark/benchmark.native.js

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 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-harness' );
25+
var uniform = require( '@stdlib/random-array-uniform' );
26+
var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
27+
var tryRequire = require( '@stdlib/utils-try-require' );
28+
var isnan = require( '@stdlib/math-base-assert-is-nan' );
29+
var pkg = require( './../package.json' ).name;
30+
31+
32+
// VARIABLES //
33+
34+
var entropy = tryRequire( resolve( __dirname, './../lib/native.js' ) );
35+
var opts = {
36+
'skip': ( entropy instanceof Error )
37+
};
38+
39+
40+
// MAIN //
41+
42+
bench( pkg+'::native', opts, function benchmark( b ) {
43+
var len;
44+
var n;
45+
var p;
46+
var y;
47+
var i;
48+
49+
len = 100;
50+
n = discreteUniform( len, 0, 100 );
51+
p = uniform( len, 0.0, 1.0 );
52+
53+
b.tic();
54+
for ( i = 0; i < b.iterations; i++ ) {
55+
y = entropy( n[ i % len ], p[ i % len ] );
56+
if ( isnan( y ) ) {
57+
b.fail( 'should not return NaN' );
58+
}
59+
}
60+
b.toc();
61+
if ( isnan( y ) ) {
62+
b.fail( 'should not return NaN' );
63+
}
64+
b.pass( 'benchmark finished' );
65+
b.end();
66+
});

0 commit comments

Comments
 (0)