diff --git a/lib/node_modules/@stdlib/stats/base/dists/normal/logpdf/README.md b/lib/node_modules/@stdlib/stats/base/dists/normal/logpdf/README.md index 00a0042004dc..c47f7a227541 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/normal/logpdf/README.md +++ b/lib/node_modules/@stdlib/stats/base/dists/normal/logpdf/README.md @@ -142,6 +142,104 @@ for ( i = 0; i < 10; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/stats/base/dists/normal/logpdf.h" +``` + +#### stdlib_base_dists_normal_logpdf( x, mu, sigma ) + +Evaluates the natural logarithm of the probability density function (logPDF) for a normal distribution. + +```c +double out = stdlib_base_dists_normal_pdf( 2.0, 0.0, 1.0 ); +// returns ~-2.919 +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. +- **mu**: `[in] double` mean. +- **sigma**: `[in] double` standard deviation. + +```c +double stdlib_base_dists_normal_logpdf( cconst double x, const double mu, const double sigma ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/stats/base/dists/normal/logpdf.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 sigma; + double mu; + double x; + double y; + int i; + + for ( i = 0; i < 10; i++ ) { + x = random_uniform( 0.0, 10.0 ); + mu = random_uniform( -5.0, 5.0 ); + sigma = random_uniform( 0.1, 20.0 ); + y = stdlib_base_dists_normal_logpdf( x, mu, sigma ); + printf( "x: %lf, µ: %lf, σ: %lf, ln(f(x;µ,σ)): %lf\n", x, mu, sigma, y ); + } +} +``` + +
+ + + +
+ + +