Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Dec 19, 2024
1 parent 28601b2 commit 5641a3f
Show file tree
Hide file tree
Showing 21 changed files with 1,385 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ indent_style = tab
[*.{md,md.txt}]
indent_style = space
indent_size = 4
trim_trailing_whitespace = false
trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim.
# Set properties for `usage.txt` files:
[usage.txt]
Expand Down
1 change: 0 additions & 1 deletion .github/.keepalive

This file was deleted.

57 changes: 57 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,63 @@

> Package changelog.
<section class="release" id="unreleased">

## Unreleased (2024-12-19)

<section class="features">

### Features

- [`4d6fbbd`](https://github.com/stdlib-js/stdlib/commit/4d6fbbd6ec73ee9d0ccb3bba1869f34d184329dd) - add C implementation for `stats/base/dists/uniform/entropy` [(#4021)](https://github.com/stdlib-js/stdlib/pull/4021)

</section>

<!-- /.features -->

<section class="issues">

### Closed Issues

This release closes the following issue:

[#3826](https://github.com/stdlib-js/stdlib/issues/3826)

</section>

<!-- /.issues -->

<section class="commits">

### Commits

<details>

- [`4d6fbbd`](https://github.com/stdlib-js/stdlib/commit/4d6fbbd6ec73ee9d0ccb3bba1869f34d184329dd) - **feat:** add C implementation for `stats/base/dists/uniform/entropy` [(#4021)](https://github.com/stdlib-js/stdlib/pull/4021) _(by Divyansh Seth, Philipp Burckhardt)_

</details>

</section>

<!-- /.commits -->

<section class="contributors">

### Contributors

A total of 2 people contributed to this release. Thank you to the following contributors:

- Divyansh Seth
- Philipp Burckhardt

</section>

<!-- /.contributors -->

</section>

<!-- /.release -->

<section class="release" id="v0.2.2">

## 0.2.2 (2024-07-27)
Expand Down
37 changes: 21 additions & 16 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
#
# Contributors listed in alphabetical order.

Aadish Jain <jain.aadishj@gmail.com>
Aayush Khanna <aayushiitbhu23@gmail.com>
Abhijit Raut <abhijitmraut8010@gmail.com>
Adarsh Palaskar <adarshpalaskar99@gmail.com>
Aditya Sapra <adityaework@gmail.com>
AgPriyanshu18 <113460573+AgPriyanshu18@users.noreply.github.com>
Ahmed Atwa <Ahmedatwa866@yahoo.com>
Ahmed Kashkoush <ahmedkashkoush464@gmail.com>
Ahmed Khaled <kahmd1444@gmail.com>
Aleksandr <112382387+alextes90@users.noreply.github.com>
Ali Salesi <ali_sal1381@yahoo.com>
Aman Bhansali <bhansali.1@iitj.ac.in>
Expand All @@ -23,6 +26,7 @@ Dan Rose <danoftheroses@gmail.com>
Daniel Killenberger <daniel.killenberger@gmail.com>
Daniel Yu <40680511+Daniel777y@users.noreply.github.com>
Debashis Maharana <debashismaharana7854@gmail.com>
Divyansh Seth <59174836+sethdivyansh@users.noreply.github.com>
Dominic Lim <46486515+domlimm@users.noreply.github.com>
Dominik Moritz <domoritz@gmail.com>
Dorrin Sotoudeh <dorrinsotoudeh123@gmail.com>
Expand All @@ -45,12 +49,12 @@ Jordan Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com>
Joris Labie <joris.labie1@gmail.com>
Justin Dennison <justin1dennison@gmail.com>
Karthik Prakash <116057817+skoriop@users.noreply.github.com>
Khaldon <kahmd1444@gmail.com>
Kohantika Nath <145763549+kohantikanath@users.noreply.github.com>
Krishnendu Das <86651039+itskdhere@users.noreply.github.com>
Kshitij-Dale <152467202+Kshitij-Dale@users.noreply.github.com>
Lovelin <100030865+lovelindhoni@users.noreply.github.com>
Lovelin Dhoni J B <100030865+lovelindhoni@users.noreply.github.com>
Manik Sharma <maniksharma.rke@gmail.com>
Manvith M <148960168+manvith2003@users.noreply.github.com>
Marcus Fantham <mfantham@users.noreply.github.com>
Matt Cochrane <matthew.cochrane.eng@gmail.com>
Mihir Pandit <129577900+MSP20086@users.noreply.github.com>
Expand All @@ -59,37 +63,40 @@ Mohammad Kaif <mdkaifprofession@gmail.com>
Momtchil Momtchev <momtchil@momtchev.com>
Muhammad Haris <harriskhan047@outlook.com>
Naresh Jagadeesan <naresh.naresh000@gmail.com>
Naveen Kumar <stupiddint@gmail.com>
Neeraj Pathak <neerajrpathak710@gmail.com>
NightKnight <Ahmedatwa866@yahoo.com>
Nishant Shinde <97207366+nishant-s7@users.noreply.github.com>
Nithin Katta <88046362+nithinkatta@users.noreply.github.com>
Nourhan Hasan <109472010+TheNourhan@users.noreply.github.com>
Ognjen Jevremović <ognjenjevremovic@users.noreply.github.com>
Oneday12323 <107678750+Oneday12323@users.noreply.github.com>
Ori Miles <97595296+orimiles5@users.noreply.github.com>
Philipp Burckhardt <pburckhardt@outlook.com>
Prajwal Kulkarni <prajwalkulkarni76@gmail.com>
Pranav Goswami <goswami.4@iitj.ac.in>
Praneki <97080887+PraneGIT@users.noreply.github.com>
Pratik <97464067+Pratik772846@users.noreply.github.com>
Pranjal Jha <97080887+PraneGIT@users.noreply.github.com>
Pratik Singh <97464067+Pratik772846@users.noreply.github.com>
Pratyush Kumar Chouhan <pratyushkumar0308@gmail.com>
Priyansh <88396544+itsspriyansh@users.noreply.github.com>
Priyansh Prajapati <88396544+itsspriyansh@users.noreply.github.com>
Priyanshu Agarwal <113460573+AgPriyanshu18@users.noreply.github.com>
Pushpendra Chandravanshi <pushpendrachandravanshi4@gmail.com>
RISHAV <115060907+rishav2404@users.noreply.github.com>
Raunak Kumar Gupta <raunakmodanwal321@gmail.com>
Rejoan Sardar <119718513+Rejoan-Sardar@users.noreply.github.com>
Ricky Reusser <rsreusser@gmail.com>
Ridam Garg <67867319+RidamGarg@users.noreply.github.com>
Rishav <115060907+rishav2404@users.noreply.github.com>
Robert Gislason <gztown2216@yahoo.com>
Roman Stetsyk <25715951+romanstetsyk@users.noreply.github.com>
Rutam <138517416+performant23@users.noreply.github.com>
Rutam Kathale <138517416+performant23@users.noreply.github.com>
Ruthwik Chikoti <145591715+ruthwikchikoti@users.noreply.github.com>
Ryan Seal <splrk@users.noreply.github.com>
Rylan Yang <137365285+rylany27@users.noreply.github.com>
Sai Srikar Dumpeti <80447788+the-r3aper7@users.noreply.github.com>
SarthakPaandey <145528240+SarthakPaandey@users.noreply.github.com>
Sarthak Paandey <145528240+SarthakPaandey@users.noreply.github.com>
Saurabh Singh <saurabhsraghuvanshi@gmail.com>
Seyyed Parsa Neshaei <spneshaei@users.noreply.github.com>
Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
Shivam <11shivam00@gmail.com>
Shivam Ahir <11shivam00@gmail.com>
Shraddheya Shendre <shendreshraddheya@gmail.com>
Shubh Mehta <93862397+Shubh942@users.noreply.github.com>
Shubham Mishra <shubh622005@gmail.com>
Expand All @@ -98,7 +105,7 @@ Snehil Shah <snehilshah.989@gmail.com>
Soumajit Chatterjee <121816890+soumajit23@users.noreply.github.com>
Spandan Barve <contact@marsian.dev>
Stephannie Jiménez Gacha <steff456@hotmail.com>
Suraj kumar <125961509+kumarsuraj212003@users.noreply.github.com>
Suraj Kumar <125961509+kumarsuraj212003@users.noreply.github.com>
Tirtadwipa Manunggal <tirtadwipa.manunggal@gmail.com>
Tudor Pagu <104032457+tudor-pagu@users.noreply.github.com>
Tufailahmed Bargir <142114244+Tufailahmed-Bargir@users.noreply.github.com>
Expand All @@ -108,12 +115,10 @@ UtkershBasnet <119008923+UtkershBasnet@users.noreply.github.com>
Vaibhav Patel <98279986+noobCoderVP@users.noreply.github.com>
Varad Gupta <varadgupta21@gmail.com>
Vinit Pandit <106718914+MeastroZI@users.noreply.github.com>
Vivek maurya <155618190+vivekmaurya001@users.noreply.github.com>
Xiaochuan Ye <tap91624@gmail.com>
Yaswanth Kosuru <116426380+yaswanthkosuru@users.noreply.github.com>
Yernar Yergaziyev <yernar.yergaziyev@erg.kz>
naveen <stupiddint@gmail.com>
nishant-s7 <97207366+nishant-s7@users.noreply.github.com>
olenkabilonizhka <62379231+olenkabilonizhka@users.noreply.github.com>
orimiles5 <97595296+orimiles5@users.noreply.github.com>
rainn <88160429+AmCodesLame@users.noreply.github.com>
rei2hu <reimu@reimu.ws>
yaswanth <116426380+yaswanthkosuru@users.noreply.github.com>
95 changes: 95 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,101 @@ for ( i = 0; i < 10; i++ ) {

<!-- /.examples -->

<!-- C interface documentation. -->

* * *

<section class="c">

## C APIs

<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

<section class="intro">

</section>

<!-- /.intro -->

<!-- C usage documentation. -->

<section class="usage">

### Usage

```c
#include "stdlib/stats/base/dists/uniform/entropy.h"
```

#### stdlib_base_dists_uniform_entropy( a, b )

Evaluates the [entropy][entropy] of a [uniform][uniform-distribution] distribution with `a` the minimum support and `b` the maximum support.

```c
double out = stdlib_base_dists_uniform_entropy( 2.0, 8.0 );
// returns ~1.792
```

The function accepts the following arguments:

- **a**: `[in] double` minimum support.
- **b**: `[in] double` maximum support.

```c
double stdlib_base_dists_uniform_entropy( const double a, const double b );
```
</section>
<!-- /.usage -->
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
<section class="notes">
</section>
<!-- /.notes -->
<!-- C API usage examples. -->
<section class="examples">
### Examples
```c
#include "stdlib/stats/base/dists/uniform/entropy.h"
#include <stdlib.h>
#include <stdio.h>
static double random_uniform( const double min, const double max ) {
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
return min + ( v*(max-min) );
}
int main( void ) {
double a;
double b;
double v;
double i;
for ( i = 0; i < 25; i++ ) {
a = random_uniform( 0.0, 10.0 );
b = random_uniform( a, a+10.0 );
v = stdlib_base_dists_uniform_entropy( a, b );
printf( "a: %lf, b: %lf, h(X;a,b): %lf\n", a, b, v );
}
}
```

</section>

<!-- /.examples -->

</section>

<!-- /.c -->

<!-- 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. -->

<section class="references">
Expand Down
14 changes: 11 additions & 3 deletions benchmark/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// MODULES //

var bench = require( '@stdlib/bench-harness' );
var Float64Array = require( '@stdlib/array-float64' );
var randu = require( '@stdlib/random-base-randu' );
var isnan = require( '@stdlib/math-base-assert-is-nan' );
var pkg = require( './../package.json' ).name;
Expand All @@ -32,14 +33,21 @@ var entropy = require( './../lib' );
bench( pkg, function benchmark( b ) {
var min;
var max;
var len;
var y;
var i;

len = 100;
min = new Float64Array( len );
max = new Float64Array( len );
for ( i = 0; i < len; i++ ) {
min[ i ] = ( randu()*10.0 );
max[ i ] = ( randu()*10.0 ) + min[ i ];
}

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
min = ( randu()*10.0 );
max = ( randu()*10.0 ) + min;
y = entropy( min, max );
y = entropy( min[ i % len ], max[ i % len ] );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
Expand Down
70 changes: 70 additions & 0 deletions benchmark/benchmark.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2024 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var resolve = require( 'path' ).resolve;
var bench = require( '@stdlib/bench-harness' );
var Float64Array = require( '@stdlib/array-float64' );
var tryRequire = require( '@stdlib/utils-try-require' );
var randu = require( '@stdlib/random-base-randu' );
var isnan = require( '@stdlib/math-base-assert-is-nan' );
var pkg = require( './../package.json' ).name;


// VARIABLES //

var entropy = tryRequire( resolve( __dirname, './../lib/native.js' ) );
var opts = {
'skip': ( entropy instanceof Error )
};


// MAIN //

bench( pkg+'::native', opts, function benchmark( b ) {
var min;
var max;
var len;
var y;
var i;

len = 100;
min = new Float64Array( len );
max = new Float64Array( len );
for ( i = 0; i < len; i++ ) {
min[ i ] = ( randu()*10.0 );
max[ i ] = ( randu()*10.0 ) + min[ i ];
}

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
y = entropy( min[ i % len ], max[ i % len ] );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});
Loading

0 comments on commit 5641a3f

Please sign in to comment.