diff --git a/lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/quantile/README.md b/lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/quantile/README.md index 70cc0a76d47f..9a3c96526e98 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/quantile/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/quantile/README.md @@ -139,7 +139,7 @@ y = myQuantile( 0.3 ); ```javascript -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var EPS = require( '@stdlib/constants/float64/eps' ); var quantile = require( '@stdlib/stats/base/dists/kumaraswamy/quantile' ); @@ -149,12 +149,13 @@ var p; var y; var i; -for ( i = 0; i < 10; i++ ) { - p = randu(); - a = ( randu()*5.0 ) + EPS; - b = ( randu()*5.0 ) + EPS; - y = quantile( p, a, b ); - console.log( 'p: %d, a: %d, b: %d, Q(p;a,b): %d', p.toFixed( 4 ), a.toFixed( 4 ), b.toFixed( 4 ), y.toFixed( 4 ) ); +p = uniform( 10, 0.0, 1.0 ); +a = uniform( 10, EPS, 5.0 ); +b = uniform( 10, EPS, 5.0 ); + +for ( i = 0; i < p.length; i++ ) { + y = quantile( p[ i ], a[ i ], b[ i ] ); + console.log( 'p: %d, a: %d, b: %d, Q(p;a,b): %d', p[ i ].toFixed( 4 ), a[ i ].toFixed( 4 ), b[ i ].toFixed( 4 ), y.toFixed( 4 ) ); } ``` @@ -162,6 +163,106 @@ for ( i = 0; i < 10; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/stats/base/dists/kumaraswamy/quantile.h" +``` + +#### stdlib_base_dists_kumaraswamy_quantile( p, a, b ) + +Evaluates the quantile function of a Kumaraswamy's double bounded distribution. + +```c +double out = stdlib_base_dists_kumaraswamy_quantile( 0.5, 1.0, 1.0 ); +// returns 0.5 +``` + +The function accepts the following arguments: + +- **p**: `[in] double` probability. +- **a**: `[in] double` first shape parameter. +- **b**: `[in] double` second shape parameter. + +```c +double stdlib_base_dists_kumaraswamy_quantile( const double p, const +double a, const double b ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/stats/base/dists/kumaraswamy/quantile.h" +#include "stdlib/constants/float64/eps.h" +#include +#include + +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 p; + double a; + double b; + double y; + int i; + + for ( i = 0; i < 25; i++ ) { + p = random_uniform( 0.0, 1.0 ); + a = random_uniform( STDLIB_CONSTANT_FLOAT64_EPS, 5.0 ); + b = random_uniform( STDLIB_CONSTANT_FLOAT64_EPS, 5.0 ); + y = stdlib_base_dists_kumaraswamy_quantile( p, a, b ); + printf( "p: %lf, a: %lf, b: %lf, Q(p;a,b): %lf\n", p, a, b, y ); + } +} +``` + +
+ + + +
+ + +