Skip to content

Commit 793a5b4

Browse files
fix: changes in example and indetations
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: passed - task: lint_c_benchmarks status: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: passed - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: passed - task: run_c_benchmarks status: passed - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: passed - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
1 parent 6f70f1b commit 793a5b4

File tree

8 files changed

+20
-48
lines changed

8 files changed

+20
-48
lines changed

lib/node_modules/@stdlib/stats/base/dists/geometric/logpmf/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ for ( i = 0; i < 10; i++ ) {
175175

176176
#### stdlib_base_dists_geometric_logpmf( x, p )
177177

178-
Evaluates evaluating the logarithm of the [probability mass function][pmf] (PMF) of a [geometric][geometric-distribution] distribution with success probability `0 <= p <= 1`.
178+
Evaluates the logarithm of the [probability mass function][pmf] (PMF) of the [geometric][geometric-distribution] distribution with success probability `0 <= p <= 1`.
179179

180180
```c
181181
double out = stdlib_base_dists_geometric_logpmf( 4.0, 0.3 );
@@ -212,7 +212,6 @@ double stdlib_base_dists_geometric_logpmf( const double x, const double p );
212212
```c
213213
#include "stdlib/stats/base/dists/geometric/logpmf.h"
214214
#include "stdlib/math/base/special/round.h"
215-
#include "stdlib/constants/float64/eps.h"
216215
#include <stdlib.h>
217216
#include <stdio.h>
218217
#include <math.h>
@@ -230,7 +229,7 @@ int main( void ) {
230229
231230
for ( i = 0; i < 25; i++ ) {
232231
x = stdlib_base_round( random_uniform( 0, 40 ) );
233-
p = random_uniform( 0.0, 1.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
232+
p = random_uniform( 0.0, 1.0 );
234233
y = stdlib_base_dists_geometric_logpmf( x, p );
235234
printf( "x: %lf, p: %lf, ln(P(X=x;p)): %lf\n", x, p, y );
236235
}

lib/node_modules/@stdlib/stats/base/dists/geometric/logpmf/benchmark/benchmark.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ var Float64Array = require( '@stdlib/array/float64' );
2525
var randu = require( '@stdlib/random/base/randu' );
2626
var round = require( '@stdlib/math/base/special/round' );
2727
var isnan = require( '@stdlib/math/base/assert/is-nan' );
28-
var EPS = require( '@stdlib/constants/float64/eps' );
2928
var pkg = require( './../package.json' ).name;
3029
var logpmf = require( './../lib' );
3130

@@ -44,7 +43,7 @@ bench( pkg, function benchmark( b ) {
4443
p = new Float64Array( len );
4544
for ( i = 0; i < len; i++ ) {
4645
x[ i ] = round( randu()*40.0 );
47-
p[ i ] = ( randu()*1.0 ) + EPS;
46+
p[ i ] = ( randu()*1.0 );
4847
}
4948

5049
b.tic();

lib/node_modules/@stdlib/stats/base/dists/geometric/logpmf/benchmark/benchmark.native.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ var Float64Array = require( '@stdlib/array/float64' );
2626
var randu = require( '@stdlib/random/base/randu' );
2727
var round = require( '@stdlib/math/base/special/round' );
2828
var isnan = require( '@stdlib/math/base/assert/is-nan' );
29-
var EPS = require( '@stdlib/constants/float64/eps' );
3029
var tryRequire = require( '@stdlib/utils/try-require' );
3130
var pkg = require( './../package.json' ).name;
3231

@@ -53,7 +52,7 @@ bench( pkg+'::native', opts, function benchmark( b ) {
5352
p = new Float64Array( len );
5453
for ( i = 0; i < len; i++ ) {
5554
x[ i ] = round( randu()*40.0 );
56-
p[ i ] = ( randu()*1.0 ) + EPS;
55+
p[ i ] = ( randu()*1.0 );
5756
}
5857

5958
b.tic();

lib/node_modules/@stdlib/stats/base/dists/geometric/logpmf/benchmark/c/benchmark.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
#include "stdlib/stats/base/dists/geometric/logpmf.h"
2020
#include "stdlib/math/base/special/round.h"
21-
#include "stdlib/constants/float64/eps.h"
2221
#include <stdlib.h>
2322
#include <stdio.h>
2423
#include <math.h>
@@ -103,7 +102,7 @@ static double benchmark( void ) {
103102

104103
for ( i = 0; i < 100; i++ ) {
105104
x[ i ] = stdlib_base_round( random_uniform( 0.0, 40.0 ) );
106-
p[ i ] = random_uniform( 0.0, 1.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
105+
p[ i ] = random_uniform( 0.0, 1.0 );
107106
}
108107

109108
t = tic();

lib/node_modules/@stdlib/stats/base/dists/geometric/logpmf/examples/c/example.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
#include "stdlib/stats/base/dists/geometric/logpmf.h"
2020
#include "stdlib/math/base/special/round.h"
21-
#include "stdlib/constants/float64/eps.h"
2221
#include <stdlib.h>
2322
#include <stdio.h>
2423
#include <math.h>
@@ -36,7 +35,7 @@ int main( void ) {
3635

3736
for ( i = 0; i < 25; i++ ) {
3837
x = stdlib_base_round( random_uniform( 0, 40 ) );
39-
p = random_uniform( 0.0, 1.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
38+
p = random_uniform( 0.0, 1.0 );
4039
y = stdlib_base_dists_geometric_logpmf( x, p );
4140
printf( "x: %lf, p: %lf, ln(P(X=x;p)): %lf\n", x, p, y );
4241
}

lib/node_modules/@stdlib/stats/base/dists/geometric/logpmf/include/stdlib/stats/base/dists/geometric/logpmf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extern "C" {
2727
#endif
2828

2929
/**
30-
* Evaluates the logarithm of the probability mass function (PMF) for the geometric distribution with probability parameter p.
30+
* Evaluates the logarithm of the probability mass function (PMF) for the geometric distribution with success probability `p` at a value `x`.
3131
*/
3232
double stdlib_base_dists_geometric_logpmf( const double x, const double p );
3333

lib/node_modules/@stdlib/stats/base/dists/geometric/logpmf/manifest.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
"@stdlib/math/base/assert/is-nan",
6262
"@stdlib/math/base/special/ln",
6363
"@stdlib/math/base/special/round",
64-
"@stdlib/constants/float64/eps",
6564
"@stdlib/constants/float64/ninf"
6665
]
6766
},
@@ -81,7 +80,6 @@
8180
"@stdlib/math/base/assert/is-nan",
8281
"@stdlib/math/base/special/ln",
8382
"@stdlib/math/base/special/round",
84-
"@stdlib/constants/float64/eps",
8583
"@stdlib/constants/float64/ninf"
8684
]
8785
}

lib/node_modules/@stdlib/stats/base/dists/geometric/logpmf/src/main.c

Lines changed: 13 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -26,46 +26,25 @@
2626
/**
2727
* Evaluates the logarithm of the probability mass function (PMF) for a geometric distribution with success probability `p` at a value `x`.
2828
*
29-
* @param {number} x - input value
30-
* @param {Probability} p - success probability
31-
* @returns {NonPositiveNumber} logarithm of PMF
29+
* @param x input value
30+
* @param p success probability
31+
* @return logarithm of PMF
3232
*
3333
* @example
34-
* var y = logpmf( 4.0, 0.3 );
34+
* double y = stdlib_base_dists_geometric_logpmf( 4.0, 0.3 );
3535
* // returns ~-2.631
36-
*
37-
* @example
38-
* var y = logpmf( 2.0, 0.7 );
39-
* // returns ~-2.765
40-
*
41-
* @example
42-
* var y = logpmf( -1.0, 0.5 );
43-
* // returns -Infinity
44-
*
45-
* @example
46-
* var y = logpmf( 0.0, NaN );
47-
* // returns NaN
48-
*
49-
* @example
50-
* var y = logpmf( NaN, 0.5 );
51-
* // returns NaN
52-
*
53-
* @example
54-
* // Invalid success probability:
55-
* var y = logpmf( 2.0, 1.5 );
56-
* // returns NaN
5736
*/
5837
double stdlib_base_dists_geometric_logpmf( const double x, const double p ) {
59-
if (
60-
stdlib_base_is_nan( x ) ||
61-
stdlib_base_is_nan( p ) ||
62-
p < 0.0 ||
63-
p > 1.0
64-
) {
65-
return 0.0/0.0; // NaN
66-
}
38+
if (
39+
stdlib_base_is_nan( x ) ||
40+
stdlib_base_is_nan( p ) ||
41+
p < 0.0 ||
42+
p > 1.0
43+
) {
44+
return 0.0/0.0; // NaN
45+
}
6746
if( stdlib_base_is_nonnegative_integer( x ) ){
6847
return stdlib_base_ln( p ) + ( x * stdlib_base_ln( 1.0 - p) );
6948
}
70-
return STDLIB_CONSTANT_FLOAT64_NINF;
49+
return STDLIB_CONSTANT_FLOAT64_NINF;
7150
}

0 commit comments

Comments
 (0)