Skip to content

Commit 1ac2be7

Browse files
committed
Auto-generated commit
1 parent 157769c commit 1ac2be7

File tree

24 files changed

+1397
-31
lines changed

24 files changed

+1397
-31
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ indent_style = tab
121121
[*.{md,md.txt}]
122122
indent_style = space
123123
indent_size = 4
124-
trim_trailing_whitespace = false
124+
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.
125125
126126
# Set properties for `usage.txt` files:
127127
[usage.txt]

.github/.keepalive

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/test_install.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ jobs:
5050
env:
5151
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
5252

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

5656
# Define the sequence of job steps...
5757
steps:

.github/workflows/test_published_package.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ jobs:
4747
env:
4848
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
4949

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

5353
# Define the job's steps:
5454
steps:

CHANGELOG.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,63 @@
22

33
> Package changelog.
44
5+
<section class="release" id="unreleased">
6+
7+
## Unreleased (2025-01-10)
8+
9+
<section class="features">
10+
11+
### Features
12+
13+
- [`1040b76`](https://github.com/stdlib-js/stdlib/commit/1040b76eca609dd8557525b79be6903dcf8c607d) - add C implementation for `stats/base/dists/triangular/variance` [(#4000)](https://github.com/stdlib-js/stdlib/pull/4000)
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+
[#3824](https://github.com/stdlib-js/stdlib/issues/3824)
26+
27+
</section>
28+
29+
<!-- /.issues -->
30+
31+
<section class="commits">
32+
33+
### Commits
34+
35+
<details>
36+
37+
- [`1040b76`](https://github.com/stdlib-js/stdlib/commit/1040b76eca609dd8557525b79be6903dcf8c607d) - **feat:** add C implementation for `stats/base/dists/triangular/variance` [(#4000)](https://github.com/stdlib-js/stdlib/pull/4000) _(by Prashant Kumar Yadav, Philipp Burckhardt, stdlib-bot)_
38+
39+
</details>
40+
41+
</section>
42+
43+
<!-- /.commits -->
44+
45+
<section class="contributors">
46+
47+
### Contributors
48+
49+
A total of 2 people contributed to this release. Thank you to the following contributors:
50+
51+
- Philipp Burckhardt
52+
- Prashant Kumar Yadav
53+
54+
</section>
55+
56+
<!-- /.contributors -->
57+
58+
</section>
59+
60+
<!-- /.release -->
61+
562
<section class="release" id="v0.2.2">
663

764
## 0.2.2 (2024-07-27)

CONTRIBUTORS

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
#
33
# Contributors listed in alphabetical order.
44

5+
Aadish Jain <jain.aadishj@gmail.com>
56
Aayush Khanna <aayushiitbhu23@gmail.com>
67
Abhijit Raut <abhijitmraut8010@gmail.com>
78
Adarsh Palaskar <adarshpalaskar99@gmail.com>
89
Aditya Sapra <adityaework@gmail.com>
9-
AgPriyanshu18 <113460573+AgPriyanshu18@users.noreply.github.com>
10+
Ahmed Atwa <Ahmedatwa866@yahoo.com>
11+
Ahmed Kashkoush <ahmedkashkoush464@gmail.com>
12+
Ahmed Khaled <kahmd1444@gmail.com>
1013
Aleksandr <112382387+alextes90@users.noreply.github.com>
1114
Ali Salesi <ali_sal1381@yahoo.com>
1215
Aman Bhansali <bhansali.1@iitj.ac.in>
@@ -23,6 +26,9 @@ Dan Rose <danoftheroses@gmail.com>
2326
Daniel Killenberger <daniel.killenberger@gmail.com>
2427
Daniel Yu <40680511+Daniel777y@users.noreply.github.com>
2528
Debashis Maharana <debashismaharana7854@gmail.com>
29+
Desh Deepak Kant <118960904+DeshDeepakKant@users.noreply.github.com>
30+
Dhruv Arvind Singh <154677013+DhruvArvindSingh@users.noreply.github.com>
31+
Divyansh Seth <59174836+sethdivyansh@users.noreply.github.com>
2632
Dominic Lim <46486515+domlimm@users.noreply.github.com>
2733
Dominik Moritz <domoritz@gmail.com>
2834
Dorrin Sotoudeh <dorrinsotoudeh123@gmail.com>
@@ -44,13 +50,14 @@ Joey Reed <joeyrreed@gmail.com>
4450
Jordan Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com>
4551
Joris Labie <joris.labie1@gmail.com>
4652
Justin Dennison <justin1dennison@gmail.com>
53+
Karan Anand <119553199+anandkaranubc@users.noreply.github.com>
4754
Karthik Prakash <116057817+skoriop@users.noreply.github.com>
48-
Khaldon <kahmd1444@gmail.com>
4955
Kohantika Nath <145763549+kohantikanath@users.noreply.github.com>
5056
Krishnendu Das <86651039+itskdhere@users.noreply.github.com>
5157
Kshitij-Dale <152467202+Kshitij-Dale@users.noreply.github.com>
52-
Lovelin <100030865+lovelindhoni@users.noreply.github.com>
58+
Lovelin Dhoni J B <100030865+lovelindhoni@users.noreply.github.com>
5359
Manik Sharma <maniksharma.rke@gmail.com>
60+
Manvith M <148960168+manvith2003@users.noreply.github.com>
5461
Marcus Fantham <mfantham@users.noreply.github.com>
5562
Matt Cochrane <matthew.cochrane.eng@gmail.com>
5663
Mihir Pandit <129577900+MSP20086@users.noreply.github.com>
@@ -59,37 +66,41 @@ Mohammad Kaif <mdkaifprofession@gmail.com>
5966
Momtchil Momtchev <momtchil@momtchev.com>
6067
Muhammad Haris <harriskhan047@outlook.com>
6168
Naresh Jagadeesan <naresh.naresh000@gmail.com>
69+
Naveen Kumar <stupiddint@gmail.com>
6270
Neeraj Pathak <neerajrpathak710@gmail.com>
63-
NightKnight <Ahmedatwa866@yahoo.com>
71+
Nishant Shinde <97207366+nishant-s7@users.noreply.github.com>
6472
Nithin Katta <88046362+nithinkatta@users.noreply.github.com>
6573
Nourhan Hasan <109472010+TheNourhan@users.noreply.github.com>
6674
Ognjen Jevremović <ognjenjevremovic@users.noreply.github.com>
6775
Oneday12323 <107678750+Oneday12323@users.noreply.github.com>
76+
Ori Miles <97595296+orimiles5@users.noreply.github.com>
6877
Philipp Burckhardt <pburckhardt@outlook.com>
6978
Prajwal Kulkarni <prajwalkulkarni76@gmail.com>
7079
Pranav Goswami <goswami.4@iitj.ac.in>
71-
Praneki <97080887+PraneGIT@users.noreply.github.com>
72-
Pratik <97464067+Pratik772846@users.noreply.github.com>
80+
Pranjal Jha <97080887+PraneGIT@users.noreply.github.com>
81+
Prashant Kumar Yadav <144602492+0PrashantYadav0@users.noreply.github.com>
82+
Pratik Singh <97464067+Pratik772846@users.noreply.github.com>
7383
Pratyush Kumar Chouhan <pratyushkumar0308@gmail.com>
74-
Priyansh <88396544+itsspriyansh@users.noreply.github.com>
84+
Priyansh Prajapati <88396544+itsspriyansh@users.noreply.github.com>
85+
Priyanshu Agarwal <113460573+AgPriyanshu18@users.noreply.github.com>
7586
Pushpendra Chandravanshi <pushpendrachandravanshi4@gmail.com>
76-
RISHAV <115060907+rishav2404@users.noreply.github.com>
7787
Raunak Kumar Gupta <raunakmodanwal321@gmail.com>
7888
Rejoan Sardar <119718513+Rejoan-Sardar@users.noreply.github.com>
7989
Ricky Reusser <rsreusser@gmail.com>
8090
Ridam Garg <67867319+RidamGarg@users.noreply.github.com>
91+
Rishav <115060907+rishav2404@users.noreply.github.com>
8192
Robert Gislason <gztown2216@yahoo.com>
8293
Roman Stetsyk <25715951+romanstetsyk@users.noreply.github.com>
83-
Rutam <138517416+performant23@users.noreply.github.com>
94+
Rutam Kathale <138517416+performant23@users.noreply.github.com>
8495
Ruthwik Chikoti <145591715+ruthwikchikoti@users.noreply.github.com>
8596
Ryan Seal <splrk@users.noreply.github.com>
8697
Rylan Yang <137365285+rylany27@users.noreply.github.com>
8798
Sai Srikar Dumpeti <80447788+the-r3aper7@users.noreply.github.com>
88-
SarthakPaandey <145528240+SarthakPaandey@users.noreply.github.com>
99+
Sarthak Paandey <145528240+SarthakPaandey@users.noreply.github.com>
89100
Saurabh Singh <saurabhsraghuvanshi@gmail.com>
90101
Seyyed Parsa Neshaei <spneshaei@users.noreply.github.com>
91102
Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
92-
Shivam <11shivam00@gmail.com>
103+
Shivam Ahir <11shivam00@gmail.com>
93104
Shraddheya Shendre <shendreshraddheya@gmail.com>
94105
Shubh Mehta <93862397+Shubh942@users.noreply.github.com>
95106
Shubham Mishra <shubh622005@gmail.com>
@@ -98,7 +109,7 @@ Snehil Shah <snehilshah.989@gmail.com>
98109
Soumajit Chatterjee <121816890+soumajit23@users.noreply.github.com>
99110
Spandan Barve <contact@marsian.dev>
100111
Stephannie Jiménez Gacha <steff456@hotmail.com>
101-
Suraj kumar <125961509+kumarsuraj212003@users.noreply.github.com>
112+
Suraj Kumar <125961509+kumarsuraj212003@users.noreply.github.com>
102113
Tirtadwipa Manunggal <tirtadwipa.manunggal@gmail.com>
103114
Tudor Pagu <104032457+tudor-pagu@users.noreply.github.com>
104115
Tufailahmed Bargir <142114244+Tufailahmed-Bargir@users.noreply.github.com>
@@ -108,12 +119,10 @@ UtkershBasnet <119008923+UtkershBasnet@users.noreply.github.com>
108119
Vaibhav Patel <98279986+noobCoderVP@users.noreply.github.com>
109120
Varad Gupta <varadgupta21@gmail.com>
110121
Vinit Pandit <106718914+MeastroZI@users.noreply.github.com>
122+
Vivek Maurya <vm8118134@gmail.com>
111123
Xiaochuan Ye <tap91624@gmail.com>
124+
Yaswanth Kosuru <116426380+yaswanthkosuru@users.noreply.github.com>
112125
Yernar Yergaziyev <yernar.yergaziyev@erg.kz>
113-
naveen <stupiddint@gmail.com>
114-
nishant-s7 <97207366+nishant-s7@users.noreply.github.com>
115126
olenkabilonizhka <62379231+olenkabilonizhka@users.noreply.github.com>
116-
orimiles5 <97595296+orimiles5@users.noreply.github.com>
117127
rainn <88160429+AmCodesLame@users.noreply.github.com>
118128
rei2hu <reimu@reimu.ws>
119-
yaswanth <116426380+yaswanthkosuru@users.noreply.github.com>

NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Copyright (c) 2016-2024 The Stdlib Authors.
1+
Copyright (c) 2016-2025 The Stdlib Authors.

README.md

Lines changed: 100 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ var variance = require( '@stdlib/stats-base-dists-triangular-variance' );
9292

9393
#### variance( a, b, c )
9494

95-
Returns the [variance][variance] of a [triangular][triangular-distribution] distribution with minimum support `a`, maximum support`b`, and mode `c`.
95+
Returns the [variance][variance] of a [triangular][triangular-distribution] distribution with minimum support `a`, maximum support `b`, and mode `c`.
9696

9797
```javascript
9898
var v = variance( 0.0, 1.0, 0.8 );
@@ -174,6 +174,104 @@ for ( i = 0; i < 10; i++ ) {
174174

175175
<!-- /.examples -->
176176

177+
<!-- C interface documentation. -->
178+
179+
* * *
180+
181+
<section class="c">
182+
183+
## C APIs
184+
185+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
186+
187+
<section class="intro">
188+
189+
</section>
190+
191+
<!-- /.intro -->
192+
193+
<!-- C usage documentation. -->
194+
195+
<section class="usage">
196+
197+
### Usage
198+
199+
```c
200+
#include "stdlib/stats/base/dists/triangular/variance.h"
201+
```
202+
203+
#### stdlib_base_dists_triangular_variance( a, b, c )
204+
205+
Returns the [variance][variance] of a [triangular][triangular-distribution] distribution with minimum support `a`, maximum support `b`, and mode `c`.
206+
207+
```c
208+
double out = stdlib_base_dists_triangular_variance( 0.0, 1.0, 0.5 );
209+
// returns ~0.056
210+
```
211+
212+
The function accepts the following arguments:
213+
214+
- **a**: `[in] double` minimum support.
215+
- **b**: `[in] double` maximum support.
216+
- **c**: `[in] double` mode.
217+
218+
```c
219+
double stdlib_base_dists_triangular_variance( const double a, const double b, const double c );
220+
```
221+
222+
</section>
223+
224+
<!-- /.usage -->
225+
226+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
227+
228+
<section class="notes">
229+
230+
</section>
231+
232+
<!-- /.notes -->
233+
234+
<!-- C API usage examples. -->
235+
236+
<section class="examples">
237+
238+
### Examples
239+
240+
```c
241+
#include "stdlib/stats/base/dists/triangular/variance.h"
242+
#include <stdlib.h>
243+
#include <stdio.h>
244+
245+
static double random_uniform( const double min, const double max ) {
246+
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
247+
return min + ( v*(max-min) );
248+
}
249+
250+
int main( void ) {
251+
double a;
252+
double b;
253+
double c;
254+
double y;
255+
int i;
256+
257+
for ( i = 0; i < 25; i++ ) {
258+
a = random_uniform( 0.0, 10.0 );
259+
b = random_uniform( 0.0, 10.0 ) + a;
260+
c = a + (b - a) * random_uniform( 0.0, 1.0 );
261+
y = stdlib_base_dists_triangular_variance( a, b, c );
262+
printf( "a: %lf, b: %lf, c: %lf, Var(X;a,b,c): %lf\n", a, b, c, y );
263+
}
264+
}
265+
```
266+
267+
</section>
268+
269+
<!-- /.examples -->
270+
271+
</section>
272+
273+
<!-- /.c -->
274+
177275
<!-- 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. -->
178276

179277
<section class="references">
@@ -216,7 +314,7 @@ See [LICENSE][stdlib-license].
216314

217315
## Copyright
218316

219-
Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
317+
Copyright &copy; 2016-2025. The Stdlib [Authors][stdlib-authors].
220318

221319
</section>
222320

benchmark/benchmark.js

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

2323
var bench = require( '@stdlib/bench-harness' );
24+
var Float64Array = require( '@stdlib/array-float64' );
2425
var randu = require( '@stdlib/random-base-randu' );
2526
var isnan = require( '@stdlib/math-base-assert-is-nan' );
26-
var EPS = require( '@stdlib/constants-float64-eps' );
2727
var pkg = require( './../package.json' ).name;
2828
var variance = require( './../lib' );
2929

@@ -34,15 +34,23 @@ bench( pkg, function benchmark( b ) {
3434
var mode;
3535
var min;
3636
var max;
37+
var len;
3738
var y;
3839
var i;
3940

41+
len = 100;
42+
min = new Float64Array( len );
43+
max = new Float64Array( len );
44+
mode = new Float64Array( len );
45+
for ( i = 0; i < len; i++ ) {
46+
min[ i ] = ( randu() * 10.0 );
47+
max[ i ] = ( randu() * 10.0 ) + min[ i ];
48+
mode[ i ] = min[ i ] + ( randu() * ( max[ i ] - min[ i ] ) );
49+
}
50+
4051
b.tic();
4152
for ( i = 0; i < b.iterations; i++ ) {
42-
min = ( randu()*10.0 );
43-
max = ( randu()*10.0 ) + min + EPS;
44-
mode = ( ( max - min ) * randu() ) + min;
45-
y = variance( min, max, mode );
53+
y = variance( min[ i % len ], max[ i % len ], mode[ i % len ] );
4654
if ( isnan( y ) ) {
4755
b.fail( 'should not return NaN' );
4856
}

0 commit comments

Comments
 (0)