-
-
Notifications
You must be signed in to change notification settings - Fork 588
Commit
…base/snanmin` PR-URL: #4292 Reviewed-by: Philipp Burckhardt <pburckhardt@outlook.com>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,16 +21,29 @@ | |
// MODULES // | ||
|
||
var bench = require( '@stdlib/bench' ); | ||
var randu = require( '@stdlib/random/base/randu' ); | ||
var uniform = require( '@stdlib/random/base/uniform' ); | ||
var bernoulli = require( '@stdlib/random/base/bernoulli' ); | ||
var filledarrayBy = require( '@stdlib/array/filled-by' ); | ||
var isnan = require( '@stdlib/math/base/assert/is-nan' ); | ||
var pow = require( '@stdlib/math/base/special/pow' ); | ||
var Float32Array = require( '@stdlib/array/float32' ); | ||
var pkg = require( './../package.json' ).name; | ||
var snanmin = require( './../lib/snanmin.js' ); | ||
|
||
|
||
// FUNCTIONS // | ||
|
||
/** | ||
* Returns a random value or `NaN`. | ||
* | ||
* @returns {number} random number or `NaN` | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Planeshifter
Member
|
||
*/ | ||
function rand() { | ||
if ( bernoulli( 0.2 ) ) { | ||
return NaN; | ||
} | ||
return uniform( -10.0, 10.0 ); | ||
} | ||
|
||
/** | ||
* Creates a benchmark function. | ||
* | ||
|
@@ -39,17 +52,7 @@ var snanmin = require( './../lib/snanmin.js' ); | |
* @returns {Function} benchmark function | ||
*/ | ||
function createBenchmark( len ) { | ||
var x; | ||
var i; | ||
|
||
x = new Float32Array( len ); | ||
for ( i = 0; i < x.length; i++ ) { | ||
if ( randu() < 0.2 ) { | ||
x[ i ] = NaN; | ||
} else { | ||
x[ i ] = ( randu()*20.0 ) - 10.0; | ||
} | ||
} | ||
var x = filledarrayBy( len, 'float32', rand ); | ||
return benchmark; | ||
|
||
function benchmark( b ) { | ||
|
1 comment
on commit 9f86bc6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage Report
Package | Statements | Branches | Functions | Lines |
---|---|---|---|---|
stats/base/snanmin |
|
|
|
|
The above coverage report was generated for the changes in this push.
@Planeshifter Didn't you want
@private
annotations added to these functions in this PR?