Skip to content

Commit e4070f4

Browse files
committed
change in addon.c
--- 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 12e20d9 commit e4070f4

File tree

5 files changed

+45
-63
lines changed

5 files changed

+45
-63
lines changed

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

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -52,28 +52,3 @@ bench( pkg, function benchmark( b ) {
5252
b.pass( 'benchmark finished' );
5353
b.end();
5454
});
55-
56-
bench( pkg+':direct', function benchmark( b ) {
57-
var lambda;
58-
var k;
59-
var x;
60-
var y;
61-
var i;
62-
63-
lambda = 3.14;
64-
k = 2.25;
65-
b.tic();
66-
for ( i = 0; i < b.iterations; i++ ) {
67-
x = ( randu() * 100.0 ) + EPS;
68-
y = skewness( k, lambda );
69-
if ( isnan( y ) ) {
70-
b.fail( 'should not return NaN' );
71-
}
72-
}
73-
b.toc();
74-
if ( isnan( y ) ) {
75-
b.fail( 'should not return NaN' );
76-
}
77-
b.pass( 'benchmark finished' );
78-
b.end();
79-
});

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

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench' );
2525
var Float64Array = require( '@stdlib/array/float64' );
26+
var EPS = require( '@stdlib/constants/float64/eps' );
2627
var randu = require( '@stdlib/random/base/randu' );
2728
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2829
var tryRequire = require( '@stdlib/utils/try-require' );
@@ -39,25 +40,17 @@ var opts = {
3940

4041
// MAIN //
4142

42-
bench( pkg, opts, function benchmark( b ) {
43-
44-
var len;
45-
var k;
43+
bench( pkg+'::native', opts, function benchmark( b ) {
4644
var lambda;
45+
var k;
4746
var y;
4847
var i;
4948

50-
len = 100;
51-
k = new Float64Array( len );
52-
lambda = new Float64Array( len );
53-
for ( i = 0; i < len; i++ ) {
54-
k[ i ] = ( randu() * 10.0 ) + 1.0; // shape parameter > 0
55-
lambda[ i ] = ( randu() * 10.0 ) + 1.0; // scale parameter > 0
56-
}
57-
5849
b.tic();
5950
for ( i = 0; i < b.iterations; i++ ) {
60-
y = skewness( k[ i % len ], lambda[ i % len ] );
51+
k = ( randu()*10.0 ) + 1.0 + EPS;
52+
lambda = ( randu()*10.0 ) + 1.0 + EPS;
53+
y = skewness( k, lambda );
6154
if ( isnan( y ) ) {
6255
b.fail( 'should not return NaN' );
6356
}

lib/node_modules/@stdlib/stats/base/dists/weibull/skewness/manifest.json

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,24 @@
2929
{
3030
"task": "build",
3131
"wasm": false,
32-
"src": ["./src/main.c"],
33-
"include": ["./include"],
32+
"src": [
33+
"./src/main.c"
34+
],
35+
"include": [
36+
"./include"
37+
],
3438
"libraries": [],
3539
"libpath": [],
3640
"dependencies": [
41+
"@stdlib/math/base/napi/binary",
42+
"@stdlib/math/base/assert/is-nan",
43+
"@stdlib/math/base/special/gamma",
3744
"@stdlib/math/base/assert/is-positive-integer",
3845
"@stdlib/math/base/assert/is-finite",
39-
"@stdlib/math/base/assert/is-nan",
4046
"@stdlib/math/base/special/exp",
4147
"@stdlib/constants/float64/ln-two",
4248
"@stdlib/math/base/special/ln",
43-
"@stdlib/math/base/assert/is-integer",
44-
"@stdlib/math/base/special/gamma"
49+
"@stdlib/math/base/assert/is-integer"
4550

4651
]
4752
},
@@ -56,9 +61,6 @@
5661
"@stdlib/math/base/assert/is-positive-integer",
5762
"@stdlib/math/base/assert/is-finite",
5863
"@stdlib/math/base/assert/is-nan",
59-
"@stdlib/math/base/special/exp",
60-
"@stdlib/constants/float64/ln-two",
61-
"@stdlib/math/base/special/ln",
6264
"@stdlib/math/base/assert/is-integer",
6365
"@stdlib/math/base/special/gamma"
6466
]
@@ -74,9 +76,6 @@
7476
"@stdlib/math/base/assert/is-positive-integer",
7577
"@stdlib/math/base/assert/is-finite",
7678
"@stdlib/math/base/assert/is-nan",
77-
"@stdlib/math/base/special/exp",
78-
"@stdlib/constants/float64/ln-two",
79-
"@stdlib/math/base/special/ln",
8079
"@stdlib/math/base/assert/is-integer",
8180
"@stdlib/math/base/special/gamma"
8281
]

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*/
1818

1919
#include "stdlib/stats/base/dists/weibull/skewness.h"
20-
#include "stdlib/math/base/napi/unary.h"
20+
#include "stdlib/math/base/napi/binary.h"
2121

2222
// cppcheck-suppress shadowFunction
23-
STDLIB_MATH_BASE_NAPI_MODULE_D_D( stdlib_base_dists_weibull_skewness )
23+
STDLIB_MATH_BASE_NAPI_MODULE_DD_D( stdlib_base_dists_weibull_skewness )

lib/node_modules/@stdlib/stats/base/dists/weibull/skewness/test/test.native.js

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,35 +47,50 @@ tape( 'main export is a function', opts, function test( t ) {
4747
});
4848

4949
tape( 'if provided `NaN` for any parameter, the function returns `NaN`', opts, function test( t ) {
50-
var y = skewness( NaN, 8 );
50+
var y = skewness( NaN, 0.5 );
5151
t.equal( isnan( y ), true, 'returns NaN' );
52-
y = skewness( 0.0, NaN );
52+
y = skewness( 10.0, NaN );
5353
t.equal( isnan( y ), true, 'returns NaN' );
5454
t.end();
5555
});
5656

57-
tape( 'if provided `+infinity` for `x` and a valid `n`, the function returns `NaN`', opts, function test( t ) {
58-
var y = skewness( PINF, 8 );
57+
tape( 'if provided `k <= 0`, the function returns `NaN`', function test( t ) {
58+
var y;
59+
60+
y = skewness( -1.0, 2.0 );
61+
t.equal( isnan( y ), true, 'returns NaN' );
62+
63+
y = skewness( NINF, 1.0 );
64+
t.equal( isnan( y ), true, 'returns NaN' );
65+
66+
y = skewness( NINF, PINF );
5967
t.equal( isnan( y ), true, 'returns NaN' );
60-
t.end();
61-
});
6268

63-
tape( 'if provided `-infinity` for `x` and a valid `n`, the function returns `NaN`', opts, function test( t ) {
64-
var y = skewness( NINF, 8 );
69+
y = skewness( NINF, NINF );
6570
t.equal( isnan( y ), true, 'returns NaN' );
71+
72+
y = skewness( NINF, NaN );
73+
t.equal( isnan( y ), true, 'returns NaN' );
74+
6675
t.end();
6776
});
6877

69-
tape( 'if not provided a positive integer for `n`, the function returns `NaN`', opts, function test( t ) {
78+
tape( 'if provided `lambda <= 0`, the function returns `NaN`', function test( t ) {
7079
var y;
7180

7281
y = skewness( 2.0, -1.0 );
7382
t.equal( isnan( y ), true, 'returns NaN' );
7483

75-
y = skewness( 2.0, NINF );
84+
y = skewness( 1.0, NINF );
85+
t.equal( isnan( y ), true, 'returns NaN' );
86+
87+
y = skewness( PINF, NINF );
88+
t.equal( isnan( y ), true, 'returns NaN' );
89+
90+
y = skewness( NINF, NINF );
7691
t.equal( isnan( y ), true, 'returns NaN' );
7792

78-
y = skewness( 2.0, PINF );
93+
y = skewness( NaN, NINF );
7994
t.equal( isnan( y ), true, 'returns NaN' );
8095

8196
t.end();
@@ -93,7 +108,7 @@ tape( 'the function evaluates the skewness for `k` given `lambda` observations',
93108
expected = data.expected;
94109
k = data.k;
95110
lambda = data.lambda;
96-
for ( i = 0; i < k.length; i++ ) {
111+
for ( i = 0; i < expected.length; i++ ) {
97112
y = skewness( k[i], lambda[i] );
98113
if ( y === expected[i] ) {
99114
t.equal( y, expected[i], 'k: '+k[i]+', lambda: '+lambda[i]+', y: '+y+', expected: '+expected[i] );

0 commit comments

Comments
 (0)