Skip to content

Commit 992111c

Browse files
committed
Auto-generated commit
1 parent b05b440 commit 992111c

File tree

21 files changed

+1348
-10
lines changed

21 files changed

+1348
-10
lines changed

.editorconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ indent_style = tab
8686
[*.{f,f.txt}]
8787
indent_style = space
8888
indent_size = 2
89-
insert_final_newline = false
9089

9190
# Set properties for shell files:
9291
[*.{sh,sh.txt}]

CHANGELOG.md

Lines changed: 26 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 (2024-12-24)
7+
## Unreleased (2025-01-19)
8+
9+
<section class="features">
10+
11+
### Features
12+
13+
- [`03954e1`](https://github.com/stdlib-js/stdlib/commit/03954e125b6cc761a5456e51c909ab09b18d15ee) - add C implementation for `stats/base/dists/logistic/stdev` [(#4189)](https://github.com/stdlib-js/stdlib/pull/4189)
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+
[#3745](https://github.com/stdlib-js/stdlib/issues/3745)
26+
27+
</section>
28+
29+
<!-- /.issues -->
830

931
<section class="commits">
1032

1133
### Commits
1234

1335
<details>
1436

37+
- [`03954e1`](https://github.com/stdlib-js/stdlib/commit/03954e125b6cc761a5456e51c909ab09b18d15ee) - **feat:** add C implementation for `stats/base/dists/logistic/stdev` [(#4189)](https://github.com/stdlib-js/stdlib/pull/4189) _(by Vivek Maurya, Philipp Burckhardt, stdlib-bot)_
1538
- [`4a70790`](https://github.com/stdlib-js/stdlib/commit/4a707903dfef7c2b56216000165706497d19a251) - **style:** add missing spaces _(by Philipp Burckhardt)_
1639

1740
</details>
@@ -24,9 +47,10 @@
2447

2548
### Contributors
2649

27-
A total of 1 person contributed to this release. Thank you to this contributor:
50+
A total of 2 people contributed to this release. Thank you to the following contributors:
2851

2952
- Philipp Burckhardt
53+
- Vivek Maurya
3054

3155
</section>
3256

CONTRIBUTORS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ Daniel Killenberger <[email protected]>
2727
Daniel Yu <[email protected]>
2828
Debashis Maharana <[email protected]>
2929
Desh Deepak Kant <[email protected]>
30+
31+
Dhruv Arvind Singh <[email protected]>
3032
Divyansh Seth <[email protected]>
3133
Dominic Lim <[email protected]>
3234
Dominik Moritz <[email protected]>
@@ -49,6 +51,7 @@ Joey Reed <[email protected]>
4951
Jordan Gallivan <[email protected]>
5052
Joris Labie <[email protected]>
5153
Justin Dennison <[email protected]>
54+
Karan Anand <[email protected]>
5255
Karthik Prakash <[email protected]>
5356
Kohantika Nath <[email protected]>
5457
Krishnendu Das <[email protected]>
@@ -117,7 +120,7 @@ UtkershBasnet <[email protected]>
117120
Vaibhav Patel <[email protected]>
118121
Varad Gupta <[email protected]>
119122
Vinit Pandit <[email protected]>
120-
Vivek maurya <[email protected].com>
123+
Vivek Maurya <vm8118134@gmail.com>
121124
Xiaochuan Ye <[email protected]>
122125
Yaswanth Kosuru <[email protected]>
123126
Yernar Yergaziyev <[email protected]>

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: 96 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,101 @@ for ( i = 0; i < 10; i++ ) {
164164

165165
<!-- /.examples -->
166166

167+
<!-- C interface documentation. -->
168+
169+
* * *
170+
171+
<section class="c">
172+
173+
## C APIs
174+
175+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
176+
177+
<section class="intro">
178+
179+
</section>
180+
181+
<!-- /.intro -->
182+
183+
<!-- C usage documentation. -->
184+
185+
<section class="usage">
186+
187+
### Usage
188+
189+
```c
190+
#include "stdlib/stats/base/dists/logistic/stdev.h"
191+
```
192+
193+
#### stdlib_base_dists_logistic_stdev( mu, s )
194+
195+
Returns the [standard deviation][standard-deviation] for a [logistic][logistic-distribution] distribution with location parameter `mu` and scale parameter `s`.
196+
197+
```c
198+
double out = stdlib_base_dists_logistic_stdev( 0.0, 1.0 );
199+
// returns ~1.814
200+
```
201+
202+
The function accepts the following arguments:
203+
204+
- **mu**: `[in] double` location parameter.
205+
- **s**: `[in] double` scale parameter.
206+
207+
```c
208+
double stdlib_base_dists_logistic_stdev( const double mu, const double s );
209+
```
210+
211+
</section>
212+
213+
<!-- /.usage -->
214+
215+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
216+
217+
<section class="notes">
218+
219+
</section>
220+
221+
<!-- /.notes -->
222+
223+
<!-- C API usage examples. -->
224+
225+
<section class="examples">
226+
227+
### Examples
228+
229+
```c
230+
#include "stdlib/stats/base/dists/logistic/stdev.h"
231+
#include <stdlib.h>
232+
#include <stdio.h>
233+
234+
static double random_uniform( const double min, const double max ) {
235+
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
236+
return min + ( v*(max-min) );
237+
}
238+
239+
int main( void ) {
240+
double mu;
241+
double s;
242+
double y;
243+
int i;
244+
245+
for ( i = 0; i < 25; i++ ) {
246+
mu = random_uniform( -5.0, 5.0 );
247+
s = random_uniform( 0.0, 20.0 );
248+
y = stdlib_base_dists_logistic_stdev( mu, s );
249+
printf( "µ: %lf, s: %lf, SD(X;µ,s): %lf\n", mu, s, y );
250+
}
251+
}
252+
```
253+
254+
</section>
255+
256+
<!-- /.examples -->
257+
258+
</section>
259+
260+
<!-- /.c -->
261+
167262
<!-- 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. -->
168263

169264
<section class="references">
@@ -206,7 +301,7 @@ See [LICENSE][stdlib-license].
206301

207302
## Copyright
208303

209-
Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
304+
Copyright &copy; 2016-2025. The Stdlib [Authors][stdlib-authors].
210305

211306
</section>
212307

benchmark/benchmark.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
var bench = require( '@stdlib/bench-harness' );
2424
var randu = require( '@stdlib/random-base-randu' );
25+
var Float64Array = require( '@stdlib/array-float64' );
2526
var isnan = require( '@stdlib/math-base-assert-is-nan' );
2627
var EPS = require( '@stdlib/constants-float64-eps' );
2728
var pkg = require( './../package.json' ).name;
@@ -31,16 +32,23 @@ var stdev = require( './../lib' );
3132
// MAIN //
3233

3334
bench( pkg, function benchmark( b ) {
35+
var len;
3436
var mu;
3537
var s;
3638
var y;
3739
var i;
3840

41+
len = 100;
42+
mu = new Float64Array( len );
43+
s = new Float64Array( len );
44+
for ( i = 0; i < len; i++ ) {
45+
mu[ i ] = ( randu()*100.0 ) - 50.0;
46+
s[ i ] = ( randu()*20.0 ) + EPS;
47+
}
48+
3949
b.tic();
4050
for ( i = 0; i < b.iterations; i++ ) {
41-
mu = ( randu()*100.0 ) - 50.0;
42-
s = ( randu()*20.0 ) + EPS;
43-
y = stdev( mu, s );
51+
y = stdev( mu[ i % len ], s[ i % len ] );
4452
if ( isnan( y ) ) {
4553
b.fail( 'should not return NaN' );
4654
}

benchmark/benchmark.native.js

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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 Float64Array = require( '@stdlib/array-float64' );
26+
var randu = require( '@stdlib/random-base-randu' );
27+
var EPS = require( '@stdlib/constants-float64-eps' );
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 stdev = tryRequire( resolve( __dirname, './../lib/native.js' ) );
36+
var opts = {
37+
'skip': ( stdev instanceof Error )
38+
};
39+
40+
41+
// MAIN //
42+
43+
bench( pkg+'::native', opts, function benchmark( b ) {
44+
var len;
45+
var mu;
46+
var s;
47+
var y;
48+
var i;
49+
50+
len = 100;
51+
mu = new Float64Array( len );
52+
s = new Float64Array( len );
53+
for ( i = 0; i < len; i++ ) {
54+
mu[ i ] = ( randu()*100.0 ) - 50.0;
55+
s[ i ] = ( randu()*20.0 ) + EPS;
56+
}
57+
58+
b.tic();
59+
for ( i = 0; i < b.iterations; i++ ) {
60+
y = stdev( mu[ i % len ], s[ i % len ] );
61+
if ( isnan( y ) ) {
62+
b.fail( 'should not return NaN' );
63+
}
64+
}
65+
b.toc();
66+
if ( isnan( y ) ) {
67+
b.fail( 'should not return NaN' );
68+
}
69+
b.pass( 'benchmark finished' );
70+
b.end();
71+
});

0 commit comments

Comments
 (0)