Skip to content

Commit afe2d2b

Browse files
committed
fix: address review issues in stats/base/dists/levy/pdf C implementation
--- 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: na - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 1c5083b commit afe2d2b

File tree

7 files changed

+97
-99
lines changed

7 files changed

+97
-99
lines changed

lib/node_modules/@stdlib/stats/base/dists/levy/pdf/benchmark/benchmark.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ var bench = require( '@stdlib/bench' );
2424
var Float64Array = require( '@stdlib/array/float64' );
2525
var uniform = require( '@stdlib/random/base/uniform' );
2626
var isnan = require( '@stdlib/math/base/assert/is-nan' );
27-
var Float64Array = require( '@stdlib/array/float64' );
2827
var EPS = require( '@stdlib/constants/float64/eps' );
2928
var pkg = require( './../package.json' ).name;
3029
var pdf = require( './../lib' );

lib/node_modules/@stdlib/stats/base/dists/levy/pdf/benchmark/benchmark.native.js

Lines changed: 4 additions & 4 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 EPS = require( '@stdlib/constants/float64/eps' );
2828
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2929
var tryRequire = require( '@stdlib/utils/try-require' );
@@ -53,9 +53,9 @@ bench( pkg+'::native', opts, function benchmark( b ) {
5353
x = new Float64Array( len );
5454
c = new Float64Array( len );
5555
for ( i = 0; i < len; i++ ) {
56-
mu[ i ] = ( randu() * 20.0 ) - 10.0;
57-
x[ i ] = ( randu() * 40.0 ) - mu[ i ];
58-
c[ i ] = ( randu() * 5.0 ) + EPS;
56+
mu[ i ] = uniform( -10.0, 10.0 );
57+
x[ i ] = uniform( 0.0, 40.0 ) + mu[ i ];
58+
c[ i ] = uniform( EPS, 5.0 + EPS );
5959
}
6060

6161
b.tic();

lib/node_modules/@stdlib/stats/base/dists/levy/pdf/include/stdlib/stats/base/dists/levy/pdf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extern "C" {
2727
#endif
2828

2929
/**
30-
* Returns a probability density function (PDF) for a Lévy distribution with location `mu` and scale `c`.
30+
* Evaluates the probability density function (PDF) for a Lévy distribution.
3131
*/
3232
double stdlib_base_dists_levy_pdf( const double x, const double mu, const double c );
3333

lib/node_modules/@stdlib/stats/base/dists/levy/pdf/lib/native.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ var addon = require( './../src/addon.node' );
2626
// MAIN //
2727

2828
/**
29-
* Return a function for evaluating the probability density function (PDF) for a Lévy distribution with location parameter `mu` and scale parameter `c`.
29+
* Evaluates the probability density function (PDF) for a Lévy distribution with location parameter `mu` and scale parameter `c` at a value `x`.
3030
*
3131
* @private
3232
* @param {number} x - input value
3333
* @param {number} mu - location parameter
3434
* @param {PositiveNumber} c - scale parameter
35-
* @returns {PositiveNumber} standard deviation
35+
* @returns {number} evaluated PDF
3636
*
3737
* @example
3838
* var y = pdf( 2.0, 0.0, 1.0 );
Lines changed: 87 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,90 @@
11
{
2-
"options": {
2+
"options": {
3+
"task": "build",
4+
"wasm": false
5+
},
6+
"fields": [
7+
{
8+
"field": "src",
9+
"resolve": true,
10+
"relative": true
11+
},
12+
{
13+
"field": "include",
14+
"resolve": true,
15+
"relative": true
16+
},
17+
{
18+
"field": "libraries",
19+
"resolve": false,
20+
"relative": false
21+
},
22+
{
23+
"field": "libpath",
24+
"resolve": true,
25+
"relative": false
26+
}
27+
],
28+
"confs": [
29+
{
330
"task": "build",
4-
"wasm": false
31+
"wasm": false,
32+
"src": [
33+
"./src/main.c"
34+
],
35+
"include": [
36+
"./include"
37+
],
38+
"libraries": [],
39+
"libpath": [],
40+
"dependencies": [
41+
"@stdlib/math/base/napi/ternary",
42+
"@stdlib/math/base/assert/is-nan",
43+
"@stdlib/math/base/special/sqrt",
44+
"@stdlib/math/base/special/exp",
45+
"@stdlib/math/base/special/pow",
46+
"@stdlib/constants/float64/two-pi"
47+
]
48+
},
49+
{
50+
"task": "benchmark",
51+
"wasm": false,
52+
"src": [
53+
"./src/main.c"
54+
],
55+
"include": [
56+
"./include"
57+
],
58+
"libraries": [],
59+
"libpath": [],
60+
"dependencies": [
61+
"@stdlib/constants/float64/eps",
62+
"@stdlib/math/base/assert/is-nan",
63+
"@stdlib/math/base/special/sqrt",
64+
"@stdlib/math/base/special/exp",
65+
"@stdlib/math/base/special/pow",
66+
"@stdlib/constants/float64/two-pi"
67+
]
568
},
6-
"fields": [
7-
{
8-
"field": "src",
9-
"resolve": true,
10-
"relative": true
11-
},
12-
{
13-
"field": "include",
14-
"resolve": true,
15-
"relative": true
16-
},
17-
{
18-
"field": "libraries",
19-
"resolve": false,
20-
"relative": false
21-
},
22-
{
23-
"field": "libpath",
24-
"resolve": true,
25-
"relative": false
26-
}
27-
],
28-
"confs": [
29-
{
30-
"task": "build",
31-
"wasm": false,
32-
"src": [
33-
"./src/main.c"
34-
],
35-
"include": [
36-
"./include"
37-
],
38-
"libraries": [],
39-
"libpath": [],
40-
"dependencies": [
41-
"@stdlib/math/base/napi/ternary",
42-
"@stdlib/math/base/assert/is-nan",
43-
"@stdlib/math/base/special/sqrt",
44-
"@stdlib/math/base/special/exp",
45-
"@stdlib/math/base/special/pow",
46-
"@stdlib/constants/float64/two-pi"
47-
]
48-
},
49-
{
50-
"task": "benchmark",
51-
"wasm": false,
52-
"src": [
53-
"./src/main.c"
54-
],
55-
"include": [
56-
"./include"
57-
],
58-
"libraries": [],
59-
"libpath": [],
60-
"dependencies": [
61-
"@stdlib/constants/float64/eps",
62-
"@stdlib/math/base/assert/is-nan",
63-
"@stdlib/math/base/special/sqrt",
64-
"@stdlib/math/base/special/exp",
65-
"@stdlib/math/base/special/pow",
66-
"@stdlib/constants/float64/two-pi"
67-
]
68-
},
69-
{
70-
"task": "examples",
71-
"wasm": false,
72-
"src": [
73-
"./src/main.c"
74-
],
75-
"include": [
76-
"./include"
77-
],
78-
"libraries": [],
79-
"libpath": [],
80-
"dependencies": [
81-
"@stdlib/constants/float64/eps",
82-
"@stdlib/math/base/assert/is-nan",
83-
"@stdlib/math/base/special/sqrt",
84-
"@stdlib/math/base/special/exp",
85-
"@stdlib/math/base/special/pow",
86-
"@stdlib/constants/float64/two-pi"
87-
]
88-
}
89-
]
90-
}
69+
{
70+
"task": "examples",
71+
"wasm": false,
72+
"src": [
73+
"./src/main.c"
74+
],
75+
"include": [
76+
"./include"
77+
],
78+
"libraries": [],
79+
"libpath": [],
80+
"dependencies": [
81+
"@stdlib/constants/float64/eps",
82+
"@stdlib/math/base/assert/is-nan",
83+
"@stdlib/math/base/special/sqrt",
84+
"@stdlib/math/base/special/exp",
85+
"@stdlib/math/base/special/pow",
86+
"@stdlib/constants/float64/two-pi"
87+
]
88+
}
89+
]
90+
}

lib/node_modules/@stdlib/stats/base/dists/levy/pdf/src/addon.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@
1919
#include "stdlib/stats/base/dists/levy/pdf.h"
2020
#include "stdlib/math/base/napi/ternary.h"
2121

22-
// cppcheck-suppress shadowFunction
2322
STDLIB_MATH_BASE_NAPI_MODULE_DDD_D( stdlib_base_dists_levy_pdf )

lib/node_modules/@stdlib/stats/base/dists/levy/pdf/src/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
#include "stdlib/constants/float64/two_pi.h"
2525

2626
/**
27-
* Returns the standard deviation for a Lévy distribution with location `mu` and scale `c`.
27+
* Evaluates the probability density function (PDF) for a Lévy distribution with location parameter `mu` and scale parameter `c` at a value `x`.
2828
*
2929
* @param x input value
3030
* @param mu location parameter
3131
* @param c scale parameter
32-
* @return standard deviation
32+
* @return evaluated PDF
3333
*
3434
* @example
35-
* double y = stdlib_base_levy_pdf( 2.0, 0.0, 1.0 );
35+
* double y = stdlib_base_dists_levy_pdf( 2.0, 0.0, 1.0 );
3636
* // returns ~0.11
3737
*/
3838
double stdlib_base_dists_levy_pdf( const double x, const double mu, const double c ) {

0 commit comments

Comments
 (0)