Skip to content

Commit 94cca50

Browse files
committed
chore: address commit comments for halfnormal logpdf
1 parent 2840211 commit 94cca50

File tree

3 files changed

+16
-25
lines changed

3 files changed

+16
-25
lines changed

lib/node_modules/@stdlib/stats/base/dists/halfnormal/logpdf/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020

2121
# Logarithm of Probability Density Function
2222

23-
> [Half-Normal][half-normal-distribution] distribution logarithm of [probability density function (PDF)][pdf].
23+
> [half-normal][half-normal-distribution] distribution logarithm of [probability density function (PDF)][pdf].
2424
2525
<section class="intro">
2626

@@ -175,7 +175,7 @@ logEachMap( 'x: %0.4f, σ: %0.4f, ln(f(x;σ)): %0.4f', x, sigma, logpdf );
175175

176176
#### stdlib_base_dists_halfnormal_logpdf( x, sigma )
177177

178-
Evaluates the logarithm of the [probability density function][pdf] (PDF) for a [Half-Normal][half-normal-distribution] distribution with parameter `sigma` (scale parameter).
178+
Evaluates the logarithm of the [probability density function][pdf] (PDF) for a [half-normal][half-normal-distribution] distribution with parameter `sigma` (scale parameter).
179179

180180
```c
181181
double out = stdlib_base_dists_halfnormal_logpdf( 0.8, 1.0 );

lib/node_modules/@stdlib/stats/base/dists/halfnormal/logpdf/benchmark/benchmark.js

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench' );
24-
var Float64Array = require( '@stdlib/array/float64' );
25-
var uniform = require( '@stdlib/random/base/uniform' );
26-
var format = require( '@stdlib/string/format' );
24+
var uniform = require( '@stdlib/random/array/uniform' );
2725
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2826
var EPS = require( '@stdlib/constants/float64/eps' );
27+
var format = require( '@stdlib/string/format' );
2928
var pkg = require( './../package.json' ).name;
3029
var logpdf = require( './../lib' );
3130

@@ -40,12 +39,8 @@ bench( pkg, function benchmark( b ) {
4039
var i;
4140

4241
len = 100;
43-
x = new Float64Array( len );
44-
sigma = new Float64Array( len );
45-
for ( i = 0; i < len; i++ ) {
46-
x[ i ] = uniform( 0.0, 10.0 );
47-
sigma[ i ] = uniform( EPS, 10.0 );
48-
}
42+
x = uniform( len, 0.0, 10.0 );
43+
sigma = uniform( len, EPS, 10.0 );
4944

5045
b.tic();
5146
for ( i = 0; i < b.iterations; i++ ) {
@@ -73,10 +68,7 @@ bench( format( '%s:factory', pkg ), function benchmark( b ) {
7368
sigma = 4.0;
7469
mylogpdf = logpdf.factory( sigma );
7570
len = 100;
76-
x = new Float64Array( len );
77-
for ( i = 0; i < len; i++ ) {
78-
x[ i ] = uniform( 0.0, 20.0 );
79-
}
71+
x = uniform( len, 0.0, 20.0 );
8072

8173
b.tic();
8274
for ( i = 0; i < b.iterations; i++ ) {

lib/node_modules/@stdlib/stats/base/dists/halfnormal/logpdf/benchmark/benchmark.native.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,11 @@
2222

2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench' );
25-
var format = require( '@stdlib/string/format' );
26-
var Float64Array = require( '@stdlib/array/float64' );
27-
var randu = require( '@stdlib/random/base/randu' );
25+
var uniform = require( '@stdlib/random/array/uniform' );
2826
var isnan = require( '@stdlib/math/base/assert/is-nan' );
29-
var EPS = require( '@stdlib/constants/float64/eps' );
3027
var tryRequire = require( '@stdlib/utils/try-require' );
28+
var EPS = require( '@stdlib/constants/float64/eps' );
29+
var format = require( '@stdlib/string/format' );
3130
var pkg = require( './../package.json' ).name;
3231

3332

@@ -43,18 +42,18 @@ var opts = {
4342

4443
bench( format( '%s::native', pkg ), opts, function benchmark( b ) {
4544
var sigma;
45+
var uopts;
4646
var len;
4747
var x;
4848
var y;
4949
var i;
5050

5151
len = 100;
52-
sigma = new Float64Array( len );
53-
x = new Float64Array( len );
54-
for ( i = 0; i < len; i++ ) {
55-
x[ i ] = randu() * 10.0;
56-
sigma[ i ] = ( randu() * 10.0 ) + EPS;
57-
}
52+
uopts = {
53+
'dtype': 'float64'
54+
};
55+
x = uniform( len, 0.0, 10.0, uopts );
56+
sigma = uniform( len, EPS, 10.0, uopts );
5857

5958
b.tic();
6059
for ( i = 0; i < b.iterations; i++ ) {

0 commit comments

Comments
 (0)