Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: address commit comment #5731

Merged
merged 13 commits into from
Mar 2, 2025
11 changes: 6 additions & 5 deletions lib/node_modules/@stdlib/stats/base/dists/normal/pdf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,6 @@ for ( i = 0; i < 10; i++ ) {

<!-- /.examples -->

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

<!-- C interface documentation. -->

* * *
Expand Down Expand Up @@ -214,7 +210,6 @@ double stdlib_base_dists_normal_pdf( const double x, const double mu, const doub
#include "stdlib/constants/float64/eps.h"
#include <stdlib.h>
#include <stdio.h>
#include <time.h>

static double random_uniform( const double min, const double max ) {
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
Expand All @@ -240,6 +235,12 @@ int main( void ) {

</section>

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

</section>

<!-- /.references -->

<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var opts = {

// MAIN //

bench( pkg, opts, function benchmark( b ) {
bench( pkg+'::native', opts, function benchmark( b ) {
var sigma;
var len;
var mu;
Expand All @@ -60,7 +60,7 @@ bench( pkg, opts, function benchmark( b ) {

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
y = pdf( x[ i % len ], mu[ i % len ], sigma[ i % len ]);
y = pdf( x[ i % len ], mu[ i % len ], sigma[ i % len ] );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#define NAME "normal-pdf"
#define ITERATIONS 1000000
#define REPEATS 3
#define LEN 100

/**
* Prints the TAP version.
Expand Down Expand Up @@ -94,23 +93,24 @@ static double random_uniform( const double min, const double max ) {
* @return elapsed time in seconds
*/
static double benchmark( void ) {
double sigma[ 100 ];
double mu[ 100 ];
double elapsed;
double x[ LEN ];
double mu[ LEN ];
double sigma[ LEN ];
double y;
double t;
int i;

for ( i = 0; i < LEN; i++ ) {
double x[ 100 ];

for ( i = 0; i < 100; i++ ) {
x[ i ] = random_uniform( -100.0, 100.0 );
mu[ i ] = random_uniform( -50.0, 50.0 );
sigma[ i ] = random_uniform( STDLIB_CONSTANT_FLOAT64_EPS, 20.0 );
}

t = tic();
for ( i = 0; i < ITERATIONS; i++ ) {
y = stdlib_base_dists_normal_pdf( x[ i%LEN ], mu[ i%LEN ], sigma[ i%LEN ] );
y = stdlib_base_dists_normal_pdf( x[ i%100 ], mu[ i%100 ], sigma[ i%100 ] );
if ( y != y ) {
printf( "should not return NaN\n" );
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "stdlib/constants/float64/eps.h"
#include <stdlib.h>
#include <stdio.h>
#include <time.h>

static double random_uniform( const double min, const double max ) {
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
Expand Down