Skip to content

Commit 90dab8d

Browse files
committed
chore: follow code conventions
--- 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: 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: 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: 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: na - 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 ac0c3bc commit 90dab8d

File tree

12 files changed

+78
-65
lines changed

12 files changed

+78
-65
lines changed

lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/median/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ for ( i = 0; i < 10; i++ ) {
174174
Returns the [median][median] of a [Kumaraswamy's double bounded][kumaraswamy-distribution] distribution with first shape parameter `a` and second shape parameter `b`.
175175

176176
```c
177-
double out = stdlib_base_dists_kumaraswamy_median( 2.0, 3.0 );
178-
// returns ~1.817
177+
double out = stdlib_base_dists_kumaraswamy_median( 1.0, 1.0 );
178+
// returns 0.5
179179
```
180180

181181
The function accepts the following arguments:
@@ -212,7 +212,7 @@ double stdlib_base_dists_kumaraswamy_median( const double a, const double b );
212212
213213
static double random_uniform( const double min, const double max ) {
214214
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
215-
return min + ( v * (max - min) );
215+
return min + ( v*(max-min) );
216216
}
217217
218218
int main( void ) {
@@ -225,7 +225,7 @@ int main( void ) {
225225
a = random_uniform( 0.1, 10.0 );
226226
b = random_uniform( 0.1, 10.0 );
227227
y = stdlib_base_dists_kumaraswamy_median( a, b );
228-
printf( "a: %lf, b: %lf, Median(a, b): %lf\n", a, b, y );
228+
printf( "a: %lf, b: %lf, Median(X;a,b): %lf\n", a, b, y );
229229
}
230230
231231
return 0;

lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/median/benchmark/benchmark.js

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

2323
var bench = require( '@stdlib/bench' );
2424
var Float64Array = require( '@stdlib/array/float64' );
25-
var randu = require( '@stdlib/random/base/randu' );
25+
var uniform = require( '@stdlib/random/base/uniform' );
2626
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2727
var EPS = require( '@stdlib/constants/float64/eps' );
2828
var pkg = require( './../package.json' ).name;
@@ -42,8 +42,8 @@ bench( pkg, function benchmark( b ) {
4242
alpha = new Float64Array( len );
4343
beta = new Float64Array( len );
4444
for ( i = 0; i < len; i++ ) {
45-
alpha[ i ] = ( randu() * 10.0 ) + EPS;
46-
beta[ i ] = ( randu() * 10.0 ) + EPS;
45+
alpha[ i ] = uniform( EPS, 10.0 );
46+
beta[ i ] = uniform( EPS, 10.0 );
4747
}
4848

4949
b.tic();

lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/median/benchmark/benchmark.native.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
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' );
2727
var EPS = require( '@stdlib/constants/float64/eps' );
2828
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2929
var tryRequire = require( '@stdlib/utils/try-require' );
@@ -51,8 +51,8 @@ bench( pkg+'::native', opts, function benchmark( b ) {
5151
alpha = new Float64Array( len );
5252
beta = new Float64Array( len );
5353
for ( i = 0; i < len; i++ ) {
54-
alpha[ i ] = ( randu() * 10.0 ) + EPS;
55-
beta[ i ] = ( randu() * 10.0 ) + EPS;
54+
alpha[ i ] = uniform( EPS, 10.0 );
55+
beta[ i ] = uniform( EPS, 10.0 );
5656
}
5757

5858
b.tic();

lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/median/benchmark/c/benchmark.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ static double random_uniform( const double min, const double max ) {
9393
* @return elapsed time in seconds
9494
*/
9595
static double benchmark( void ) {
96-
double elapsed;
9796
double a[ 100 ];
9897
double b[ 100 ];
98+
double elapsed;
9999
double y;
100100
double t;
101101
int i;

lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/median/examples/c/example.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ int main( void ) {
3434
for ( i = 0; i < 25; i++ ) {
3535
a = random_uniform( 0.1, 10.0 );
3636
b = random_uniform( 0.1, 10.0 );
37-
3837
y = stdlib_base_dists_kumaraswamy_median( a, b );
39-
printf( "a: %lf, b: %lf, Median(a,b): %lf\n", a, b, y );
38+
printf( "a: %lf, b: %lf, Median(X;a,b): %lf\n", a, b, y );
4039
}
4140

4241
return 0;

lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/median/include/stdlib/stats/base/dists/kumaraswamy/median.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-
* Returns the median of a Kumaraswamy distribution.
30+
* Returns the median of a Kumaraswamy's double bounded distribution.
3131
*/
3232
double stdlib_base_dists_kumaraswamy_median( const double a, const double b );
3333

lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/median/lib/native.js

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,39 @@ var addon = require( './../src/addon.node' );
2626
// MAIN //
2727

2828
/**
29-
* Returns the median of a Kumaraswamy distribution.
29+
* Returns the median of a Kumaraswamy's double bounded distribution.
3030
*
3131
* @private
32-
* @param {number} a - shape parameter
33-
* @param {number} b - shape parameter
34-
* @returns {number} median
32+
* @param {PositiveNumber} a - first shape parameter
33+
* @param {PositiveNumber} b - second shape parameter
34+
* @returns {PositiveNumber} median
3535
*
3636
* @example
37-
* var v = median( 2.0, 3.0 );
38-
* // returns ~0.2062994740159002
37+
* var v = median( 0.5, 1.0 );
38+
* // returns 0.25
3939
*
4040
* @example
41-
* var v = median( 1.0, 5.0 );
42-
* // returns ~0.12944943670387588
41+
* var v = median( 4.0, 12.0 );
42+
* // returns ~0.487
4343
*
4444
* @example
45-
* var v = median( 2.0, -0.5 );
45+
* var v = median( 12.0, 2.0 );
46+
* // returns ~0.903
47+
*
48+
* @example
49+
* var v = median( 1.0, -0.1 );
50+
* // returns NaN
51+
*
52+
* @example
53+
* var v = median( -0.1, 1.0 );
54+
* // returns NaN
55+
*
56+
* @example
57+
* var v = median( 2.0, NaN );
58+
* // returns NaN
59+
*
60+
* @example
61+
* var v = median( NaN, 2.0 );
4662
* // returns NaN
4763
*/
4864
function median( a, b ) {

lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/median/manifest.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@
4040
"dependencies": [
4141
"@stdlib/math/base/napi/binary",
4242
"@stdlib/math/base/assert/is-nan",
43-
"@stdlib/math/base/special/pow",
44-
"@stdlib/constants/float64/eps"
43+
"@stdlib/math/base/special/pow"
4544
]
4645
},
4746
{
@@ -74,8 +73,7 @@
7473
"libpath": [],
7574
"dependencies": [
7675
"@stdlib/math/base/assert/is-nan",
77-
"@stdlib/math/base/special/pow",
78-
"@stdlib/constants/float64/eps"
76+
"@stdlib/math/base/special/pow"
7977
]
8078
}
8179
]

lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/median/src/main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
#include "stdlib/math/base/special/pow.h"
2222

2323
/**
24-
* Returns the median of a Kumaraswamy distribution.
24+
* Returns the median of a Kumaraswamy's double bounded distribution.
2525
*
2626
* @param a first shape parameter
2727
* @param b second shape parameter
2828
* @return median
2929
*
3030
* @example
31-
* double y = stdlib_base_dists_kumaraswamy_median( 2.0, 3.0 );
32-
* // returns 1.0
31+
* double y = stdlib_base_dists_kumaraswamy_median( 0.5, 1.0 );
32+
* // returns 0.25
3333
*/
3434
double stdlib_base_dists_kumaraswamy_median( const double a, const double b ) {
3535
if (
@@ -39,5 +39,5 @@ double stdlib_base_dists_kumaraswamy_median( const double a, const double b ) {
3939
) {
4040
return 0.0/0.0; // NaN
4141
}
42-
return stdlib_base_pow( 1.0 - stdlib_base_pow( 2.0, -1.0 / b ), 1.0 / a );
42+
return stdlib_base_pow( 1.0 - stdlib_base_pow( 2.0, -1.0/b ), 1.0/a );
4343
}

lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/median/test/fixtures/julia/runner.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ Generate fixture data and write to file.
2626
2727
# Arguments
2828
29-
* `a`: shape parameter a (must be positive)
30-
* `b`: shape parameter b (must be positive)
29+
* `a`: first shape parameter
30+
* `b`: second shape parameter
3131
* `name::AbstractString`: output filename
3232
3333
# Examples

lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/median/test/test.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ tape( 'main export is a function', function test( t ) {
4444

4545
tape( 'if provided `NaN` for any parameter, the function returns `NaN`', function test( t ) {
4646
var v = median( NaN, 0.5 );
47-
t.equal( isnan( v ), true, 'returns NaN' );
47+
t.equal( isnan( v ), true, 'returns expected value' );
4848

4949
v = median( 10.0, NaN );
50-
t.equal( isnan( v ), true, 'returns NaN' );
50+
t.equal( isnan( v ), true, 'returns expected value' );
5151

5252
t.end();
5353
});
@@ -56,25 +56,25 @@ tape( 'if provided a nonpositive `a`, the function returns `NaN`', function test
5656
var y;
5757

5858
y = median( 0.0, 2.0 );
59-
t.equal( isnan( y ), true, 'returns NaN' );
59+
t.equal( isnan( y ), true, 'returns expected value' );
6060

6161
y = median( -1.0, 2.0 );
62-
t.equal( isnan( y ), true, 'returns NaN' );
62+
t.equal( isnan( y ), true, 'returns expected value' );
6363

6464
y = median( -1.0, 2.0 );
65-
t.equal( isnan( y ), true, 'returns NaN' );
65+
t.equal( isnan( y ), true, 'returns expected value' );
6666

6767
y = median( NINF, 1.0 );
68-
t.equal( isnan( y ), true, 'returns NaN' );
68+
t.equal( isnan( y ), true, 'returns expected value' );
6969

7070
y = median( NINF, PINF );
71-
t.equal( isnan( y ), true, 'returns NaN' );
71+
t.equal( isnan( y ), true, 'returns expected value' );
7272

7373
y = median( NINF, NINF );
74-
t.equal( isnan( y ), true, 'returns NaN' );
74+
t.equal( isnan( y ), true, 'returns expected value' );
7575

7676
y = median( NINF, NaN );
77-
t.equal( isnan( y ), true, 'returns NaN' );
77+
t.equal( isnan( y ), true, 'returns expected value' );
7878

7979
t.end();
8080
});
@@ -83,25 +83,25 @@ tape( 'if provided a nonpositive `b`, the function returns `NaN`', function test
8383
var y;
8484

8585
y = median( 2.0, 0.0 );
86-
t.equal( isnan( y ), true, 'returns NaN' );
86+
t.equal( isnan( y ), true, 'returns expected value' );
8787

8888
y = median( 2.0, -1.0 );
89-
t.equal( isnan( y ), true, 'returns NaN' );
89+
t.equal( isnan( y ), true, 'returns expected value' );
9090

9191
y = median( 2.0, -1/0 );
92-
t.equal( isnan( y ), true, 'returns NaN' );
92+
t.equal( isnan( y ), true, 'returns expected value' );
9393

9494
y = median( 1.0, NINF );
95-
t.equal( isnan( y ), true, 'returns NaN' );
95+
t.equal( isnan( y ), true, 'returns expected value' );
9696

9797
y = median( PINF, NINF );
98-
t.equal( isnan( y ), true, 'returns NaN' );
98+
t.equal( isnan( y ), true, 'returns expected value' );
9999

100100
y = median( NINF, NINF );
101-
t.equal( isnan( y ), true, 'returns NaN' );
101+
t.equal( isnan( y ), true, 'returns expected value' );
102102

103103
y = median( NaN, NINF );
104-
t.equal( isnan( y ), true, 'returns NaN' );
104+
t.equal( isnan( y ), true, 'returns expected value' );
105105

106106
t.end();
107107
});

lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/median/test/test.native.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ tape( 'main export is a function', opts, function test( t ) {
5353

5454
tape( 'if provided `NaN` for any parameter, the function returns `NaN`', opts, function test( t ) {
5555
var v = median( NaN, 0.5 );
56-
t.equal( isnan( v ), true, 'returns NaN' );
56+
t.equal( isnan( v ), true, 'returns expected value' );
5757

5858
v = median( 10.0, NaN );
59-
t.equal( isnan( v ), true, 'returns NaN' );
59+
t.equal( isnan( v ), true, 'returns expected value' );
6060

6161
t.end();
6262
});
@@ -65,25 +65,25 @@ tape( 'if provided a nonpositive `a`, the function returns `NaN`', opts, functio
6565
var y;
6666

6767
y = median( 0.0, 2.0 );
68-
t.equal( isnan( y ), true, 'returns NaN' );
68+
t.equal( isnan( y ), true, 'returns expected value' );
6969

7070
y = median( -1.0, 2.0 );
71-
t.equal( isnan( y ), true, 'returns NaN' );
71+
t.equal( isnan( y ), true, 'returns expected value' );
7272

7373
y = median( -1.0, 2.0 );
74-
t.equal( isnan( y ), true, 'returns NaN' );
74+
t.equal( isnan( y ), true, 'returns expected value' );
7575

7676
y = median( NINF, 1.0 );
77-
t.equal( isnan( y ), true, 'returns NaN' );
77+
t.equal( isnan( y ), true, 'returns expected value' );
7878

7979
y = median( NINF, PINF );
80-
t.equal( isnan( y ), true, 'returns NaN' );
80+
t.equal( isnan( y ), true, 'returns expected value' );
8181

8282
y = median( NINF, NINF );
83-
t.equal( isnan( y ), true, 'returns NaN' );
83+
t.equal( isnan( y ), true, 'returns expected value' );
8484

8585
y = median( NINF, NaN );
86-
t.equal( isnan( y ), true, 'returns NaN' );
86+
t.equal( isnan( y ), true, 'returns expected value' );
8787

8888
t.end();
8989
});
@@ -92,25 +92,25 @@ tape( 'if provided a nonpositive `b`, the function returns `NaN`', opts, functio
9292
var y;
9393

9494
y = median( 2.0, 0.0 );
95-
t.equal( isnan( y ), true, 'returns NaN' );
95+
t.equal( isnan( y ), true, 'returns expected value' );
9696

9797
y = median( 2.0, -1.0 );
98-
t.equal( isnan( y ), true, 'returns NaN' );
98+
t.equal( isnan( y ), true, 'returns expected value' );
9999

100100
y = median( 2.0, -1/0 );
101-
t.equal( isnan( y ), true, 'returns NaN' );
101+
t.equal( isnan( y ), true, 'returns expected value' );
102102

103103
y = median( 1.0, NINF );
104-
t.equal( isnan( y ), true, 'returns NaN' );
104+
t.equal( isnan( y ), true, 'returns expected value' );
105105

106106
y = median( PINF, NINF );
107-
t.equal( isnan( y ), true, 'returns NaN' );
107+
t.equal( isnan( y ), true, 'returns expected value' );
108108

109109
y = median( NINF, NINF );
110-
t.equal( isnan( y ), true, 'returns NaN' );
110+
t.equal( isnan( y ), true, 'returns expected value' );
111111

112112
y = median( NaN, NINF );
113-
t.equal( isnan( y ), true, 'returns NaN' );
113+
t.equal( isnan( y ), true, 'returns expected value' );
114114

115115
t.end();
116116
});

0 commit comments

Comments
 (0)