Skip to content

Commit

Permalink
chore: stuff from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Neerajpathak07 committed Feb 6, 2025
1 parent 03568bc commit 04d772f
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ Evaluates the probability mass function (PMF) for a Bernoulli distribution with

```c
double y = stdlib_base_dists_bernoulli_pmf( 0.5, 0.5 );
// returns ~0.5
// returns 0.5
```

The function accepts the following arguments:
Expand Down Expand Up @@ -216,7 +216,7 @@ int main( void ) {
x = stdlib_base_round( random_uniform( 0.0, 2.0 ) );
p = random_uniform( 0.0, 1.0 );
y = stdlib_base_dists_bernoulli_pmf( x, p );
printf( "x: %lf , p: %1f, P( X = x; p ): %lf\n", x, p, y );
printf( "x: %lf. p: %1f. P( X = x; p ): %lf\n", x, p, y );
}
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,9 @@ bench( pkg, function benchmark( b ) {

len = 100;
x = new Float64Array( len );
for ( i = 0; i < len; i++ ) {
x[ i ] = round( uniform( 0.0, 3.0 ) );
}
p = new Float64Array( len );
for ( i = 0; i < len; i++ ) {
x[ i ] = round( uniform( 0.0, 3.0 ) );
p[ i ] = uniform( 0.0, 1.0 );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,9 @@ bench( pkg+'::native', opts, function benchmark( b ) {

len = 100;
x = new Float64Array( len );
for ( i = 0; i < len; i++ ) {
x[ i ] = round( uniform( 0.0, 3.0 ) );
}
p = new Float64Array( len );
for ( i = 0; i < len; i++ ) {
x[ i ] = round( uniform( 0.0, 3.0 ) );
p[ i ] = uniform( 0.0, 1.0 );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ static double benchmark( void ) {

for ( i = 0; i < 100; i++ ) {
x[ i ] = stdlib_base_round( random_uniform( 0.0, 3.0 ) );
}
for ( i = 0; i < 100; i++ ) {
p[ i ] = random_uniform( 0.0, 1.0 );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ int main( void ) {
x = stdlib_base_round( random_uniform( 0.0, 2.0 ) );
p = random_uniform( 0.0, 1.0 );
y = stdlib_base_dists_bernoulli_pmf( x, p );
printf( "x: %lf , p: %1f, P( X = x; p ): %lf\n", x, p, y );
printf( "x: %lf. p: %1f. P( X = x; p ): %lf\n", x, p, y );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
*
* @param x input value
* @param p success probability
* @returns evaluated PMF
* @return evaluated PMF
*
* @example
* double y = stdlib_base_dists_bernoulli_pmf( 0.5, 0.5 );
* // returns ~0.5
* // returns 0.5
*/
double stdlib_base_dists_bernoulli_pmf( const double x, const double p ) {
if (
Expand Down

0 comments on commit 04d772f

Please sign in to comment.