Skip to content

Commit 2923d16

Browse files
committed
chore: clean-up
Ref: e3541f0 --- 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: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - 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: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent cd645cc commit 2923d16

File tree

9 files changed

+44
-57
lines changed

9 files changed

+44
-57
lines changed

lib/node_modules/@stdlib/stats/base/dists/bradford/cdf/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,11 @@ y = cdf( 0.5, -5.0 );
9999
Returns a function for evaluating the [CDF][cdf] of a [Bradford][bradford-distribution] distribution with shape parameter `c`.
100100

101101
```javascript
102-
var myPDF = cdf.factory( 5.0 );
103-
var y = myPDF( 0.5 );
102+
var myCDF = cdf.factory( 5.0 );
103+
var y = myCDF( 0.5 );
104104
// returns ~0.699
105105

106-
y = myPDF( 1.0 );
106+
y = myCDF( 1.0 );
107107
// returns 1.0
108108
```
109109

lib/node_modules/@stdlib/stats/base/dists/bradford/cdf/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 = cdf( x[ i % len ], c[ i % len ] );
56+
y = cdf( 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/cdf/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_cdf( 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/cdf/docs/repl.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545

4646

4747
{{alias}}.factory( c )
48-
Returns a function for evaluating the cumulative distribution function
49-
(CDF) of a Bradford distribution with shape parameter `c`.
48+
Returns a function for evaluating the cumulative distribution function (CDF)
49+
of a Bradford distribution with shape parameter `c`.
5050

5151
Parameters
5252
----------

lib/node_modules/@stdlib/stats/base/dists/bradford/cdf/docs/types/index.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ interface CDF {
8787
* @returns CDF
8888
*
8989
* @example
90-
* var mypdf = cdf.factory( 5.0 );
91-
* var y = mypdf( 0.5 );
90+
* var mycdf = cdf.factory( 5.0 );
91+
* var y = mycdf( 0.5 );
9292
* // returns ~0.699
9393
*
94-
* y = mypdf( 1.0 );
94+
* y = mycdf( 1.0 );
9595
* // returns 1.0
9696
*/
9797
factory( c: number ): Unary;

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,7 @@ var log1p = require( '@stdlib/math/base/special/log1p' );
4242
* // returns 1.0
4343
*/
4444
function factory( c ) {
45-
if (
46-
isnan( c ) ||
47-
c <= 0.0
48-
) {
45+
if ( isnan( c ) || c <= 0.0 ) {
4946
return constantFunction( NaN );
5047
}
5148
return cdf;
@@ -62,9 +59,7 @@ function factory( c ) {
6259
* // returns <number>
6360
*/
6461
function cdf( x ) {
65-
if (
66-
isnan( x )
67-
) {
62+
if ( isnan( x ) ) {
6863
return NaN;
6964
}
7065
if ( x <= 0.0 ) {

lib/node_modules/@stdlib/stats/base/dists/bradford/cdf/lib/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
* var y = cdf( 0.5, 5.0 );
3030
* // returns ~0.699
3131
*
32-
* var myPDF = cdf.factory( 5.0 );
33-
* y = myPDF( 0.5 );
32+
* var myCDF = cdf.factory( 5.0 );
33+
* y = myCDF( 0.5 );
3434
* // returns ~0.699
3535
*
36-
* y = myPDF( 1.0 );
36+
* y = myCDF( 1.0 );
3737
* // returns 1.0
3838
*/
3939

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,7 @@ var log1p = require( '@stdlib/math/base/special/log1p' );
7070
* // returns NaN
7171
*/
7272
function cdf( x, c ) {
73-
if (
74-
isnan( c ) ||
75-
isnan( x ) ||
76-
c <= 0.0
77-
) {
73+
if ( isnan( c ) || isnan( x ) || c <= 0.0 ) {
7874
return NaN;
7975
}
8076
if ( x <= 0.0 ) {

lib/node_modules/@stdlib/stats/base/dists/bradford/cdf/test/test.native.js

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,32 +80,38 @@ tape( 'if provided `c <= 0`, the function returns `NaN`', opts, function test( t
8080
t.end();
8181
});
8282

83-
tape( 'if provided `x <= 0` and a valid `c`, the function returns `0`', opts, function test( t ) {
83+
tape( 'if provided a number greater than or equal to one for `x` and a finite `c`, the function returns `1`', opts, function test( t ) {
8484
var y;
8585

86-
y = cdf( 0.0, 1.0 );
87-
t.equal( y, 0.0, 'returns expected value' );
86+
y = cdf( PINF, 0.5 );
87+
t.equal( y, 1.0, 'returns expected value' );
8888

89-
y = cdf( -0.5, 1.0 );
90-
t.equal( y, 0.0, 'returns expected value' );
89+
y = cdf( 100.0, 0.5 );
90+
t.equal( y, 1.0, 'returns expected value' );
9191

92-
y = cdf( NINF, 1.0 );
93-
t.equal( y, 0.0, 'returns expected value' );
92+
y = cdf( 10.0, 0.5 );
93+
t.equal( y, 1.0, 'returns expected value' );
94+
95+
y = cdf( 1.0, 0.5 );
96+
t.equal( y, 1.0, 'returns expected value' );
9497

9598
t.end();
9699
});
97100

98-
tape( 'if provided `x >= 1` and a valid `c`, the function returns `1`', opts, function test( t ) {
101+
tape( 'if provided a number less than or equal to zero for `x` and a finite `c`, the function returns `0`', opts, function test( t ) {
99102
var y;
100103

101-
y = cdf( 1.0, 1.0 );
102-
t.equal( y, 1.0, 'returns expected value' );
104+
y = cdf( NINF, 0.5 );
105+
t.equal( y, 0.0, 'returns expected value' );
103106

104-
y = cdf( 2.0, 1.0 );
105-
t.equal( y, 1.0, 'returns expected value' );
107+
y = cdf( -100.0, 0.5 );
108+
t.equal( y, 0.0, 'returns expected value' );
106109

107-
y = cdf( PINF, 1.0 );
108-
t.equal( y, 1.0, 'returns expected value' );
110+
y = cdf( -1.0, 0.5 );
111+
t.equal( y, 0.0, 'returns expected value' );
112+
113+
y = cdf( 0.0, 0.5 );
114+
t.equal( y, 0.0, 'returns expected value' );
109115

110116
t.end();
111117
});

0 commit comments

Comments
 (0)