Skip to content

Commit 53af756

Browse files
authored
chore: apply suggestions from code review
Signed-off-by: Philipp Burckhardt <[email protected]>
1 parent 5392a61 commit 53af756

File tree

6 files changed

+17
-41
lines changed

6 files changed

+17
-41
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ for ( i = 0; i < 10; i++ ) {
173173

174174
#### stdlib_base_dists_kumaraswamy_mean( a, b )
175175

176-
Returns the expected value of a Kumaraswamy's double bounded distribution.
176+
Returns the [expected value][mean] of a [Kumaraswamy's double bounded][kumaraswamy-distribution] distribution with first shape parameter `a` and second shape parameter `b`.
177177

178178
```c
179179
double out = stdlib_base_dists_kumaraswamy_mean( 1.5, 1.5 );
@@ -182,8 +182,8 @@ double out = stdlib_base_dists_kumaraswamy_mean( 1.5, 1.5 );
182182

183183
The function accepts the following arguments:
184184

185-
- **a**: `[in] double` first shape parameter .
186-
- **b**: `[in] double` second shape parameter .
185+
- **a**: `[in] double` first shape parameter.
186+
- **b**: `[in] double` second shape parameter.
187187

188188
```c
189189
double stdlib_base_dists_kumaraswamy_mean( const double a, const double b );
@@ -218,9 +218,9 @@ static double random_uniform( const double min, const double max ) {
218218
}
219219
220220
int main( void ) {
221+
double mean;
221222
double a;
222223
double b;
223-
double mean;
224224
int i;
225225
226226
for ( i = 0; i < 10; i++ ) {

lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/mean/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
shape1 = new Float64Array( len );
4343
shape2 = new Float64Array( len );
4444
for ( i = 0; i < len; i++ ) {
45-
shape1[ i ] = ( randu() * 10.0 ) + EPS;
46-
shape2[ i ] = ( randu() * 10.0 ) + EPS;
45+
shape1[ i ] = uniform( EPS, 10.0 );
46+
shape2[ i ] = uniform( EPS, 10.0 );
4747
}
4848

4949
b.tic();

lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/mean/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 isnan = require( '@stdlib/math/base/assert/is-nan' );
2828
var tryRequire = require( '@stdlib/utils/try-require' );
2929
var EPS = require( '@stdlib/constants/float64/eps' );
@@ -51,8 +51,8 @@ bench( pkg+'::native', opts, function benchmark( b ) {
5151
shape1 = new Float64Array( len );
5252
shape2 = new Float64Array( len );
5353
for ( i = 0; i < len; i++ ) {
54-
shape1[ i ] = ( randu() * 10.0 ) + EPS;
55-
shape2[ i ] = ( randu() * 10.0 ) + EPS;
54+
shape1[ i ] = uniform( EPS, 10.0 );
55+
shape2[ i ] = uniform( EPS, 10.0 );
5656
}
5757

5858
b.tic();

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,20 +93,20 @@ static double random_uniform( const double min, const double max ) {
9393
*/
9494
static double benchmark( void ) {
9595
double elapsed;
96-
double a[100];
97-
double b[100];
96+
double a[ 100 ];
97+
double b[ 100 ];
9898
double y;
9999
double t;
100100
int i;
101101

102102
for ( i = 0; i < 100; i++ ) {
103-
a[i] = random_uniform(0.0, 10.0);
104-
b[i] = random_uniform(0.0, 10.0);
103+
a[i] = random_uniform( 0.0, 10.0 );
104+
b[i] = random_uniform( 0.0, 10.0 );
105105
}
106106

107107
t = tic();
108108
for ( i = 0; i < ITERATIONS; i++ ) {
109-
y = stdlib_base_dists_kumaraswamy_mean(a[i % 100], b[i % 100]);
109+
y = stdlib_base_dists_kumaraswamy_mean( a[ i % 100 ], b[ i % 100 ] );
110110
if ( y != y ) {
111111
printf( "should not return NaN\n" );
112112
break;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ static double random_uniform( const double min, const double max ) {
2626
}
2727

2828
int main( void ) {
29+
double mean;
2930
double a;
3031
double b;
31-
double mean;
3232
int i;
3333

3434
for ( i = 0; i < 10; i++ ) {

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

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,35 +25,11 @@
2525
*
2626
* @param a first shape parameter
2727
* @param b second shape parameter
28-
* @return expected value of the distribution
28+
* @return expected value
2929
*
3030
* @example
3131
* double y = stdlib_base_dists_kumaraswamy_mean( 1.5, 1.5 );
3232
* // returns ~0.512
33-
*
34-
* @example
35-
* double y = stdlib_base_dists_kumaraswamy_mean( 4.0, 12.0 );
36-
* // returns ~0.481
37-
*
38-
* @example
39-
* double y = stdlib_base_dists_kumaraswamy_mean( 12.0, 2.0 );
40-
* // returns ~0.886
41-
*
42-
* @example
43-
* double y = stdlib_base_dists_kumaraswamy_mean( 1.5, -0.1 );
44-
* // returns NaN
45-
*
46-
* @example
47-
* double y = stdlib_base_dists_kumaraswamy_mean( -0.1, 1.5 );
48-
* // returns NaN
49-
*
50-
* @example
51-
* double y = stdlib_base_dists_kumaraswamy_mean( 2.0, NAN );
52-
* // returns NaN
53-
*
54-
* @example
55-
* double y = stdlib_base_dists_kumaraswamy_mean( NAN, 2.0 );
56-
* // returns NaN
5733
*/
5834
double stdlib_base_dists_kumaraswamy_mean( const double a, const double b ) {
5935
if (

0 commit comments

Comments
 (0)