Skip to content

Commit 3f9a125

Browse files
committed
refactor: added include in main.c and fixed the JS benchmark number generation
--- 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: na - 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: missing_dependencies - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - 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: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - 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 b14a0fe commit 3f9a125

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
var bench = require( '@stdlib/bench' );
2424
var ceil = require( '@stdlib/math/base/special/ceil' );
2525
var randu = require( '@stdlib/random/base/randu' );
26+
var uniform = require( '@stdlib/random/base/uniform' );
2627
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2728
var pkg = require( './../package.json' ).name;
2829
var logpmf = require( './../lib' );
@@ -38,8 +39,8 @@ bench( pkg, function benchmark( b ) {
3839

3940
b.tic();
4041
for ( i = 0; i < b.iterations; i++ ) {
41-
x = ceil( ( randu()*100.0 ) - 100.0 );
42-
mu = ( randu()*100.0 ) - 50.0;
42+
x = ceil( uniform( -100.0, 0.0 ) );
43+
mu = uniform( -50.0, 50.0 );
4344
y = logpmf( x, mu );
4445
if ( isnan( y ) ) {
4546
b.fail( 'should not return NaN' );

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench' );
2525
var Float64Array = require( '@stdlib/array/float64' );
26-
var randu = require( '@stdlib/random/base/randu' );
26+
var uniform = require( '@stdlib/random/base/uniform' );
27+
var ceil = require( '@stdlib/math/base/special/ceil' );
2728
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2829
var tryRequire = require( '@stdlib/utils/try-require' );
2930
var pkg = require( './../package.json' ).name;
@@ -50,8 +51,8 @@ bench( pkg+'::native', opts, function benchmark( b ) {
5051
x = new Float64Array( len );
5152
mu = new Float64Array( len );
5253
for ( i = 0; i < len; i++ ) {
53-
x[ i ] = ( randu() * 20.0 ) - 10.0;
54-
mu[ i ] = ( randu() * 40.0 ) - 20.0;
54+
x[ i ] = ceil( uniform( -100.0, 0.0 ) );
55+
mu[ i ] = uniform( -50.0, 50.0 );
5556
}
5657

5758
b.tic();

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

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

1919
#include "stdlib/constants/float64/ninf.h"
2020
#include "stdlib/math/base/assert/is_nan.h"
21+
#include "stdlib/stats/base/dists/degenerate/logpmf.h"
2122

2223
/**
2324
* Evaluates the natural logarithm of the probability mass function (PMF) for a degenerate distribution centered at `mu`.

0 commit comments

Comments
 (0)