Skip to content

Commit b0aa734

Browse files
chore: clean up
1 parent dbf4ef1 commit b0aa734

File tree

10 files changed

+20
-22
lines changed

10 files changed

+20
-22
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ The function accepts the following arguments:
182182
- **lambda**: `[in] double` rate parameter.
183183

184184
```c
185-
double stdlib_base_dists_erlang_skewness( const double k, const double lambda );
185+
double stdlib_base_dists_erlang_skewness( const int32_t k, const double lambda );
186186
```
187187
188188
</section>
@@ -208,6 +208,7 @@ element and another before the `/section` close. -->
208208
#include "stdlib/stats/base/dists/erlang/skewness.h"
209209
#include "stdlib/math/base/special/round.h"
210210
#include "stdlib/constants/float64/eps.h"
211+
#include <stdint.h>
211212
#include <stdlib.h>
212213
#include <stdio.h>
213214
@@ -217,7 +218,7 @@ static double random_uniform( const double min, const double max ) {
217218
}
218219
219220
int main( void ) {
220-
double k;
221+
int32_t k;
221222
double lambda;
222223
double y;
223224
int i;
@@ -226,7 +227,7 @@ int main( void ) {
226227
k = stdlib_base_round( random_uniform( 0.0, 10.0 ) );
227228
lambda = random_uniform( STDLIB_CONSTANT_FLOAT64_EPS, 10.0 );
228229
y = stdlib_base_dists_erlang_skewness( k, lambda );
229-
printf( "k: %lf, λ: %lf, skew(X;k,λ): %lf\n", k, lambda, y );
230+
printf( "k: %d, λ: %lf, skew(X;k,λ): %lf\n", k, lambda, y );
230231
}
231232
}
232233
```

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
var bench = require( '@stdlib/bench' );
2424
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
2525
var uniform = require( '@stdlib/random/base/uniform' );
26+
var Int32Array = require( '@stdlib/array/int32' );
2627
var Float64Array = require( '@stdlib/array/float64' );
2728
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2829
var EPS = require( '@stdlib/constants/float64/eps' );
@@ -40,7 +41,7 @@ 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++ ) {
4647
k[ i ] = discreteUniform( 0.0, 10.0 );

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

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

5253
len = 100;
53-
k = new Float64Array( len );
54+
k = new Int32Array( len );
5455
lambda = new Float64Array( len );
5556
for ( i = 0; i < len; i++ ) {
5657
k[ i ] = discreteUniform( 0.0, 10.0 );

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "stdlib/stats/base/dists/erlang/skewness.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,7 +96,7 @@ 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;

lib/node_modules/@stdlib/stats/base/dists/erlang/skewness/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/skewness.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_skewness( k, lambda );
40-
printf( "k: %lf, λ: %lf, skew(X;k,λ): %lf\n", k, lambda, y );
41+
printf( "k: %d, λ: %lf, skew(X;k,λ): %lf\n", k, lambda, y );
4142
}
4243
}

lib/node_modules/@stdlib/stats/base/dists/erlang/skewness/include/stdlib/stats/base/dists/erlang/skewness.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_SKEWNESS_H
2020
#define STDLIB_STATS_BASE_DISTS_ERLANG_SKEWNESS_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 excess skewness for a erlang distribution with shape parameter `k` and rate parameter `lambda`.
3133
*/
32-
double stdlib_base_dists_erlang_skewness( const double k, const double lambda );
34+
double stdlib_base_dists_erlang_skewness( const int32_t k, const double lambda );
3335

3436
#ifdef __cplusplus
3537
}

lib/node_modules/@stdlib/stats/base/dists/erlang/skewness/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 ~0.707
4747
*
4848
* @example
49-
* var v = skewness( 1.5, 2.0 );
50-
* // returns NaN
51-
*
52-
* @example
5349
* var v = skewness( 1, -0.1 );
5450
* // returns NaN
5551
*

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

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

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

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "stdlib/math/base/assert/is_positive_integer.h"
2121
#include "stdlib/math/base/assert/is_nan.h"
2222
#include "stdlib/math/base/special/sqrt.h"
23+
#include <stdint.h>
2324

2425
/**
2526
* Returns the excess skewness for a erlang distribution with shape parameter `k` and rate parameter `lambda`.
@@ -32,9 +33,9 @@
3233
* double y = stdlib_base_dists_bernoulli_skewness( 1.0, 0.1 );
3334
* // returns 2.0
3435
*/
35-
double stdlib_base_dists_erlang_skewness( const double k, const double lambda ) {
36+
double stdlib_base_dists_erlang_skewness( const int32_t k, const double lambda ) {
3637
if (
37-
!stdlib_base_is_positive_integer( k ) ||
38+
k <= 0.0 ||
3839
stdlib_base_is_nan( lambda ) ||
3940
lambda <= 0.0
4041
) {

lib/node_modules/@stdlib/stats/base/dists/erlang/skewness/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 = skewness( 1.5, 2.0 );
68-
t.equal( isnan( y ), true, 'returns NaN' );
69-
70-
y = skewness( 3.9, 2.0 );
71-
t.equal( isnan( y ), true, 'returns NaN' );
72-
7367
y = skewness( 0.0, 2.0 );
7468
t.equal( isnan( y ), true, 'returns NaN' );
7569

0 commit comments

Comments
 (0)