Skip to content

Commit cf4befb

Browse files
committed
Auto-generated commit
1 parent 08a122d commit cf4befb

File tree

18 files changed

+1375
-5
lines changed

18 files changed

+1375
-5
lines changed

CHANGELOG.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,40 @@ This release closes the following issue:
748748

749749
<!-- /.package -->
750750

751+
<section class="package" id="stats-base-dists-f-mean-unreleased">
752+
753+
#### [@stdlib/stats/base/dists/f/mean](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/base/dists/f/mean)
754+
755+
<details>
756+
757+
<section class="features">
758+
759+
##### Features
760+
761+
- [`b283652`](https://github.com/stdlib-js/stdlib/commit/b2836521feb83b741d0190d7600f297f0379851f) - add C implementation for `stats/base/dists/f/mean` [(#4033)](https://github.com/stdlib-js/stdlib/pull/4033)
762+
763+
</section>
764+
765+
<!-- /.features -->
766+
767+
<section class="issues">
768+
769+
##### Closed Issues
770+
771+
This release closes the following issue:
772+
773+
[#3597](https://github.com/stdlib-js/stdlib/issues/3597)
774+
775+
</section>
776+
777+
<!-- /.issues -->
778+
779+
</details>
780+
781+
</section>
782+
783+
<!-- /.package -->
784+
751785
<section class="package" id="stats-base-dists-gumbel-variance-unreleased">
752786

753787
#### [@stdlib/stats/base/dists/gumbel/variance](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/base/dists/gumbel/variance)
@@ -1624,9 +1658,9 @@ A total of 3 issues were closed in this release:
16241658

16251659
### Closed Issues
16261660

1627-
A total of 49 issues were closed in this release:
1661+
A total of 50 issues were closed in this release:
16281662

1629-
[#1619](https://github.com/stdlib-js/stdlib/issues/1619), [#1632](https://github.com/stdlib-js/stdlib/issues/1632), [#1633](https://github.com/stdlib-js/stdlib/issues/1633), [#3236](https://github.com/stdlib-js/stdlib/issues/3236), [#3237](https://github.com/stdlib-js/stdlib/issues/3237), [#3238](https://github.com/stdlib-js/stdlib/issues/3238), [#3378](https://github.com/stdlib-js/stdlib/issues/3378), [#3384](https://github.com/stdlib-js/stdlib/issues/3384), [#3385](https://github.com/stdlib-js/stdlib/issues/3385), [#3401](https://github.com/stdlib-js/stdlib/issues/3401), [#3402](https://github.com/stdlib-js/stdlib/issues/3402), [#3410](https://github.com/stdlib-js/stdlib/issues/3410), [#3414](https://github.com/stdlib-js/stdlib/issues/3414), [#3417](https://github.com/stdlib-js/stdlib/issues/3417), [#3421](https://github.com/stdlib-js/stdlib/issues/3421), [#3431](https://github.com/stdlib-js/stdlib/issues/3431), [#3434](https://github.com/stdlib-js/stdlib/issues/3434), [#3435](https://github.com/stdlib-js/stdlib/issues/3435), [#3436](https://github.com/stdlib-js/stdlib/issues/3436), [#3438](https://github.com/stdlib-js/stdlib/issues/3438), [#3445](https://github.com/stdlib-js/stdlib/issues/3445), [#3446](https://github.com/stdlib-js/stdlib/issues/3446), [#3447](https://github.com/stdlib-js/stdlib/issues/3447), [#3480](https://github.com/stdlib-js/stdlib/issues/3480), [#3494](https://github.com/stdlib-js/stdlib/issues/3494), [#3501](https://github.com/stdlib-js/stdlib/issues/3501), [#3510](https://github.com/stdlib-js/stdlib/issues/3510), [#3656](https://github.com/stdlib-js/stdlib/issues/3656), [#3671](https://github.com/stdlib-js/stdlib/issues/3671), [#3721](https://github.com/stdlib-js/stdlib/issues/3721), [#3746](https://github.com/stdlib-js/stdlib/issues/3746), [#3759](https://github.com/stdlib-js/stdlib/issues/3759), [#3783](https://github.com/stdlib-js/stdlib/issues/3783), [#3789](https://github.com/stdlib-js/stdlib/issues/3789), [#3797](https://github.com/stdlib-js/stdlib/issues/3797), [#3798](https://github.com/stdlib-js/stdlib/issues/3798), [#3799](https://github.com/stdlib-js/stdlib/issues/3799), [#3801](https://github.com/stdlib-js/stdlib/issues/3801), [#3807](https://github.com/stdlib-js/stdlib/issues/3807), [#3811](https://github.com/stdlib-js/stdlib/issues/3811), [#3833](https://github.com/stdlib-js/stdlib/issues/3833), [#3837](https://github.com/stdlib-js/stdlib/issues/3837), [#3865](https://github.com/stdlib-js/stdlib/issues/3865), [#3866](https://github.com/stdlib-js/stdlib/issues/3866), [#3871](https://github.com/stdlib-js/stdlib/issues/3871), [#3873](https://github.com/stdlib-js/stdlib/issues/3873), [#3874](https://github.com/stdlib-js/stdlib/issues/3874), [#3879](https://github.com/stdlib-js/stdlib/issues/3879), [#3880](https://github.com/stdlib-js/stdlib/issues/3880)
1663+
[#1619](https://github.com/stdlib-js/stdlib/issues/1619), [#1632](https://github.com/stdlib-js/stdlib/issues/1632), [#1633](https://github.com/stdlib-js/stdlib/issues/1633), [#3236](https://github.com/stdlib-js/stdlib/issues/3236), [#3237](https://github.com/stdlib-js/stdlib/issues/3237), [#3238](https://github.com/stdlib-js/stdlib/issues/3238), [#3378](https://github.com/stdlib-js/stdlib/issues/3378), [#3384](https://github.com/stdlib-js/stdlib/issues/3384), [#3385](https://github.com/stdlib-js/stdlib/issues/3385), [#3401](https://github.com/stdlib-js/stdlib/issues/3401), [#3402](https://github.com/stdlib-js/stdlib/issues/3402), [#3410](https://github.com/stdlib-js/stdlib/issues/3410), [#3414](https://github.com/stdlib-js/stdlib/issues/3414), [#3417](https://github.com/stdlib-js/stdlib/issues/3417), [#3421](https://github.com/stdlib-js/stdlib/issues/3421), [#3431](https://github.com/stdlib-js/stdlib/issues/3431), [#3434](https://github.com/stdlib-js/stdlib/issues/3434), [#3435](https://github.com/stdlib-js/stdlib/issues/3435), [#3436](https://github.com/stdlib-js/stdlib/issues/3436), [#3438](https://github.com/stdlib-js/stdlib/issues/3438), [#3445](https://github.com/stdlib-js/stdlib/issues/3445), [#3446](https://github.com/stdlib-js/stdlib/issues/3446), [#3447](https://github.com/stdlib-js/stdlib/issues/3447), [#3480](https://github.com/stdlib-js/stdlib/issues/3480), [#3494](https://github.com/stdlib-js/stdlib/issues/3494), [#3501](https://github.com/stdlib-js/stdlib/issues/3501), [#3510](https://github.com/stdlib-js/stdlib/issues/3510), [#3597](https://github.com/stdlib-js/stdlib/issues/3597), [#3656](https://github.com/stdlib-js/stdlib/issues/3656), [#3671](https://github.com/stdlib-js/stdlib/issues/3671), [#3721](https://github.com/stdlib-js/stdlib/issues/3721), [#3746](https://github.com/stdlib-js/stdlib/issues/3746), [#3759](https://github.com/stdlib-js/stdlib/issues/3759), [#3783](https://github.com/stdlib-js/stdlib/issues/3783), [#3789](https://github.com/stdlib-js/stdlib/issues/3789), [#3797](https://github.com/stdlib-js/stdlib/issues/3797), [#3798](https://github.com/stdlib-js/stdlib/issues/3798), [#3799](https://github.com/stdlib-js/stdlib/issues/3799), [#3801](https://github.com/stdlib-js/stdlib/issues/3801), [#3807](https://github.com/stdlib-js/stdlib/issues/3807), [#3811](https://github.com/stdlib-js/stdlib/issues/3811), [#3833](https://github.com/stdlib-js/stdlib/issues/3833), [#3837](https://github.com/stdlib-js/stdlib/issues/3837), [#3865](https://github.com/stdlib-js/stdlib/issues/3865), [#3866](https://github.com/stdlib-js/stdlib/issues/3866), [#3871](https://github.com/stdlib-js/stdlib/issues/3871), [#3873](https://github.com/stdlib-js/stdlib/issues/3873), [#3874](https://github.com/stdlib-js/stdlib/issues/3874), [#3879](https://github.com/stdlib-js/stdlib/issues/3879), [#3880](https://github.com/stdlib-js/stdlib/issues/3880)
16301664

16311665
</section>
16321666

@@ -1664,6 +1698,7 @@ A total of 15 people contributed to this release. Thank you to the following con
16641698

16651699
<details>
16661700

1701+
- [`b283652`](https://github.com/stdlib-js/stdlib/commit/b2836521feb83b741d0190d7600f297f0379851f) - **feat:** add C implementation for `stats/base/dists/f/mean` [(#4033)](https://github.com/stdlib-js/stdlib/pull/4033) _(by Vivek maurya)_
16671702
- [`118284b`](https://github.com/stdlib-js/stdlib/commit/118284b97293f409c1769047675bed85ddf4dd20) - **feat:** add C implementation for `stats/base/dists/chisquare/skewness` [(#4005)](https://github.com/stdlib-js/stdlib/pull/4005) _(by Vivek maurya, Philipp Burckhardt)_
16681703
- [`7a87244`](https://github.com/stdlib-js/stdlib/commit/7a872442e344e03a69d987f0f7b89d1344d5547c) - **feat:** add C implementation for `stats/base/dists/chisquare/entropy` [(#4007)](https://github.com/stdlib-js/stdlib/pull/4007) _(by Vivek maurya, Philipp Burckhardt)_
16691704
- [`7550aab`](https://github.com/stdlib-js/stdlib/commit/7550aabe1fa42666821032ad60b42437ee7e304e) - **feat:** add C implementation for `stats/base/dists/normal/stdev` [(#4003)](https://github.com/stdlib-js/stdlib/pull/4003) _(by Manvith M, Philipp Burckhardt)_

base/dists/f/mean/README.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,102 @@ for ( i = 0; i < 10; i++ ) {
142142

143143
<!-- /.examples -->
144144

145+
<!-- C interface documentation. -->
146+
147+
* * *
148+
149+
<section class="c">
150+
151+
## C APIs
152+
153+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
154+
155+
<section class="intro">
156+
157+
</section>
158+
159+
<!-- /.intro -->
160+
161+
<!-- C usage documentation. -->
162+
163+
<section class="usage">
164+
165+
### Usage
166+
167+
```c
168+
#include "stdlib/stats/base/dists/f/mean.h"
169+
```
170+
171+
#### stdlib_base_dists_f_mean( d1, d2 )
172+
173+
Evaluates the [expected value][expected-value] of a [F][f-distribution] distribution with parameters `d1` (numerator degrees of freedom) and `d2` (denominator degrees of freedom).
174+
175+
```c
176+
double out = stdlib_base_dists_f_mean( 3.0, 5.0 );
177+
// returns ~1.667
178+
```
179+
180+
The function accepts the following arguments:
181+
182+
- **d1**: `[in] double` numerator degrees of freedom.
183+
- **d2**: `[in] double` denominator degrees of freedom.
184+
185+
```c
186+
double stdlib_base_dists_f_mean( const double d1, const double d2 );
187+
```
188+
189+
</section>
190+
191+
<!-- /.usage -->
192+
193+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
194+
195+
<section class="notes">
196+
197+
</section>
198+
199+
<!-- /.notes -->
200+
201+
<!-- C API usage examples. -->
202+
203+
<section class="examples">
204+
205+
### Examples
206+
207+
```c
208+
#include "stdlib/stats/base/dists/f/mean.h"
209+
#include "stdlib/constants/float64/eps.h"
210+
#include <stdlib.h>
211+
#include <stdio.h>
212+
213+
static double random_uniform( const double min, const double max ) {
214+
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
215+
return min + ( v*(max-min) );
216+
}
217+
218+
int main( void ) {
219+
double d1;
220+
double d2;
221+
double y;
222+
int i;
223+
224+
for ( i = 0; i < 25; i++ ) {
225+
d1 = random_uniform( 0.0, 10.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
226+
d2 = random_uniform( 0.0, 10.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
227+
y = stdlib_base_dists_f_mean( d1, d2 );
228+
printf( "d1: %lf, d2: %lf, E(X;d1,d2): %lf\n", d1, d2, y );
229+
}
230+
}
231+
```
232+
233+
</section>
234+
235+
<!-- /.examples -->
236+
237+
</section>
238+
239+
<!-- /.c -->
240+
145241
<!-- 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. -->
146242

147243
<section class="references">

base/dists/f/mean/benchmark/benchmark.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
var bench = require( '@stdlib/bench' );
2424
var randu = require( '@stdlib/random/base/randu' );
2525
var isnan = require( '@stdlib/math/base/assert/is-nan' );
26+
var Float64Array = require( '@stdlib/array/float64' );
2627
var EPS = require( '@stdlib/constants/float64/eps' );
2728
var pkg = require( './../package.json' ).name;
2829
var mean = require( './../lib' );
@@ -31,16 +32,23 @@ var mean = require( './../lib' );
3132
// MAIN //
3233

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

41+
len = 100;
42+
d1 = new Float64Array( len );
43+
d2 = new Float64Array( len );
44+
for ( i = 0; i < len; i++ ) {
45+
d1[ i ] = ( randu() * 10.0 ) + EPS;
46+
d2[ i ] = ( randu() * 10.0 ) + 2.0 + EPS;
47+
}
48+
3949
b.tic();
4050
for ( i = 0; i < b.iterations; i++ ) {
41-
d1 = ( randu()*10.0 ) + EPS;
42-
d2 = ( randu()*10.0 ) + 2.0 + EPS;
43-
y = mean( d1, d2 );
51+
y = mean( d1[ i % len ], d2[ i % len ] );
4452
if ( isnan( y ) ) {
4553
b.fail( 'should not return NaN' );
4654
}
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) 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' );
25+
var EPS = require( '@stdlib/constants/float64/eps' );
26+
var Float64Array = require( '@stdlib/array/float64' );
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 mean = tryRequire( resolve( __dirname, './../lib/native.js' ) );
36+
var opts = {
37+
'skip': ( mean instanceof Error )
38+
};
39+
40+
41+
// MAIN //
42+
43+
bench( pkg+'::native', opts, function benchmark( b ) {
44+
var len;
45+
var d1;
46+
var d2;
47+
var y;
48+
var i;
49+
50+
len = 100;
51+
d1 = new Float64Array( len );
52+
d2 = new Float64Array( len );
53+
for ( i = 0; i < len; i++ ) {
54+
d1[ i ] = ( randu() * 10.0 ) + EPS;
55+
d2[ i ] = ( randu() * 10.0 ) + 2.0 + EPS;
56+
}
57+
58+
b.tic();
59+
for ( i = 0; i < b.iterations; i++ ) {
60+
y = mean( d1[ i % len ], d2[ 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)