Skip to content

Commit 8e24bcf

Browse files
chore: clean up
1 parent 2bb2b99 commit 8e24bcf

File tree

10 files changed

+24
-26
lines changed

10 files changed

+24
-26
lines changed

lib/node_modules/@stdlib/stats/base/dists/erlang/variance/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,11 @@ double y = stdlib_base_dists_beta_variance( 1.0, 1.0 );
180180

181181
The function accepts the following arguments:
182182

183-
- **k**: `[in] double` shape parameter.
183+
- **k**: `[in] int32_t` shape parameter.
184184
- **lambda**: `[in] double` rate parameter.
185185

186186
```c
187-
double stdlib_base_dists_erlang_variance( const double k, const double lambda );
187+
double stdlib_base_dists_erlang_variance( const int32_t k, const double lambda );
188188
```
189189
190190
</section>
@@ -211,6 +211,7 @@ element and another before the `/section` close. -->
211211
#include "stdlib/stats/base/dists/erlang/variance.h"
212212
#include "stdlib/math/base/special/round.h"
213213
#include "stdlib/constants/float64/eps.h"
214+
#include <stdint.h>
214215
#include <stdlib.h>
215216
#include <stdio.h>
216217
@@ -220,7 +221,7 @@ static double random_uniform( const double min, const double max ) {
220221
}
221222
222223
int main( void ) {
223-
double k;
224+
int32_t k;
224225
double lambda;
225226
double y;
226227
int i;
@@ -229,7 +230,7 @@ int main( void ) {
229230
k = stdlib_base_round( random_uniform( 0.0, 10.0 ) );
230231
lambda = random_uniform( STDLIB_CONSTANT_FLOAT64_EPS, 10.0 );
231232
y = stdlib_base_dists_erlang_variance( k, lambda );
232-
printf( "k: %lf, λ: %lf, Var(X;k,λ):: %lf\n", k, lambda, y );
233+
printf( "k: %d, λ: %lf, Var(X;k,λ):: %lf\n", k, lambda, y );
233234
}
234235
}
235236
```

lib/node_modules/@stdlib/stats/base/dists/erlang/variance/benchmark/benchmark.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ var bench = require( '@stdlib/bench' );
2424
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
2525
var uniform = require( '@stdlib/random/base/uniform' );
2626
var Float64Array = require( '@stdlib/array/float64' );
27+
var Int32Array = require( '@stdlib/array/int32' );
2728
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2829
var EPS = require( '@stdlib/constants/float64/eps' );
2930
var pkg = require( './../package.json' ).name;
@@ -40,10 +41,10 @@ bench( pkg, function benchmark( b ) {
4041
var i;
4142

4243
len = 100;
43-
k = new Float64Array( len );
44+
k = new Int32Array( len );
4445
lambda = new Float64Array( len );
4546
for ( i = 0; i < len; i++ ) {
46-
k[ i ] = discreteUniform( 0.0, 10.0 );
47+
k[ i ] = discreteUniform( 1.0, 10.0 );
4748
lambda[ i ] = uniform( EPS, 10.0 );
4849
}
4950

lib/node_modules/@stdlib/stats/base/dists/erlang/variance/benchmark/benchmark.native.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var bench = require( '@stdlib/bench' );
2525
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
2626
var uniform = require( '@stdlib/random/base/uniform' );
2727
var Float64Array = require( '@stdlib/array/float64' );
28+
var Int32Array = require( '@stdlib/array/int32' );
2829
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2930
var tryRequire = require( '@stdlib/utils/try-require' );
3031
var EPS = require( '@stdlib/constants/float64/eps' );
@@ -49,10 +50,10 @@ bench( pkg+'::native', opts, function benchmark( b ) {
4950
var i;
5051

5152
len = 100;
52-
k = new Float64Array( len );
53+
k = new Int32Array( len );
5354
lambda = new Float64Array( len );
5455
for ( i = 0; i < len; i++ ) {
55-
k[ i ] = discreteUniform( 0.0, 10.0 );
56+
k[ i ] = discreteUniform( 1.0, 10.0 );
5657
lambda[ i ] = uniform( EPS, 10.0 );
5758
}
5859

lib/node_modules/@stdlib/stats/base/dists/erlang/variance/benchmark/c/benchmark.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "stdlib/stats/base/dists/erlang/variance.h"
2020
#include "stdlib/math/base/special/ceil.h"
2121
#include "stdlib/constants/float64/eps.h"
22+
#include <stdint.h>
2223
#include <stdlib.h>
2324
#include <stdio.h>
2425
#include <math.h>
@@ -95,14 +96,14 @@ static double random_uniform( const double min, const double max ) {
9596
*/
9697
static double benchmark( void ) {
9798
double elapsed;
98-
double k[ 100 ];
99+
int32_t k[ 100 ];
99100
double lambda[ 100 ];
100101
double y;
101102
double t;
102103
int i;
103104

104105
for ( i = 0; i < 100; i++ ) {
105-
k[ i ] = stdlib_base_ceil( random_uniform( 0.0, 10.0 ) );
106+
k[ i ] = stdlib_base_ceil( random_uniform( 1.0, 10.0 ) );
106107
lambda[ i ] = random_uniform( STDLIB_CONSTANT_FLOAT64_EPS, 10.0 );
107108
}
108109

lib/node_modules/@stdlib/stats/base/dists/erlang/variance/examples/c/example.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "stdlib/stats/base/dists/erlang/variance.h"
2020
#include "stdlib/math/base/special/round.h"
2121
#include "stdlib/constants/float64/eps.h"
22+
#include <stdint.h>
2223
#include <stdlib.h>
2324
#include <stdio.h>
2425

@@ -28,7 +29,7 @@ static double random_uniform( const double min, const double max ) {
2829
}
2930

3031
int main( void ) {
31-
double k;
32+
int32_t k;
3233
double lambda;
3334
double y;
3435
int i;
@@ -37,6 +38,6 @@ int main( void ) {
3738
k = stdlib_base_round( random_uniform( 0.0, 10.0 ) );
3839
lambda = random_uniform( STDLIB_CONSTANT_FLOAT64_EPS, 10.0 );
3940
y = stdlib_base_dists_erlang_variance( k, lambda );
40-
printf( "k: %lf, λ: %lf, Var(X;k,λ):: %lf\n", k, lambda, y );
41+
printf( "k: %d, λ: %lf, Var(X;k,λ):: %lf\n", k, lambda, y );
4142
}
4243
}

lib/node_modules/@stdlib/stats/base/dists/erlang/variance/include/stdlib/stats/base/dists/erlang/variance.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#ifndef STDLIB_STATS_BASE_DISTS_ERLANG_VARIANCE_H
2020
#define STDLIB_STATS_BASE_DISTS_ERLANG_VARIANCE_H
2121

22+
#include <stdint.h>
23+
2224
/*
2325
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
2426
*/
@@ -29,7 +31,7 @@ extern "C" {
2931
/**
3032
* Returns the variance for a erlang distribution with shape parameter `k` and rate parameter `lambda`.
3133
*/
32-
double stdlib_base_dists_erlang_variance( const double k, const double lambda );
34+
double stdlib_base_dists_erlang_variance( const int32_t k, const double lambda );
3335

3436
#ifdef __cplusplus
3537
}

lib/node_modules/@stdlib/stats/base/dists/erlang/variance/lib/native.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ var addon = require( './../src/addon.node' );
4646
* // returns 2.0
4747
*
4848
* @example
49-
* var v = variance( 1.5, 2.0 );
50-
* // returns NaN
51-
*
52-
* @example
5349
* var v = variance( 1, -0.1 );
5450
* // returns NaN
5551
*

lib/node_modules/@stdlib/stats/base/dists/erlang/variance/src/addon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@
2020
#include "stdlib/math/base/napi/binary.h"
2121

2222
// cppcheck-suppress shadowFunction
23-
STDLIB_MATH_BASE_NAPI_MODULE_DD_D( stdlib_base_dists_erlang_variance )
23+
STDLIB_MATH_BASE_NAPI_MODULE_ID_D( stdlib_base_dists_erlang_variance )

lib/node_modules/@stdlib/stats/base/dists/erlang/variance/src/main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "stdlib/stats/base/dists/erlang/variance.h"
2020
#include "stdlib/math/base/assert/is_positive_integer.h"
2121
#include "stdlib/math/base/assert/is_nan.h"
22+
#include <stdint.h>
2223

2324
/**
2425
* Returns the variance for a erlang distribution with shape parameter `k` and rate parameter `lambda`.
@@ -31,9 +32,9 @@
3132
* double y = stdlib_base_dists_beta_variance( 1.0, 1.0 );
3233
* // returns 1.0
3334
*/
34-
double stdlib_base_dists_erlang_variance( const double k, const double lambda ) {
35+
double stdlib_base_dists_erlang_variance( const int32_t k, const double lambda ) {
3536
if (
36-
!stdlib_base_is_positive_integer( k ) ||
37+
k <= 0.0 ||
3738
stdlib_base_is_nan( lambda ) ||
3839
lambda <= 0.0
3940
) {

lib/node_modules/@stdlib/stats/base/dists/erlang/variance/test/test.native.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,6 @@ tape( 'if provided `NaN` for any parameter, the function returns `NaN`', opts, f
6464
tape( 'if provided a `k` that is not a positive integer, the function returns `NaN`', opts, function test( t ) {
6565
var y;
6666

67-
y = variance( 1.5, 2.0 );
68-
t.equal( isnan( y ), true, 'returns NaN' );
69-
70-
y = variance( 3.9, 2.0 );
71-
t.equal( isnan( y ), true, 'returns NaN' );
72-
7367
y = variance( 0.0, 2.0 );
7468
t.equal( isnan( y ), true, 'returns NaN' );
7569

0 commit comments

Comments
 (0)