Skip to content

Commit a416e9d

Browse files
committed
chore: clean-up
Ref: 306a302 --- 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: passed - 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: na - 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 ---
1 parent 07bc501 commit a416e9d

File tree

5 files changed

+14
-41
lines changed

5 files changed

+14
-41
lines changed

lib/node_modules/@stdlib/stats/base/dists/bradford/pdf/benchmark/benchmark.native.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222

2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench' );
25-
var Float64Array = require( '@stdlib/array/float64' );
26-
var uniform = require( '@stdlib/random/base/uniform' );
25+
var uniform = require( '@stdlib/random/array/uniform' );
2726
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2827
var tryRequire = require( '@stdlib/utils/try-require' );
2928
var pkg = require( './../package.json' ).name;
@@ -40,23 +39,21 @@ var opts = {
4039
// MAIN //
4140

4241
bench( pkg+'::native', opts, function benchmark( b ) {
43-
var len;
42+
var opts;
4443
var x;
4544
var c;
4645
var y;
4746
var i;
4847

49-
len = 100;
50-
x = new Float64Array( len );
51-
c = new Float64Array( len );
52-
for ( i = 0; i < len; i++ ) {
53-
x[ i ] = uniform( 0.0, 1.0 );
54-
c[ i ] = uniform( 0.1, 10.0 );
55-
}
48+
opts = {
49+
'dtype': 'float64'
50+
};
51+
x = uniform( 100, 0.0, 1.0, opts );
52+
c = uniform( 100, 0.1, 10.0, opts );
5653

5754
b.tic();
5855
for ( i = 0; i < b.iterations; i++ ) {
59-
y = pdf( x[ i % len ], c[ i % len ] );
56+
y = pdf( x[ i % x.length ], c[ i % c.length ] );
6057
if ( isnan( y ) ) {
6158
b.fail( 'should not return NaN' );
6259
}

lib/node_modules/@stdlib/stats/base/dists/bradford/pdf/benchmark/c/benchmark.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,10 @@ static double benchmark( void ) {
100100
double y;
101101
int i;
102102

103-
// Generate test data:
104103
for ( i = 0; i < 100; i++ ) {
105104
x[ i ] = random_uniform( 0.0, 1.0 );
106105
c[ i ] = random_uniform( STDLIB_CONSTANT_FLOAT64_EPS, 10.0 );
107106
}
108-
109-
// Run the benchmark:
110107
t = tic();
111108
for ( i = 0; i < ITERATIONS; i++ ) {
112109
y = stdlib_base_dists_bradford_pdf( x[ i % 100 ], c[ i % 100 ] );
@@ -127,21 +124,17 @@ static double benchmark( void ) {
127124
*/
128125
int main( void ) {
129126
double elapsed;
130-
int count;
131127
int i;
132128

133129
// Use the current time to seed the pseudorandom number generator:
134130
srand( time( NULL ) );
135131

136132
print_version();
137-
count = 0;
138133
for ( i = 0; i < REPEATS; i++ ) {
139-
count += 1;
140134
printf( "# c::%s\n", NAME );
141135
elapsed = benchmark();
142-
printf( "ok %d benchmark finished\n", count );
143136
print_results( elapsed );
144-
printf( "\n" );
137+
printf( "ok %d benchmark finished\n", i+1 );
145138
}
146-
print_summary( count, count );
139+
print_summary( REPEATS, REPEATS );
147140
}

lib/node_modules/@stdlib/stats/base/dists/bradford/pdf/lib/factory.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ var log1p = require( '@stdlib/math/base/special/log1p' );
4343
*/
4444
function factory( c ) {
4545
var k;
46-
if (
47-
isnan( c ) ||
48-
c <= 0.0
49-
) {
46+
if ( isnan( c ) || c <= 0.0 ) {
5047
return constantFunction( NaN );
5148
}
5249
k = log1p( c );
@@ -64,13 +61,10 @@ function factory( c ) {
6461
* // returns <number>
6562
*/
6663
function pdf( x ) {
67-
if (
68-
isnan( x )
69-
) {
64+
if ( isnan( x ) ) {
7065
return NaN;
7166
}
7267
if ( x < 0.0 || x > 1.0 ) {
73-
// Support of the Bradford distribution: [0,1]
7468
return 0.0;
7569
}
7670
return c / ( ( 1.0 + ( c*x ) ) * k );

lib/node_modules/@stdlib/stats/base/dists/bradford/pdf/lib/main.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,10 @@ var log1p = require( '@stdlib/math/base/special/log1p' );
7171
*/
7272
function pdf( x, c ) {
7373
var k;
74-
if (
75-
isnan( c ) ||
76-
isnan( x ) ||
77-
c <= 0.0
78-
) {
74+
if ( isnan( c ) || isnan( x ) || c <= 0.0 ) {
7975
return NaN;
8076
}
8177
if ( x < 0.0 || x > 1.0 ) {
82-
// Support of the Bradford distribution: [0,1]
8378
return 0.0;
8479
}
8580
k = log1p( c );

lib/node_modules/@stdlib/stats/base/dists/bradford/pdf/src/main.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,10 @@
3333
*/
3434
double stdlib_base_dists_bradford_pdf( const double x, const double c ) {
3535
double k;
36-
37-
if (
38-
stdlib_base_is_nan( x ) ||
39-
stdlib_base_is_nan( c ) ||
40-
c <= 0.0
41-
) {
36+
if ( stdlib_base_is_nan( x ) || stdlib_base_is_nan( c ) || c <= 0.0 ) {
4237
return 0.0/0.0; // NaN
4338
}
4439
if ( x < 0.0 || x > 1.0 ) {
45-
// Support of the Bradford distribution: [0,1]
4640
return 0.0;
4741
}
4842
k = stdlib_base_log1p( c );

0 commit comments

Comments
 (0)