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 21, 2024
1 parent f783a2f commit 644aa21
Show file tree
Hide file tree
Showing 23 changed files with 1,396 additions and 31 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.

4 changes: 2 additions & 2 deletions .github/workflows/test_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

# Run workflow job if `publish` workflow run is successful or when the workflow is manually run:
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
# Run workflow job if `publish` workflow run is successful or when the workflow is manually triggered or on a schedule:
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }}

# Define the sequence of job steps...
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_published_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

# Run workflow job if `publish` workflow run is successful or when the workflow is manually run:
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
# Run workflow job if `publish` workflow run is successful or when the workflow is manually triggered or on a schedule:
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }}

# Define the job's steps:
steps:
Expand Down
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-21)

<section class="features">

### Features

- [`b884459`](https://github.com/stdlib-js/stdlib/commit/b8844596b7f57a356ff38333c0c5da9b63401874) - add C implementation for `stats/base/dists/triangular/mean` [(#4006)](https://github.com/stdlib-js/stdlib/pull/4006)

</section>

<!-- /.features -->

<section class="issues">

### Closed Issues

This release closes the following issue:

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

</section>

<!-- /.issues -->

<section class="commits">

### Commits

<details>

- [`b884459`](https://github.com/stdlib-js/stdlib/commit/b8844596b7f57a356ff38333c0c5da9b63401874) - **feat:** add C implementation for `stats/base/dists/triangular/mean` [(#4006)](https://github.com/stdlib-js/stdlib/pull/4006) _(by Prashant Kumar Yadav, Philipp Burckhardt)_

</details>

</section>

<!-- /.commits -->

<section class="contributors">

### Contributors

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

- Philipp Burckhardt
- Prashant Kumar Yadav

</section>

<!-- /.contributors -->

</section>

<!-- /.release -->

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

## 0.2.2 (2024-07-27)
Expand Down
39 changes: 23 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 <[email protected]>
Aayush Khanna <[email protected]>
Abhijit Raut <[email protected]>
Adarsh Palaskar <[email protected]>
Aditya Sapra <[email protected]>
AgPriyanshu18 <[email protected]>
Ahmed Atwa <[email protected]>
Ahmed Kashkoush <[email protected]>
Ahmed Khaled <[email protected]>
Aleksandr <[email protected]>
Ali Salesi <[email protected]>
Aman Bhansali <[email protected]>
Expand All @@ -23,6 +26,8 @@ Dan Rose <[email protected]>
Daniel Killenberger <[email protected]>
Daniel Yu <[email protected]>
Debashis Maharana <[email protected]>
Desh Deepak Kant <[email protected]>
Divyansh Seth <[email protected]>
Dominic Lim <[email protected]>
Dominik Moritz <[email protected]>
Dorrin Sotoudeh <[email protected]>
Expand All @@ -45,12 +50,12 @@ Jordan Gallivan <[email protected]>
Joris Labie <[email protected]>
Justin Dennison <[email protected]>
Karthik Prakash <[email protected]>
Khaldon <[email protected]>
Kohantika Nath <[email protected]>
Krishnendu Das <[email protected]>
Kshitij-Dale <[email protected]>
Lovelin <[email protected]>
Lovelin Dhoni J B <[email protected]>
Manik Sharma <[email protected]>
Manvith M <[email protected]>
Marcus Fantham <[email protected]>
Matt Cochrane <[email protected]>
Mihir Pandit <[email protected]>
Expand All @@ -59,37 +64,41 @@ Mohammad Kaif <[email protected]>
Momtchil Momtchev <[email protected]>
Muhammad Haris <[email protected]>
Naresh Jagadeesan <[email protected]>
Naveen Kumar <[email protected]>
Neeraj Pathak <[email protected]>
NightKnight <Ahmedatwa866@yahoo.com>
Nishant Shinde <[email protected].com>
Nithin Katta <[email protected]>
Nourhan Hasan <[email protected]>
Ognjen Jevremović <[email protected]>
Oneday12323 <[email protected]>
Ori Miles <[email protected]>
Philipp Burckhardt <[email protected]>
Prajwal Kulkarni <[email protected]>
Pranav Goswami <[email protected]>
Praneki <[email protected]>
Pratik <[email protected]>
Pranjal Jha <[email protected]>
Prashant Kumar Yadav <[email protected]>
Pratik Singh <[email protected]>
Pratyush Kumar Chouhan <[email protected]>
Priyansh <[email protected]>
Priyansh Prajapati <[email protected]>
Priyanshu Agarwal <[email protected]>
Pushpendra Chandravanshi <[email protected]>
RISHAV <[email protected]>
Raunak Kumar Gupta <[email protected]>
Rejoan Sardar <[email protected]>
Ricky Reusser <[email protected]>
Ridam Garg <[email protected]>
Rishav <[email protected]>
Robert Gislason <[email protected]>
Roman Stetsyk <[email protected]>
Rutam <[email protected]>
Rutam Kathale <[email protected]>
Ruthwik Chikoti <[email protected]>
Ryan Seal <[email protected]>
Rylan Yang <[email protected]>
Sai Srikar Dumpeti <[email protected]>
SarthakPaandey <[email protected]>
Sarthak Paandey <[email protected]>
Saurabh Singh <[email protected]>
Seyyed Parsa Neshaei <[email protected]>
Shashank Shekhar Singh <[email protected]>
Shivam <[email protected]>
Shivam Ahir <[email protected]>
Shraddheya Shendre <[email protected]>
Shubh Mehta <[email protected]>
Shubham Mishra <[email protected]>
Expand All @@ -98,7 +107,7 @@ Snehil Shah <[email protected]>
Soumajit Chatterjee <[email protected]>
Spandan Barve <[email protected]>
Stephannie Jiménez Gacha <[email protected]>
Suraj kumar <[email protected]>
Suraj Kumar <[email protected]>
Tirtadwipa Manunggal <[email protected]>
Tudor Pagu <[email protected]>
Tufailahmed Bargir <[email protected]>
Expand All @@ -108,12 +117,10 @@ UtkershBasnet <[email protected]>
Vaibhav Patel <[email protected]>
Varad Gupta <[email protected]>
Vinit Pandit <[email protected]>
Vivek maurya <[email protected]>
Xiaochuan Ye <[email protected]>
Yaswanth Kosuru <[email protected]>
Yernar Yergaziyev <[email protected]>
naveen <[email protected]>
nishant-s7 <[email protected]>
olenkabilonizhka <[email protected]>
orimiles5 <[email protected]>
rainn <[email protected]>
rei2hu <[email protected]>
yaswanth <[email protected]>
94 changes: 94 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,100 @@ 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/triangular/mean.h"
```

#### stdlib_base_dists_triangular_mean( a, b, c )

Returns the [expected value][expected-value] of a [triangular][triangular-distribution] distribution.

```c
double out = stdlib_base_dists_triangular_mean( 0.0, 1.0, 0.5 );
// returns ~0.333
```

The function accepts the following arguments:

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

```c
double stdlib_base_dists_triangular_mean( const double a, const double b, const double c );
```
</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/triangular/mean.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 c;
double y;
int i;
for ( i = 0; i < 25; i++ ) {
a = random_uniform( 0.0, 10.0 );
b = random_uniform( 0.0, 10.0 ) + a;
c = a + (b - a) * random_uniform( 0.0, 1.0 ); // mode between a and b
y = stdlib_base_dists_triangular_mean( a, b, c );
printf( "a: %lf, b: %lf, c: %lf, E(X;a,b,c): %lf\n", a, b, c, y );
}
}
```

</section>

<!-- /.examples -->

<!-- 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
24 changes: 16 additions & 8 deletions benchmark/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,36 @@
// 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 EPS = require( '@stdlib/constants-float64-eps' );
var pkg = require( './../package.json' ).name;
var mean = require( './../lib' );


// MAIN //

bench( pkg, function benchmark( b ) {
var mode;
var min;
var max;
var bnd;
var len;
var a;
var c;
var y;
var i;

len = 100;
a = new Float64Array( len );
bnd = new Float64Array( len );
c = new Float64Array( len );
for ( i = 0; i < len; i++ ) {
a[ i ] = randu() * 20.0;
bnd[ i ] = ( randu() * 20.0 ) + a[ i ];
c[ i ] = ( randu() * ( bnd[i] - a[i] ) ) + a[i];
}

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
min = ( randu()*10.0 );
max = ( randu()*10.0 ) + min + EPS;
mode = ( ( max - min ) * randu() ) + min;
y = mean( min, max, mode );
y = mean( a[i % len], bnd[i % len], c[i % len] );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
Expand Down
Loading

0 comments on commit 644aa21

Please sign in to comment.