Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ limitations under the License.

# Logarithm of Probability Density Function

> [Half-Normal][half-normal-distribution] distribution logarithm of [probability density function (PDF)][pdf].
> [half-normal][half-normal-distribution] distribution logarithm of [probability density function (PDF)][pdf].

<section class="intro">

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

#### stdlib_base_dists_halfnormal_logpdf( x, sigma )

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

```c
double out = stdlib_base_dists_halfnormal_logpdf( 0.8, 1.0 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@
// MODULES //

var bench = require( '@stdlib/bench' );
var Float64Array = require( '@stdlib/array/float64' );
var uniform = require( '@stdlib/random/base/uniform' );
var format = require( '@stdlib/string/format' );
var uniform = require( '@stdlib/random/array/uniform' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var EPS = require( '@stdlib/constants/float64/eps' );
var format = require( '@stdlib/string/format' );
var pkg = require( './../package.json' ).name;
var logpdf = require( './../lib' );

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

len = 100;
x = new Float64Array( len );
sigma = new Float64Array( len );
for ( i = 0; i < len; i++ ) {
x[ i ] = uniform( 0.0, 10.0 );
sigma[ i ] = uniform( EPS, 10.0 );
}
x = uniform( len, 0.0, 10.0 );
sigma = uniform( len, EPS, 10.0 );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
Expand Down Expand Up @@ -73,10 +68,7 @@ bench( format( '%s:factory', pkg ), function benchmark( b ) {
sigma = 4.0;
mylogpdf = logpdf.factory( sigma );
len = 100;
x = new Float64Array( len );
for ( i = 0; i < len; i++ ) {
x[ i ] = uniform( 0.0, 20.0 );
}
x = uniform( len, 0.0, 20.0 );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@

var resolve = require( 'path' ).resolve;
var bench = require( '@stdlib/bench' );
var format = require( '@stdlib/string/format' );
var Float64Array = require( '@stdlib/array/float64' );
var randu = require( '@stdlib/random/base/randu' );
var uniform = require( '@stdlib/random/array/uniform' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var EPS = require( '@stdlib/constants/float64/eps' );
var tryRequire = require( '@stdlib/utils/try-require' );
var EPS = require( '@stdlib/constants/float64/eps' );
var format = require( '@stdlib/string/format' );
var pkg = require( './../package.json' ).name;


Expand All @@ -43,18 +42,18 @@ var opts = {

bench( format( '%s::native', pkg ), opts, function benchmark( b ) {
var sigma;
var uopts;
var len;
var x;
var y;
var i;

len = 100;
sigma = new Float64Array( len );
x = new Float64Array( len );
for ( i = 0; i < len; i++ ) {
x[ i ] = randu() * 10.0;
sigma[ i ] = ( randu() * 10.0 ) + EPS;
}
uopts = {
'dtype': 'float64'
};
x = uniform( len, 0.0, 10.0, uopts );
sigma = uniform( len, EPS, 10.0, uopts );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
Expand Down