Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,13 @@ for ( i = 0; i < 10; i++ ) {
#include "stdlib/stats/base/dists/gumbel/mgf.h"
```

#### stdlib_base_dists_gumbel_median( t, mu, beta )
#### stdlib_base_dists_gumbel_mgf( t, mu, beta )

Evaluates the [moment-generating function][mgf] (MGF) for a [Gumbel][gumbel-distribution] distribution with parameters `mu` (location parameter) and `beta > 0` (scale parameter).


```c
double out = stdlib_base_dists_gumbel_mgf( -1.0, 0.0, 1.0 );
// returns ~6.0
double out = stdlib_base_dists_gumbel_mgf( -1.0, 0.0, 3.0 );
// returns 6.0
```

The function accepts the following arguments:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ bench( pkg, function benchmark( b ) {
for ( i = 0; i < len; i++ ) {
mu[ i ] = uniform( -50.0, 50.0 );
beta[ i ] = uniform( EPS, 20.0 );
t[ i ] = uniform( 0.0, ( 1.0 / beta[ i ] ) );
t[ i ] = uniform( 0.0, 1.0 / beta[ i ] );
}

b.tic();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ bench( pkg+'::native', opts, function benchmark( b ) {
for ( i = 0; i < len; i++ ) {
mu[ i ] = uniform( -50.0, 50.0 );
beta[ i ] = uniform( EPS, 20.0 );
t[ i ] = uniform( 0.0, ( 1.0 / beta[ i ] ) );
t[ i ] = uniform( 0.0, 1.0 / beta[ i ] );
}

b.tic();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ static double benchmark( void ) {
for ( i = 0; i < 100; i++ ) {
mu[ i ] = random_uniform( -50.0, 50.0 );
beta[ i ] = random_uniform( STDLIB_CONSTANT_FLOAT64_EPS, 20.0 );
_t[ i ] = random_uniform( 1.0 / beta[ i ], 0 );
_t[ i ] = random_uniform( 0.0, 1.0 / beta[ i ] );
}

t = tic();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
#define STDLIB_STATS_BASE_DISTS_GUMBEL_MGF_H

/*
* Evaluates the moment-generating function (MGF) for a Gumbel distribution with location parameter `mu` and scale parameter `b` at a value `t`.
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
*/
#ifdef __cplusplus
extern "C" {
#endif

/**
* Evaluates the cumulative distribution function (MGF) for a Gumbel distribution with location parameter `mu` and scale parameter `beta` at a value `x`.
* Evaluates the moment-generating function (MGF) for a Gumbel distribution with location parameter `mu` and scale parameter `b` at a value `t`.
*/
double stdlib_base_dists_gumbel_mgf( const double t, const double mu, const double beta );

Expand Down