Skip to content

Commit a1d9253

Browse files
committed
refactor: apply suggestions from previous PRs
--- 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: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: missing_dependencies - 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: 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 --- --- 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: 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 eff22cf commit a1d9253

File tree

6 files changed

+13
-9
lines changed

6 files changed

+13
-9
lines changed

lib/node_modules/@stdlib/stats/base/dists/chi/entropy/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ for ( i = 0; i < 10; i++ ) {
144144

145145
#### stdlib_base_dists_chi_entropy( k )
146146

147-
Returns the differential entropy of a chi distribution.
147+
Returns the [differential entropy][entropy] of a [chi][chi-distribution] distribution with degrees of freedom `k` (in [nats][nats]).
148148

149149
```c
150150
double out = stdlib_base_dists_chi_entropy( 9.0 );

lib/node_modules/@stdlib/stats/base/dists/chi/entropy/benchmark/benchmark.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench' );
24-
var randu = require( '@stdlib/random/base/randu' );
24+
var uniform = require( '@stdlib/random/base/uniform' );
2525
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2626
var EPS = require( '@stdlib/constants/float64/eps' );
2727
var pkg = require( './../package.json' ).name;
@@ -37,7 +37,7 @@ bench( pkg, function benchmark( b ) {
3737

3838
b.tic();
3939
for ( i = 0; i < b.iterations; i++ ) {
40-
k = ( randu()*20.0 ) + EPS;
40+
k = uniform( EPS, 20.0 );
4141
y = entropy( k );
4242
if ( isnan( y ) ) {
4343
b.fail( 'should not return NaN' );

lib/node_modules/@stdlib/stats/base/dists/chi/entropy/benchmark/benchmark.native.js

Lines changed: 3 additions & 2 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 EPS = require( '@stdlib/constants/float64/eps' );
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;
@@ -48,7 +49,7 @@ bench( pkg+'::native', opts, function benchmark( b ) {
4849
len = 100;
4950
k = new Float64Array( len );
5051
for ( i = 0; i < len; i++ ) {
51-
k[ i ] = ( randu() * 10.0 ) + 0.1; // Ensure k > 0
52+
k[ i ] = uniform( EPS, 20.0 );
5253
}
5354

5455
b.tic();

lib/node_modules/@stdlib/stats/base/dists/chi/entropy/benchmark/c/benchmark.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818

1919
#include <sys/time.h>
20+
#include "stdlib/constants/float64/eps.h"
2021
#include "stdlib/stats/base/dists/chi/entropy.h"
2122
#include <math.h>
2223
#include <stdio.h>
@@ -68,7 +69,7 @@ static double benchmark( void ) {
6869
int i;
6970

7071
for ( i = 0; i < 100; i++ ) {
71-
k[ i ] = random_uniform( 0.1, 10.0 );
72+
k[ i ] = random_uniform( STDLIB_CONSTANT_FLOAT64_EPS, 10.0 );
7273
}
7374

7475
start = tic();
@@ -91,7 +92,7 @@ int main( void ) {
9192
double elapsed;
9293
int i;
9394

94-
// Seed the random number generator:
95+
// Seed the random number generator:
9596
srand( time( NULL ) );
9697

9798
print_version();

lib/node_modules/@stdlib/stats/base/dists/chi/entropy/manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
"@stdlib/math/base/assert/is-nan",
6161
"@stdlib/math/base/special/digamma",
6262
"@stdlib/math/base/special/gammaln",
63-
"@stdlib/constants/float64/ln-two"
63+
"@stdlib/constants/float64/ln-two",
64+
"@stdlib/constants/float64/eps"
6465
]
6566
},
6667
{

lib/node_modules/@stdlib/stats/base/dists/chi/entropy/src/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@
2020
#include "stdlib/math/base/assert/is_nan.h"
2121
#include "stdlib/math/base/special/digamma.h"
2222
#include "stdlib/math/base/special/gammaln.h"
23+
#include "stdlib/stats/base/dists/chi/entropy.h"
2324

2425
/**
2526
* Returns the differential entropy of a chi distribution.
2627
*
2728
* @param k degrees of freedom (must be positive)
28-
* @return entropy, or NaN if input is invalid
29+
* @return entropy
2930
*
3031
* @example
3132
* double v = stdlib_base_dists_chi_entropy( 9.0 );

0 commit comments

Comments
 (0)