Skip to content

Commit 200340c

Browse files
committed
Auto-generated commit
1 parent 89f5952 commit 200340c

24 files changed

+1507
-19
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: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,51 @@
22

33
> Package changelog.
44
5+
<section class="release" id="unreleased">
6+
7+
## Unreleased (2024-12-29)
8+
9+
<section class="features">
10+
11+
### Features
12+
13+
- [`f9f468e`](https://github.com/stdlib-js/stdlib/commit/f9f468e240d7e5b5d155279e4386b8b606cd8227) - add C implementation of `stats/base/dists/weibull/cdf`
14+
15+
</section>
16+
17+
<!-- /.features -->
18+
19+
<section class="commits">
20+
21+
### Commits
22+
23+
<details>
24+
25+
- [`f9f468e`](https://github.com/stdlib-js/stdlib/commit/f9f468e240d7e5b5d155279e4386b8b606cd8227) - **feat:** add C implementation of `stats/base/dists/weibull/cdf` _(by Vinit Pandit, Philipp Burckhardt)_
26+
27+
</details>
28+
29+
</section>
30+
31+
<!-- /.commits -->
32+
33+
<section class="contributors">
34+
35+
### Contributors
36+
37+
A total of 2 people contributed to this release. Thank you to the following contributors:
38+
39+
- Philipp Burckhardt
40+
- Vinit Pandit
41+
42+
</section>
43+
44+
<!-- /.contributors -->
45+
46+
</section>
47+
48+
<!-- /.release -->
49+
550
<section class="release" id="v0.2.2">
651

752
## 0.2.2 (2024-07-28)

CONTRIBUTORS

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +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>
910
Ahmed Atwa <Ahmedatwa866@yahoo.com>
1011
Ahmed Kashkoush <ahmedkashkoush464@gmail.com>
12+
Ahmed Khaled <kahmd1444@gmail.com>
1113
Aleksandr <112382387+alextes90@users.noreply.github.com>
1214
Ali Salesi <ali_sal1381@yahoo.com>
1315
Aman Bhansali <bhansali.1@iitj.ac.in>
@@ -24,6 +26,8 @@ Dan Rose <danoftheroses@gmail.com>
2426
Daniel Killenberger <daniel.killenberger@gmail.com>
2527
Daniel Yu <40680511+Daniel777y@users.noreply.github.com>
2628
Debashis Maharana <debashismaharana7854@gmail.com>
29+
Desh Deepak Kant <118960904+DeshDeepakKant@users.noreply.github.com>
30+
Divyansh Seth <59174836+sethdivyansh@users.noreply.github.com>
2731
Dominic Lim <46486515+domlimm@users.noreply.github.com>
2832
Dominik Moritz <domoritz@gmail.com>
2933
Dorrin Sotoudeh <dorrinsotoudeh123@gmail.com>
@@ -46,11 +50,10 @@ Jordan Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com>
4650
Joris Labie <joris.labie1@gmail.com>
4751
Justin Dennison <justin1dennison@gmail.com>
4852
Karthik Prakash <116057817+skoriop@users.noreply.github.com>
49-
Khaldon <kahmd1444@gmail.com>
5053
Kohantika Nath <145763549+kohantikanath@users.noreply.github.com>
5154
Krishnendu Das <86651039+itskdhere@users.noreply.github.com>
5255
Kshitij-Dale <152467202+Kshitij-Dale@users.noreply.github.com>
53-
Lovelin <100030865+lovelindhoni@users.noreply.github.com>
56+
Lovelin Dhoni J B <100030865+lovelindhoni@users.noreply.github.com>
5457
Manik Sharma <maniksharma.rke@gmail.com>
5558
Manvith M <148960168+manvith2003@users.noreply.github.com>
5659
Marcus Fantham <mfantham@users.noreply.github.com>
@@ -61,6 +64,7 @@ Mohammad Kaif <mdkaifprofession@gmail.com>
6164
Momtchil Momtchev <momtchil@momtchev.com>
6265
Muhammad Haris <harriskhan047@outlook.com>
6366
Naresh Jagadeesan <naresh.naresh000@gmail.com>
67+
Naveen Kumar <stupiddint@gmail.com>
6468
Neeraj Pathak <neerajrpathak710@gmail.com>
6569
Nishant Shinde <97207366+nishant-s7@users.noreply.github.com>
6670
Nithin Katta <88046362+nithinkatta@users.noreply.github.com>
@@ -71,10 +75,11 @@ Ori Miles <97595296+orimiles5@users.noreply.github.com>
7175
Philipp Burckhardt <pburckhardt@outlook.com>
7276
Prajwal Kulkarni <prajwalkulkarni76@gmail.com>
7377
Pranav Goswami <goswami.4@iitj.ac.in>
74-
Praneki <97080887+PraneGIT@users.noreply.github.com>
75-
Pratik <97464067+Pratik772846@users.noreply.github.com>
78+
Pranjal Jha <97080887+PraneGIT@users.noreply.github.com>
79+
Prashant Kumar Yadav <144602492+0PrashantYadav0@users.noreply.github.com>
80+
Pratik Singh <97464067+Pratik772846@users.noreply.github.com>
7681
Pratyush Kumar Chouhan <pratyushkumar0308@gmail.com>
77-
Priyansh <88396544+itsspriyansh@users.noreply.github.com>
82+
Priyansh Prajapati <88396544+itsspriyansh@users.noreply.github.com>
7883
Priyanshu Agarwal <113460573+AgPriyanshu18@users.noreply.github.com>
7984
Pushpendra Chandravanshi <pushpendrachandravanshi4@gmail.com>
8085
Raunak Kumar Gupta <raunakmodanwal321@gmail.com>
@@ -93,7 +98,7 @@ Sarthak Paandey <145528240+SarthakPaandey@users.noreply.github.com>
9398
Saurabh Singh <saurabhsraghuvanshi@gmail.com>
9499
Seyyed Parsa Neshaei <spneshaei@users.noreply.github.com>
95100
Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
96-
Shivam <11shivam00@gmail.com>
101+
Shivam Ahir <11shivam00@gmail.com>
97102
Shraddheya Shendre <shendreshraddheya@gmail.com>
98103
Shubh Mehta <93862397+Shubh942@users.noreply.github.com>
99104
Shubham Mishra <shubh622005@gmail.com>
@@ -112,10 +117,10 @@ UtkershBasnet <119008923+UtkershBasnet@users.noreply.github.com>
112117
Vaibhav Patel <98279986+noobCoderVP@users.noreply.github.com>
113118
Varad Gupta <varadgupta21@gmail.com>
114119
Vinit Pandit <106718914+MeastroZI@users.noreply.github.com>
120+
Vivek maurya <155618190+vivekmaurya001@users.noreply.github.com>
115121
Xiaochuan Ye <tap91624@gmail.com>
116122
Yaswanth Kosuru <116426380+yaswanthkosuru@users.noreply.github.com>
117123
Yernar Yergaziyev <yernar.yergaziyev@erg.kz>
118-
naveen <stupiddint@gmail.com>
119124
olenkabilonizhka <62379231+olenkabilonizhka@users.noreply.github.com>
120125
rainn <88160429+AmCodesLame@users.noreply.github.com>
121126
rei2hu <reimu@reimu.ws>

README.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,104 @@ for ( i = 0; i < 10; i++ ) {
184184

185185
<!-- /.examples -->
186186

187+
<!-- C interface documentation. -->
188+
189+
* * *
190+
191+
<section class="c">
192+
193+
## C APIs
194+
195+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
196+
197+
<section class="intro">
198+
199+
</section>
200+
201+
<!-- /.intro -->
202+
203+
<!-- C usage documentation. -->
204+
205+
<section class="usage">
206+
207+
### Usage
208+
209+
```c
210+
#include "stdlib/stats/base/dists/weibull/cdf.h"
211+
```
212+
213+
#### stdlib_base_dists_weibull_cdf( x, k, lambda )
214+
215+
Evaluates the [cumulative distribution function][cdf] (CDF) for a [Weibull][weibull-distribution] distribution with [shape parameter][shape] `k` and [scale parameter][scale] `lambda`.
216+
217+
```c
218+
double out = stdlib_base_dists_weibull_cdf( 2.0, 1.0, 1.0 );
219+
// returns ~0.865
220+
```
221+
222+
The function accepts the following arguments:
223+
224+
- **x**: `[in] double` input value.
225+
- **k**: `[in] double` scale parameter.
226+
- **lambda**: `[in] double` shape parameter.
227+
228+
```c
229+
double stdlib_base_dists_weibull_cdf( const double x, const double k, const double lambda );
230+
```
231+
232+
</section>
233+
234+
<!-- /.usage -->
235+
236+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
237+
238+
<section class="notes">
239+
240+
</section>
241+
242+
<!-- /.notes -->
243+
244+
<!-- C API usage examples. -->
245+
246+
<section class="examples">
247+
248+
### Examples
249+
250+
```c
251+
#include "stdlib/stats/base/dists/weibull/cdf.h"
252+
#include <stdlib.h>
253+
#include <stdio.h>
254+
255+
static double random_uniform( const double min, const double max ) {
256+
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
257+
return min + ( v*(max-min) );
258+
}
259+
260+
int main( void ) {
261+
double lambda;
262+
double x;
263+
double k;
264+
double y;
265+
int i;
266+
267+
for ( i = 0; i < 25; i++ ) {
268+
x = random_uniform( 0.0, 10.0 );
269+
lambda = random_uniform( 0.0, 10.0 );
270+
k = random_uniform( 0.0, 10.0 );
271+
y = stdlib_base_dists_weibull_cdf( x, k, lambda );
272+
printf( "x: %lf, k: %lf, λ: %lf, F(x;k,λ): %lf\n", x, k, lambda, y );
273+
}
274+
}
275+
```
276+
277+
</section>
278+
279+
<!-- /.examples -->
280+
281+
</section>
282+
283+
<!-- /.c -->
284+
187285
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
188286

189287
<section class="related">

benchmark/benchmark.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
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' );
2627
var EPS = require( '@stdlib/constants-float64-eps' );
@@ -32,17 +33,25 @@ var cdf = require( './../lib' );
3233

3334
bench( pkg, function benchmark( b ) {
3435
var lambda;
36+
var len;
3537
var k;
3638
var x;
3739
var y;
3840
var i;
3941

42+
len = 100;
43+
x = new Float64Array( len );
44+
lambda = new Float64Array( len );
45+
k = new Float64Array( len );
46+
for ( i = 0; i < len; i++ ) {
47+
x[ i ] = ( randu()*100.0 ) + EPS;
48+
lambda[ i ] = ( randu()*100.0 ) + EPS;
49+
k[ i ] = ( randu()*100.0 ) + EPS;
50+
}
51+
4052
b.tic();
4153
for ( i = 0; i < b.iterations; i++ ) {
42-
x = ( randu()*100.0 ) + EPS;
43-
lambda = ( randu()*100.0 ) + EPS;
44-
k = ( randu()*100.0 ) + EPS;
45-
y = cdf( x, k, lambda );
54+
y = cdf( x[ i % len ], k[ i % len ], lambda[ i % len ] );
4655
if ( isnan( y ) ) {
4756
b.fail( 'should not return NaN' );
4857
}

benchmark/benchmark.native.js

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

0 commit comments

Comments
 (0)