Skip to content

Commit fb07e54

Browse files
committed
chore: clean-up
--- 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: passed - task: lint_package_json status: na - task: lint_repl_help status: passed - 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: 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 056ece8 commit fb07e54

File tree

10 files changed

+40
-39
lines changed

10 files changed

+40
-39
lines changed

lib/node_modules/@stdlib/stats/base/dists/wald/pdf/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ limitations under the License.
2626

2727
The [probability density function][pdf] (PDF) for a [Wald][wald-distribution] random variable is
2828

29-
<!-- <equation class="equation" label="eq:wald_pdf" align="center" raw="f(x;\mu,\lambda)=\sqrt{\frac{\lambda}{2\pi x^3}}\, e^{-\frac{\lambda(x-\mu)^2}{2\mu^2 x}}" alt="Probability density function (PDF) for a Wald distribution."> -->
29+
<!-- <equation class="equation" label="eq:wald_pdf" align="center" raw="f(x;\mu,\lambda) = \sqrt{\frac{\lambda}{2\pi x^3}}\, e^{-\frac{\lambda(x-\mu)^2}{2\mu^2 x}}" alt="Probability density function (PDF) for a Wald distribution."> -->
3030

3131
```math
32-
f(x;\mu,\lambda)=\sqrt{\frac{\lambda}{2\pi x^3}}\, e^{-\frac{\lambda(x-\mu)^2}{2\mu^2 x}}
32+
f(x;\mu,\lambda) = \sqrt{\frac{\lambda}{2\pi x^3}}\, e^{-\frac{\lambda(x-\mu)^2}{2\mu^2 x}}
3333
```
3434

35-
<!-- <div class="equation" align="center" data-raw-text="f(x;\mu,\lambda)=\sqrt{\frac{\lambda}{2\pi x^3}}\, e^{-\frac{\lambda(x-\mu)^2}{2\mu^2 x}}" data-equation="eq:wald_pdf">
35+
<!-- <div class="equation" align="center" data-raw-text="f(x;\mu,\lambda) = \sqrt{\frac{\lambda}{2\pi x^3}}\, e^{-\frac{\lambda(x-\mu)^2}{2\mu^2 x}}" data-equation="eq:wald_pdf">
3636
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@51534079fef45e990850102147e8945fb023d1d0/lib/node_modules/@stdlib/stats/base/dists/wald/pdf/docs/img/equation_wald_pdf.svg" alt="Probability density function (PDF) for a Wald distribution.">
3737
<br>
3838
</div> -->
@@ -117,7 +117,7 @@ y = pdf( -1.0, 1.0, 1.0 );
117117

118118
#### pdf.factory( mu, lambda )
119119

120-
Partially applies `mu` and `lambda` to create a reusable `function` for evaluating the PDF.
120+
Partially applies `mu` and `lambda` to create a reusable function for evaluating the PDF.
121121

122122
```javascript
123123
var mypdf = pdf.factory( 1.0, 1.0 );

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

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench' );
24-
var runiform = require( '@stdlib/random/array/uniform' );
25-
var uniform = require( '@stdlib/random/base/uniform' );
24+
var uniform = require( '@stdlib/random/array/uniform' );
2625
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2726
var EPS = require( '@stdlib/constants/float64/eps' );
2827
var format = require( '@stdlib/string/format' );
@@ -41,9 +40,9 @@ bench( pkg, function benchmark( b ) {
4140
var i;
4241

4342
len = 100;
44-
x = runiform( len, EPS, 100.0 );
45-
mu = runiform( len, EPS, 50.0 );
46-
lambda = runiform( len, EPS, 20.0 );
43+
x = uniform( len, EPS, 100.0 );
44+
mu = uniform( len, EPS, 50.0 );
45+
lambda = uniform( len, EPS, 20.0 );
4746

4847
b.tic();
4948
for ( i = 0; i < b.iterations; i++ ) {
@@ -61,21 +60,17 @@ bench( pkg, function benchmark( b ) {
6160
});
6261

6362
bench( format( '%s:factory', pkg ), function benchmark( b ) {
64-
var lambda;
6563
var mypdf;
66-
var mu;
6764
var x;
6865
var y;
6966
var i;
7067

71-
mu = 1.0;
72-
lambda = 1.5;
73-
mypdf = pdf.factory( mu, lambda );
68+
mypdf = pdf.factory( 1.0, 1.5 );
69+
x = uniform( 100, EPS, 10.0 );
7470

7571
b.tic();
7672
for ( i = 0; i < b.iterations; i++ ) {
77-
x = uniform( EPS, 10.0 );
78-
y = mypdf( x );
73+
y = mypdf( x[ i%100 ] );
7974
if ( isnan( y ) ) {
8075
b.fail( 'should not return NaN' );
8176
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench' );
25-
var runiform = require( '@stdlib/random/array/uniform' );
25+
var uniform = require( '@stdlib/random/array/uniform' );
2626
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2727
var tryRequire = require( '@stdlib/utils/try-require' );
2828
var EPS = require( '@stdlib/constants/float64/eps' );
@@ -49,9 +49,9 @@ bench( format( '%s::native', pkg ), opts, function benchmark( b ) {
4949
var i;
5050

5151
len = 100;
52-
x = runiform( len, EPS, 100.0 );
53-
mu = runiform( len, EPS, 50.0 );
54-
lambda = runiform( len, EPS, 20.0 );
52+
x = uniform( len, EPS, 100.0 );
53+
mu = uniform( len, EPS, 50.0 );
54+
lambda = uniform( len, EPS, 20.0 );
5555

5656
b.tic();
5757
for ( i = 0; i < b.iterations; i++ ) {

lib/node_modules/@stdlib/stats/base/dists/wald/pdf/docs/repl.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
{{alias}}( x, μ, λ )
23
Evaluates the probability density function (PDF) for a Wald distribution
34
with mean `μ` and shape parameter `λ` at a value `x`.

lib/node_modules/@stdlib/stats/base/dists/wald/pdf/lib/factory.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,15 @@ function factory( mu, lambda ) {
7575
* // returns <number>
7676
*/
7777
function pdf( x ) {
78+
var v;
7879
if ( isnan( x ) ) {
7980
return NaN;
8081
}
8182
if ( x <= 0.0 || !isFinite( x ) ) {
8283
return 0.0;
8384
}
84-
return A / ( x * sqrt(x) ) * exp( B * ( x - mu ) * ( x - mu ) / x );
85+
v = x - mu;
86+
return A / ( x * sqrt( x ) ) * exp( B * v * v / x );
8587
}
8688
}
8789

lib/node_modules/@stdlib/stats/base/dists/wald/pdf/lib/main.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ var isnan = require( '@stdlib/math/base/assert/is-nan' );
9292
function pdf( x, mu, lambda ) {
9393
var A;
9494
var B;
95-
95+
var v;
9696
if (
9797
isnan( x ) ||
9898
isnan( mu ) ||
@@ -110,7 +110,8 @@ function pdf( x, mu, lambda ) {
110110
}
111111
A = sqrt( lambda / TWO_PI );
112112
B = -lambda / ( 2.0 * mu * mu );
113-
return A / ( x * sqrt(x) ) * exp( B * ( x - mu ) * ( x - mu ) / x );
113+
v = x - mu;
114+
return A / ( x * sqrt( x ) ) * exp( B * v * v / x );
114115
}
115116

116117

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
double stdlib_base_dists_wald_pdf( const double x, const double mu, const double lambda ) {
4040
double A;
4141
double B;
42+
double v;
4243
if (
4344
stdlib_base_is_nan( x ) ||
4445
stdlib_base_is_nan( mu ) ||
@@ -56,5 +57,6 @@ double stdlib_base_dists_wald_pdf( const double x, const double mu, const double
5657
}
5758
A = stdlib_base_sqrt( lambda / STDLIB_CONSTANT_FLOAT64_TWO_PI );
5859
B = -lambda / ( 2.0 * mu * mu );
59-
return A / ( x * stdlib_base_sqrt(x) ) * stdlib_base_exp( B * ( x - mu ) * ( x - mu ) / x );
60+
v = x - mu;
61+
return A / ( x * stdlib_base_sqrt( x ) ) * stdlib_base_exp( B * v * v / x );
6062
}

lib/node_modules/@stdlib/stats/base/dists/wald/pdf/test/test.factory.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ tape( 'if `lambda` equals `0`, the created function evaluates a degenerate distr
200200
pdf = factory( 2.0, 0.0 );
201201

202202
y = pdf( 2.0 );
203-
t.strictEqual( y, PINF, 'returns +infinity for x equal to mu' );
203+
t.strictEqual( y, PINF, 'returns expected value' );
204204

205205
y = pdf( 1.0 );
206206
t.strictEqual( y, 0.0, 'returns expected value' );
@@ -224,18 +224,18 @@ tape( 'if provided a non-positive `x`, the created function returns `0` (outside
224224
pdf = factory( 1.0, 1.0 );
225225

226226
y = pdf( 0.0 );
227-
t.strictEqual( y, 0.0, 'returns 0 for x=0' );
227+
t.strictEqual( y, 0.0, 'returns expected value' );
228228

229229
y = pdf( -1.0 );
230-
t.strictEqual( y, 0.0, 'returns 0 for negative x' );
230+
t.strictEqual( y, 0.0, 'returns expected value' );
231231

232232
pdf = factory( 2.0, 3.0 );
233233
y = pdf( -10.0 );
234-
t.strictEqual( y, 0.0, 'returns 0 for negative x' );
234+
t.strictEqual( y, 0.0, 'returns expected value' );
235235

236236
pdf = factory( 1.0, 1.0 );
237237
y = pdf( NINF );
238-
t.strictEqual( y, 0.0, 'returns 0 for -infinity' );
238+
t.strictEqual( y, 0.0, 'returns expected value' );
239239

240240
t.end();
241241
});

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ tape( 'if provided `lambda` equals `0`, the function evaluates a degenerate dist
168168
var y;
169169

170170
y = pdf( 2.0, 2.0, 0.0 );
171-
t.strictEqual( y, PINF, 'returns +infinity for x equal to mu' );
171+
t.strictEqual( y, PINF, 'returns expected value' );
172172

173173
y = pdf( 1.0, 2.0, 0.0 );
174174
t.strictEqual( y, 0.0, 'returns expected value' );
@@ -189,16 +189,16 @@ tape( 'if provided a non-positive `x`, the function returns `0` (outside support
189189
var y;
190190

191191
y = pdf( 0.0, 1.0, 1.0 );
192-
t.strictEqual( y, 0.0, 'returns 0 for x=0' );
192+
t.strictEqual( y, 0.0, 'returns expected value' );
193193

194194
y = pdf( -1.0, 1.0, 1.0 );
195-
t.strictEqual( y, 0.0, 'returns 0 for negative x' );
195+
t.strictEqual( y, 0.0, 'returns expected value' );
196196

197197
y = pdf( -10.0, 2.0, 3.0 );
198-
t.strictEqual( y, 0.0, 'returns 0 for negative x' );
198+
t.strictEqual( y, 0.0, 'returns expected value' );
199199

200200
y = pdf( NINF, 1.0, 1.0 );
201-
t.strictEqual( y, 0.0, 'returns 0 for -infinity' );
201+
t.strictEqual( y, 0.0, 'returns expected value' );
202202

203203
t.end();
204204
});

lib/node_modules/@stdlib/stats/base/dists/wald/pdf/test/test.pdf.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ tape( 'if provided `lambda` equals `0`, the function evaluates a degenerate dist
159159
var y;
160160

161161
y = pdf( 2.0, 2.0, 0.0 );
162-
t.strictEqual( y, PINF, 'returns +infinity for x equal to mu' );
162+
t.strictEqual( y, PINF, 'returns expected value' );
163163

164164
y = pdf( 1.0, 2.0, 0.0 );
165165
t.strictEqual( y, 0.0, 'returns expected value' );
@@ -180,16 +180,16 @@ tape( 'if provided a non-positive `x`, the function returns `0` (outside support
180180
var y;
181181

182182
y = pdf( 0.0, 1.0, 1.0 );
183-
t.strictEqual( y, 0.0, 'returns 0 for x=0' );
183+
t.strictEqual( y, 0.0, 'returns expected value' );
184184

185185
y = pdf( -1.0, 1.0, 1.0 );
186-
t.strictEqual( y, 0.0, 'returns 0 for negative x' );
186+
t.strictEqual( y, 0.0, 'returns expected value' );
187187

188188
y = pdf( -10.0, 2.0, 3.0 );
189-
t.strictEqual( y, 0.0, 'returns 0 for negative x' );
189+
t.strictEqual( y, 0.0, 'returns expected value' );
190190

191191
y = pdf( NINF, 1.0, 1.0 );
192-
t.strictEqual( y, 0.0, 'returns 0 for -infinity' );
192+
t.strictEqual( y, 0.0, 'returns expected value' );
193193

194194
t.end();
195195
});

0 commit comments

Comments
 (0)