Skip to content

Commit 2c1a04c

Browse files
committed
fix: update the suggested changes
--- 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: na - 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: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 1f59fd8 commit 2c1a04c

11 files changed

Lines changed: 36 additions & 235 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ static double random_uniform( const double min, const double max ) {
9595
* @return elapsed time in seconds
9696
*/
9797
static double benchmark( void ) {
98+
double lambda[ 100 ];
9899
double x[ 100 ];
99100
int32_t k[ 100 ];
100-
double lambda[ 100 ];
101101
double elapsed;
102102
double y;
103103
double t;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ var addon = require( './../src/addon.node' );
2828
/**
2929
* Evaluates the cumulative distribution function (CDF) for an Erlang distribution with shape parameter `k` and rate parameter `lambda` at a value `x`.
3030
*
31+
* @private
3132
* @param {number} x - input value
3233
* @param {NonNegativeInteger} k - shape parameter
3334
* @param {PositiveNumber} lambda - rate parameter

lib/node_modules/@stdlib/stats/base/dists/erlang/cdf/manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
"dependencies": [
4141
"@stdlib/math/base/napi/ternary",
4242
"@stdlib/math/base/assert/is-nonnegative-integer",
43-
"@stdlib/stats/base/dists/gamma/cdf"
43+
"@stdlib/stats/base/dists/gamma/cdf",
44+
"@stdlib/math/base/assert/is-nan"
4445
]
4546
},
4647
{

lib/node_modules/@stdlib/stats/base/dists/erlang/cdf/test/fixtures/julia/both_large.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/node_modules/@stdlib/stats/base/dists/erlang/cdf/test/fixtures/julia/data.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

lib/node_modules/@stdlib/stats/base/dists/erlang/cdf/test/fixtures/julia/large_rate.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/node_modules/@stdlib/stats/base/dists/erlang/cdf/test/fixtures/julia/large_shape.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/node_modules/@stdlib/stats/base/dists/erlang/cdf/test/fixtures/julia/runner.jl

100644100755
Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# @license Apache-2.0
44
#
5-
# Copyright (c) 2018 The Stdlib Authors.
5+
# Copyright (c) 2026 The Stdlib Authors.
66
#
77
# Licensed under the Apache License, Version 2.0 (the "License");
88
# you may not use this file except in compliance with the License.
@@ -70,20 +70,8 @@ file = @__FILE__;
7070
# Extract the directory in which this file resides:
7171
dir = dirname( file );
7272

73-
# Large shape parameter:
74-
x = rand( 1000 ) .* 5.0;
75-
k = round.( Int64, ( rand( 1000 ) .* 10.0 ) .+ 10.0 );
76-
lambda = rand( 1000 ) .* 10.0;
77-
gen( x, k, lambda, "large_shape.json" );
78-
79-
# Large rate parameter:
80-
x = rand( 1000 ) .* 5.0;
81-
k = round.( Int64, rand( 1000 ) .* 10.0 );
82-
lambda = ( rand( 1000 ) .* 10.0 ) .+ 10.0;
83-
gen( x, k, lambda, "large_rate.json" );
84-
85-
# Both large:
86-
x = rand( 1000 ) .* 5.0;
87-
k = round.( Int64, ( rand( 1000 ) .* 20.0 ) .+ 10.0 );
88-
lambda = ( rand( 1000 ) .* 20.0 ) .+ 10.0;
89-
gen( x, k, lambda, "both_large.json" );
73+
# Generate fixtures:
74+
x = rand( 1500 ) .* 5.0;
75+
k = round.( Int64, ( rand( 1500 ) .* 10.0 ) .+ 10.0 );
76+
lambda = rand( 1500 ) .* 10.0;
77+
gen( x, k, lambda, "data.json" );

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

Lines changed: 9 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2018 The Stdlib Authors.
4+
* Copyright (c) 2026 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -22,18 +22,15 @@
2222

2323
var tape = require( 'tape' );
2424
var isnan = require( '@stdlib/math/base/assert/is-nan' );
25-
var abs = require( '@stdlib/math/base/special/abs' );
25+
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
2626
var PINF = require( '@stdlib/constants/float64/pinf' );
2727
var NINF = require( '@stdlib/constants/float64/ninf' );
28-
var EPS = require( '@stdlib/constants/float64/eps' );
2928
var cdf = require( './../lib' );
3029

3130

3231
// FIXTURES //
3332

34-
var largeShape = require( './fixtures/julia/large_shape.json' );
35-
var largeRate = require( './fixtures/julia/large_rate.json' );
36-
var bothLarge = require( './fixtures/julia/both_large.json' );
33+
var data = require( './fixtures/julia/data.json' );
3734

3835

3936
// TESTS //
@@ -114,82 +111,24 @@ tape( 'if provided a negative `lambda`, the function returns `NaN`', function te
114111
t.end();
115112
});
116113

117-
tape( 'the function evaluates the cdf for `x` given large `k` and `lambda`', function test( t ) {
114+
tape( 'the function evaluates the cdf for `x` given parameters `k` and `lambda`', function test( t ) {
118115
var expected;
119116
var lambda;
120-
var delta;
121-
var tol;
122117
var i;
123118
var k;
124119
var x;
125120
var y;
126121

127-
expected = bothLarge.expected;
128-
x = bothLarge.x;
129-
k = bothLarge.k;
130-
lambda = bothLarge.lambda;
122+
expected = data.expected;
123+
x = data.x;
124+
k = data.k;
125+
lambda = data.lambda;
131126
for ( i = 0; i < x.length; i++ ) {
132127
y = cdf( x[i], k[i], lambda[i] );
133128
if ( y === expected[i] ) {
134129
t.strictEqual( y, expected[i], 'x: '+x[i]+', k:'+k[i]+', lambda: '+lambda[i]+', y: '+y+', expected: '+expected[i] );
135130
} else {
136-
delta = abs( y - expected[ i ] );
137-
tol = 180.0 * EPS * abs( expected[ i ] );
138-
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. k: '+k[i]+'. lambda: '+lambda[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
139-
}
140-
}
141-
t.end();
142-
});
143-
144-
tape( 'the function evaluates the cdf for `x` given large shape parameter `k`', function test( t ) {
145-
var expected;
146-
var lambda;
147-
var delta;
148-
var tol;
149-
var i;
150-
var k;
151-
var x;
152-
var y;
153-
154-
expected = largeShape.expected;
155-
x = largeShape.x;
156-
k = largeShape.k;
157-
lambda = largeShape.lambda;
158-
for ( i = 0; i < x.length; i++ ) {
159-
y = cdf( x[i], k[i], lambda[i] );
160-
if ( y === expected[i] ) {
161-
t.strictEqual( y, expected[i], 'x: '+x[i]+', k:'+k[i]+', lambda: '+lambda[i]+', y: '+y+', expected: '+expected[i] );
162-
} else {
163-
delta = abs( y - expected[ i ] );
164-
tol = 100.0 * EPS * abs( expected[ i ] );
165-
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. k: '+k[i]+'. lambda: '+lambda[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
166-
}
167-
}
168-
t.end();
169-
});
170-
171-
tape( 'the function evaluates the cdf for `x` given large rate parameter `lambda`', function test( t ) {
172-
var expected;
173-
var lambda;
174-
var delta;
175-
var tol;
176-
var i;
177-
var k;
178-
var x;
179-
var y;
180-
181-
expected = largeRate.expected;
182-
x = largeRate.x;
183-
k = largeRate.k;
184-
lambda = largeRate.lambda;
185-
for ( i = 0; i < x.length; i++ ) {
186-
y = cdf( x[i], k[i], lambda[i] );
187-
if ( y === expected[i] ) {
188-
t.strictEqual( y, expected[i], 'x: '+x[i]+', k:'+k[i]+', lambda: '+lambda[i]+', y: '+y+', expected: '+expected[i] );
189-
} else {
190-
delta = abs( y - expected[ i ] );
191-
tol = 50.0 * EPS * abs( expected[ i ] );
192-
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. k: '+k[i]+'. lambda: '+lambda[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
131+
t.ok( isAlmostSameValue( y, expected[i], 1500 ), 'within tolerance. x: '+x[ i ]+'. k: '+k[i]+'. lambda: '+lambda[i]+'. y: '+y+'. E: '+expected[ i ]+'.' );
193132
}
194133
}
195134
t.end();

lib/node_modules/@stdlib/stats/base/dists/erlang/cdf/test/test.factory.js

Lines changed: 8 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,15 @@
2222

2323
var tape = require( 'tape' );
2424
var isnan = require( '@stdlib/math/base/assert/is-nan' );
25-
var abs = require( '@stdlib/math/base/special/abs' );
25+
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
2626
var PINF = require( '@stdlib/constants/float64/pinf' );
2727
var NINF = require( '@stdlib/constants/float64/ninf' );
28-
var EPS = require( '@stdlib/constants/float64/eps' );
2928
var factory = require( './../lib/factory.js' );
3029

3130

3231
// FIXTURES //
3332

34-
var largeShape = require( './fixtures/julia/large_shape.json' );
35-
var largeRate = require( './fixtures/julia/large_rate.json' );
36-
var bothLarge = require( './fixtures/julia/both_large.json' );
33+
var data = require( './fixtures/julia/data.json' );
3734

3835

3936
// TESTS //
@@ -161,88 +158,26 @@ tape( 'if provided a negative `k`, the created function always returns `NaN`', f
161158
t.end();
162159
});
163160

164-
tape( 'the created function evaluates the cdf for `x` given large `k` and `lambda`', function test( t ) {
161+
tape( 'the created function evaluates the cdf for `x` given parameters `k` and `lambda`', function test( t ) {
165162
var expected;
166163
var lambda;
167-
var delta;
168164
var cdf;
169-
var tol;
170165
var i;
171166
var k;
172167
var x;
173168
var y;
174169

175-
expected = bothLarge.expected;
176-
x = bothLarge.x;
177-
k = bothLarge.k;
178-
lambda = bothLarge.lambda;
170+
expected = data.expected;
171+
x = data.x;
172+
k = data.k;
173+
lambda = data.lambda;
179174
for ( i = 0; i < x.length; i++ ) {
180175
cdf = factory( k[i], lambda[i] );
181176
y = cdf( x[i] );
182177
if ( y === expected[i] ) {
183178
t.strictEqual( y, expected[i], 'x: '+x[i]+', k:'+k[i]+', lambda: '+lambda[i]+', y: '+y+', expected: '+expected[i] );
184179
} else {
185-
delta = abs( y - expected[ i ] );
186-
tol = 180.0 * EPS * abs( expected[ i ] );
187-
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. k: '+k[i]+'. lambda: '+lambda[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
188-
}
189-
}
190-
t.end();
191-
});
192-
193-
tape( 'the created function evaluates the cdf for `x` given large shape parameter `k`', function test( t ) {
194-
var expected;
195-
var lambda;
196-
var delta;
197-
var cdf;
198-
var tol;
199-
var i;
200-
var k;
201-
var x;
202-
var y;
203-
204-
expected = largeShape.expected;
205-
x = largeShape.x;
206-
k = largeShape.k;
207-
lambda = largeShape.lambda;
208-
for ( i = 0; i < x.length; i++ ) {
209-
cdf = factory( k[i], lambda[i] );
210-
y = cdf( x[i] );
211-
if ( y === expected[i] ) {
212-
t.strictEqual( y, expected[i], 'x: '+x[i]+', k:'+k[i]+', lambda: '+lambda[i]+', y: '+y+', expected: '+expected[i] );
213-
} else {
214-
delta = abs( y - expected[ i ] );
215-
tol = 100.0 * EPS * abs( expected[ i ] );
216-
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. k: '+k[i]+'. lambda: '+lambda[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
217-
}
218-
}
219-
t.end();
220-
});
221-
222-
tape( 'the created function evaluates the cdf for `x` given large rate parameter `lambda`', function test( t ) {
223-
var expected;
224-
var lambda;
225-
var delta;
226-
var cdf;
227-
var tol;
228-
var i;
229-
var k;
230-
var x;
231-
var y;
232-
233-
expected = largeRate.expected;
234-
x = largeRate.x;
235-
k = largeRate.k;
236-
lambda = largeRate.lambda;
237-
for ( i = 0; i < x.length; i++ ) {
238-
cdf = factory( k[i], lambda[i] );
239-
y = cdf( x[i] );
240-
if ( y === expected[i] ) {
241-
t.strictEqual( y, expected[i], 'x: '+x[i]+', k:'+k[i]+', lambda: '+lambda[i]+', y: '+y+', expected: '+expected[i] );
242-
} else {
243-
delta = abs( y - expected[ i ] );
244-
tol = 50.0 * EPS * abs( expected[ i ] );
245-
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. k: '+k[i]+'. lambda: '+lambda[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
180+
t.ok( isAlmostSameValue( y, expected[i], 1500 ), 'within tolerance. x: '+x[ i ]+'. k: '+k[i]+'. lambda: '+lambda[i]+'. y: '+y+'. E: '+expected[ i ]+'.' );
246181
}
247182
}
248183
t.end();

0 commit comments

Comments
 (0)