Skip to content

Commit 4952762

Browse files
committed
Auto-generated commit
1 parent 52c2706 commit 4952762

File tree

18 files changed

+1286
-6
lines changed

18 files changed

+1286
-6
lines changed

CHANGELOG.md

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,40 @@ This release closes the following issue:
626626

627627
<!-- /.package -->
628628

629+
<section class="package" id="stats-base-dists-t-mean-unreleased">
630+
631+
#### [@stdlib/stats/base/dists/t/mean](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/base/dists/t/mean)
632+
633+
<details>
634+
635+
<section class="features">
636+
637+
##### Features
638+
639+
- [`03494c2`](https://github.com/stdlib-js/stdlib/commit/03494c2d20c88a2ab68fdd9fbf79c396e1885440) - add C implementation for `stats/base/dists/t/mean` [(#3922)](https://github.com/stdlib-js/stdlib/pull/3922)
640+
641+
</section>
642+
643+
<!-- /.features -->
644+
645+
<section class="issues">
646+
647+
##### Closed Issues
648+
649+
This release closes the following issue:
650+
651+
[#3874](https://github.com/stdlib-js/stdlib/issues/3874)
652+
653+
</section>
654+
655+
<!-- /.issues -->
656+
657+
</details>
658+
659+
</section>
660+
661+
<!-- /.package -->
662+
629663
<section class="package" id="stats-base-dists-t-skewness-unreleased">
630664

631665
#### [@stdlib/stats/base/dists/t/skewness](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/base/dists/t/skewness)
@@ -774,9 +808,9 @@ A total of 3 issues were closed in this release:
774808

775809
### Closed Issues
776810

777-
A total of 24 issues were closed in this release:
811+
A total of 25 issues were closed in this release:
778812

779-
[#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), [#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), [#3434](https://github.com/stdlib-js/stdlib/issues/3434), [#3435](https://github.com/stdlib-js/stdlib/issues/3435), [#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), [#3671](https://github.com/stdlib-js/stdlib/issues/3671), [#3865](https://github.com/stdlib-js/stdlib/issues/3865), [#3879](https://github.com/stdlib-js/stdlib/issues/3879), [#3880](https://github.com/stdlib-js/stdlib/issues/3880)
813+
[#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), [#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), [#3434](https://github.com/stdlib-js/stdlib/issues/3434), [#3435](https://github.com/stdlib-js/stdlib/issues/3435), [#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), [#3671](https://github.com/stdlib-js/stdlib/issues/3671), [#3865](https://github.com/stdlib-js/stdlib/issues/3865), [#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)
780814

781815
</section>
782816

@@ -786,8 +820,9 @@ A total of 24 issues were closed in this release:
786820

787821
### Contributors
788822

789-
A total of 11 people contributed to this release. Thank you to the following contributors:
823+
A total of 12 people contributed to this release. Thank you to the following contributors:
790824

825+
- Aadish Jain
791826
- Aayush Khanna
792827
- Athan Reines
793828
- Gururaj Gurram
@@ -810,6 +845,7 @@ A total of 11 people contributed to this release. Thank you to the following con
810845

811846
<details>
812847

848+
- [`03494c2`](https://github.com/stdlib-js/stdlib/commit/03494c2d20c88a2ab68fdd9fbf79c396e1885440) - **feat:** add C implementation for `stats/base/dists/t/mean` [(#3922)](https://github.com/stdlib-js/stdlib/pull/3922) _(by Aadish Jain, Philipp Burckhardt)_
813849
- [`a146971`](https://github.com/stdlib-js/stdlib/commit/a1469718890f5a007c6c7343757b621274dad0e0) - **feat:** add C implementation for `stats/base/dists/pareto-type1/skewness` [(#3927)](https://github.com/stdlib-js/stdlib/pull/3927) _(by Gururaj Gurram, Philipp Burckhardt)_
814850
- [`9d7f4db`](https://github.com/stdlib-js/stdlib/commit/9d7f4dbd6c71a2a57b2e55a88e5b7ded091cbd67) - **feat:** add C implementation for `stats/base/dists/beta/skewness` [(#3921)](https://github.com/stdlib-js/stdlib/pull/3921) _(by Vivek maurya, Philipp Burckhardt)_
815851
- [`94aa4aa`](https://github.com/stdlib-js/stdlib/commit/94aa4aafa4f6e98f8e51285daa212e1402254b10) - **feat:** add C implementation for `stats/base/dists/t/stdev` [(#3923)](https://github.com/stdlib-js/stdlib/pull/3923) _(by Aayush Khanna, stdlib-bot)_

base/dists/t/mean/README.md

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

120120
<!-- /.examples -->
121121

122+
<!-- C interface documentation. -->
123+
124+
* * *
125+
126+
<section class="c">
127+
128+
## C APIs
129+
130+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
131+
132+
<section class="intro">
133+
134+
</section>
135+
136+
<!-- /.intro -->
137+
138+
<!-- C usage documentation. -->
139+
140+
<section class="usage">
141+
142+
### Usage
143+
144+
```c
145+
#include "stdlib/stats/base/dists/t/mean.h"
146+
```
147+
148+
#### stdlib_base_dists_t_mean( v )
149+
150+
Returns the [expected value][expected-value] of a [Student's t][t-distribution] distribution with degrees of freedom `v`.
151+
152+
```c
153+
double out = stdlib_base_dists_t_mean( 10.0 );
154+
// returns 0.0
155+
```
156+
157+
The function accepts the following arguments:
158+
159+
- **v**: `[in] double` degrees of freedom.
160+
161+
```c
162+
double stdlib_base_dists_t_mean( const double v );
163+
```
164+
165+
</section>
166+
167+
<!-- /.usage -->
168+
169+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
170+
171+
<section class="notes">
172+
173+
</section>
174+
175+
<!-- /.notes -->
176+
177+
<!-- C API usage examples. -->
178+
179+
<section class="examples">
180+
181+
### Examples
182+
183+
```c
184+
#include "stdlib/stats/base/dists/t/mean.h"
185+
#include <stdlib.h>
186+
#include <stdio.h>
187+
188+
static double random_uniform( const double min, const double max ) {
189+
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
190+
return min + ( v*(max-min) );
191+
}
192+
193+
int main( void ) {
194+
double v;
195+
double y;
196+
int i;
197+
198+
for ( i = 0; i < 25; i++ ) {
199+
v = random_uniform( 1.0, 100.0 );
200+
y = stdlib_base_dists_t_mean( v );
201+
printf( "v: %lf, mean: %lf\n", v, y );
202+
}
203+
}
204+
```
205+
206+
</section>
207+
208+
<!-- /.examples -->
209+
210+
</section>
211+
212+
<!-- /.c -->
213+
122214
<!-- 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. -->
123215

124216
<section class="references">

base/dists/t/mean/benchmark/benchmark.js

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

2323
var bench = require( '@stdlib/bench' );
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 mean = require( './../lib' );
2929

3030

3131
// MAIN //
3232

3333
bench( pkg, function benchmark( b ) {
34+
var len;
3435
var v;
3536
var y;
3637
var i;
3738

39+
len = 100;
40+
v = new Float64Array( len );
41+
for ( i = 0; i < len; i++ ) {
42+
v[ i ] = ( randu() * 100.0 ) + 1.0; // degrees of freedom > 1
43+
}
44+
3845
b.tic();
3946
for ( i = 0; i < b.iterations; i++ ) {
40-
v = ( randu()*20.0 ) + 1.0 + EPS;
41-
y = mean( v );
47+
y = mean( v[ i % len ] );
4248
if ( isnan( y ) ) {
4349
b.fail( 'should not return NaN' );
4450
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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 Float64Array = require( '@stdlib/array/float64' );
26+
var randu = require( '@stdlib/random/base/randu' );
27+
var isnan = require( '@stdlib/math/base/assert/is-nan' );
28+
var tryRequire = require( '@stdlib/utils/try-require' );
29+
var pkg = require( './../../../../../base/dists/t/mean/package.json' ).name;
30+
31+
32+
// VARIABLES //
33+
34+
var mean = tryRequire( resolve( __dirname, './../lib/native.js' ) );
35+
var opts = {
36+
'skip': ( mean instanceof Error )
37+
};
38+
39+
40+
// MAIN //
41+
42+
bench( pkg + '::native', opts, function benchmark( b ) {
43+
var len;
44+
var v;
45+
var y;
46+
var i;
47+
48+
len = 100;
49+
v = new Float64Array( len );
50+
for ( i = 0; i < len; i++ ) {
51+
v[ i ] = ( randu() * 100.0 ) + 1.0; // degrees of freedom > 1
52+
}
53+
54+
b.tic();
55+
for ( i = 0; i < b.iterations; i++ ) {
56+
y = mean( v[ i % len ] );
57+
if ( isnan( y ) ) {
58+
b.fail( 'should not return NaN' );
59+
}
60+
}
61+
b.toc();
62+
if ( isnan( y ) ) {
63+
b.fail( 'should not return NaN' );
64+
}
65+
b.pass( 'benchmark finished' );
66+
b.end();
67+
});

0 commit comments

Comments
 (0)