Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Feb 9, 2025
1 parent f408029 commit 9a5e0ec
Show file tree
Hide file tree
Showing 21 changed files with 1,345 additions and 6 deletions.
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ indent_style = tab
[*.{f,f.txt}]
indent_style = space
indent_size = 2
insert_final_newline = false

# Set properties for shell files:
[*.{sh,sh.txt}]
Expand Down
1 change: 0 additions & 1 deletion .github/.keepalive

This file was deleted.

57 changes: 57 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,63 @@

> Package changelog.
<section class="release" id="unreleased">

## Unreleased (2025-02-09)

<section class="features">

### Features

- [`0806d8d`](https://github.com/stdlib-js/stdlib/commit/0806d8dd46ea52f7e95c12b1add6b3e01745711b) - add C implementation for `stats/base/dists/uniform/kurtosis` [(#4132)](https://github.com/stdlib-js/stdlib/pull/4132)

</section>

<!-- /.features -->

<section class="issues">

### Closed Issues

This release closes the following issue:

[#3827](https://github.com/stdlib-js/stdlib/issues/3827)

</section>

<!-- /.issues -->

<section class="commits">

### Commits

<details>

- [`0806d8d`](https://github.com/stdlib-js/stdlib/commit/0806d8dd46ea52f7e95c12b1add6b3e01745711b) - **feat:** add C implementation for `stats/base/dists/uniform/kurtosis` [(#4132)](https://github.com/stdlib-js/stdlib/pull/4132) _(by Prashant Kumar Yadav, Philipp Burckhardt, stdlib-bot)_

</details>

</section>

<!-- /.commits -->

<section class="contributors">

### Contributors

A total of 2 people contributed to this release. Thank you to the following contributors:

- Philipp Burckhardt
- Prashant Kumar Yadav

</section>

<!-- /.contributors -->

</section>

<!-- /.release -->

<section class="release" id="v0.2.2">

## 0.2.2 (2024-07-27)
Expand Down
3 changes: 3 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Daniel Killenberger <daniel.killenberger@gmail.com>
Daniel Yu <40680511+Daniel777y@users.noreply.github.com>
Debashis Maharana <debashismaharana7854@gmail.com>
Desh Deepak Kant <118960904+DeshDeepakKant@users.noreply.github.com>
Dev Goel <135586571+corsairier@users.noreply.github.com>
Dhruv Arvind Singh <154677013+DhruvArvindSingh@users.noreply.github.com>
Divyansh Seth <59174836+sethdivyansh@users.noreply.github.com>
Dominic Lim <46486515+domlimm@users.noreply.github.com>
Expand Down Expand Up @@ -62,6 +63,7 @@ Marcus Fantham <mfantham@users.noreply.github.com>
Matt Cochrane <matthew.cochrane.eng@gmail.com>
Mihir Pandit <129577900+MSP20086@users.noreply.github.com>
Milan Raj <rajsite@users.noreply.github.com>
Mohammad Bin Aftab <48010758+MohammadBinAftab@users.noreply.github.com>
Mohammad Kaif <mdkaifprofession@gmail.com>
Momtchil Momtchev <momtchil@momtchev.com>
Muhammad Haris <harriskhan047@outlook.com>
Expand Down Expand Up @@ -124,5 +126,6 @@ Xiaochuan Ye <tap91624@gmail.com>
Yaswanth Kosuru <116426380+yaswanthkosuru@users.noreply.github.com>
Yernar Yergaziyev <yernar.yergaziyev@erg.kz>
olenkabilonizhka <62379231+olenkabilonizhka@users.noreply.github.com>
pranav-1720 <123018993+pranav-1720@users.noreply.github.com>
rainn <88160429+AmCodesLame@users.noreply.github.com>
rei2hu <reimu@reimu.ws>
95 changes: 95 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,101 @@ for ( i = 0; i < 10; i++ ) {

<!-- /.examples -->

<!-- C interface documentation. -->

* * *

<section class="c">

## C APIs

<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

<section class="intro">

</section>

<!-- /.intro -->

<!-- C usage documentation. -->

<section class="usage">

### Usage

```c
#include "stdlib/stats/base/dists/uniform/kurtosis.h"
```

#### stdlib_base_dists_uniform_kurtosis( a, b )

Returns the [excess kurtosis][kurtosis] of a [uniform][uniform-distribution] distribution with parameters `a` (minimum support) and `b` (maximum support).

```c
double out = stdlib_base_dists_uniform_kurtosis( 2.0, 8.0 );
// returns -1.2
```

The function accepts the following arguments:

- **a**: `[in] double` minimum support.
- **b**: `[in] double` maximum support.

```c
double stdlib_base_dists_uniform_kurtosis( const double a, const double b );
```
</section>
<!-- /.usage -->
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
<section class="notes">
</section>
<!-- /.notes -->
<!-- C API usage examples. -->
<section class="examples">
### Examples
```c
#include "stdlib/stats/base/dists/uniform/kurtosis.h"
#include <stdlib.h>
#include <stdio.h>
static double random_uniform( const double min, const double max ) {
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
return min + ( v*(max-min) );
}
int main( void ) {
double a;
double b;
double v;
double i;
for ( i = 0; i < 25; i++ ) {
a = random_uniform( 0.0, 10.0 );
b = random_uniform( a, a+10.0 );
v = stdlib_base_dists_uniform_kurtosis( a, b );
printf( "a: %lf, b: %lf, h(X;a,b): %lf\n", a, b, v );
}
}
```

</section>

<!-- /.examples -->

</section>

<!-- /.c -->

<!-- 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. -->

<section class="references">
Expand Down
14 changes: 11 additions & 3 deletions benchmark/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// MODULES //

var bench = require( '@stdlib/bench-harness' );
var Float64Array = require( '@stdlib/array-float64' );
var randu = require( '@stdlib/random-base-randu' );
var isnan = require( '@stdlib/math-base-assert-is-nan' );
var pkg = require( './../package.json' ).name;
Expand All @@ -30,16 +31,23 @@ var kurtosis = require( './../lib' );
// MAIN //

bench( pkg, function benchmark( b ) {
var len;
var min;
var max;
var y;
var i;

len = 100;
min = new Float64Array( len );
max = new Float64Array( len );
for ( i = 0; i < len; i++ ) {
min[ i ] = ( randu()*10.0 );
max[ i ] = ( randu()*10.0 ) + min[ i ];
}

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
min = ( randu()*10.0 );
max = ( randu()*10.0 ) + min;
y = kurtosis( min, max );
y = kurtosis( min[ i % len ], max[ i % len ] );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
Expand Down
70 changes: 70 additions & 0 deletions benchmark/benchmark.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2025 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var resolve = require( 'path' ).resolve;
var bench = require( '@stdlib/bench-harness' );
var Float64Array = require( '@stdlib/array-float64' );
var tryRequire = require( '@stdlib/utils-try-require' );
var randu = require( '@stdlib/random-base-randu' );
var isnan = require( '@stdlib/math-base-assert-is-nan' );
var pkg = require( './../package.json' ).name;


// VARIABLES //

var kurtosis = tryRequire( resolve( __dirname, './../lib/native.js' ) );
var opts = {
'skip': ( kurtosis instanceof Error )
};


// MAIN //

bench( pkg+'::native', opts, function benchmark( b ) {
var min;
var max;
var len;
var y;
var i;

len = 100;
min = new Float64Array( len );
max = new Float64Array( len );
for ( i = 0; i < len; i++ ) {
min[ i ] = ( randu()*10.0 );
max[ i ] = ( randu()*10.0 ) + min[ i ];
}

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
y = kurtosis( min[ i % len ], max[ i % len ] );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});
Loading

0 comments on commit 9a5e0ec

Please sign in to comment.