Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -45,9 +45,7 @@ var options = {
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var x;

x = uniform( len, -10, 10, options );
var x = uniform( len, -10, 10, options );
return benchmark;

function benchmark( b ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ var options = {
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var x;

x = uniform( len, -10, 10, options );
var x = uniform( len, -10, 10, options );
return benchmark;

function benchmark( b ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ var options = {
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var x;

x = uniform( len, -10, 10, options );
var x = uniform( len, -10, 10, options );
return benchmark;

function benchmark( b ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ var options = {
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var x;

x = uniform( len, -10, 10, options );
var x = uniform( len, -10, 10, options );
return benchmark;

function benchmark( b ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
var svarianceyc = require( './../lib' );

var x;

x = discreteUniform( 10, -50, 50, {
var x = discreteUniform( 10, -50, 50, {
'dtype': 'float32'
});
console.log( x );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extern "C" {
float API_SUFFIX(stdlib_strided_svarianceyc)( const CBLAS_INT N, const float correction, const float *X, const CBLAS_INT strideX );

/**
* Computes the variance of a single-precision floating-point strided array using a one-pass algorithm proposed by Youngs and Cramer, using alternative indexing semantics.
* Computes the variance of a single-precision floating-point strided array using a one-pass algorithm proposed by Youngs and Cramer and alternative indexing semantics.
*/
float API_SUFFIX(stdlib_strided_svarianceyc_ndarray)( const CBLAS_INT N, const float correction, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );

Expand Down
8 changes: 4 additions & 4 deletions lib/node_modules/@stdlib/stats/base/svarianceyc/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ float API_SUFFIX(stdlib_strided_svarianceyc)( const CBLAS_INT N, const float cor


/**
* Computes the variance of a single-precision floating-point strided array using a one-pass algorithm proposed by Youngs and Cramer, using alternative indexing semantics.
* Computes the variance of a single-precision floating-point strided array using a one-pass algorithm proposed by Youngs and Cramer and alternative indexing semantics.
*
* @param N number of indexed elements
* @param correction degrees of freedom adjustment
Expand All @@ -65,7 +65,7 @@ float API_SUFFIX(stdlib_strided_svarianceyc_ndarray)( const CBLAS_INT N, const f

n = (double)N - (double)correction;
if ( N <= 0 || n <= 0.0f ) {
return 0.0f / 0.0f; // Nan
return 0.0f / 0.0f; // NaN
}
if ( N ==1 || strideX == 0 ) {
return 0.0f;
Expand All @@ -78,8 +78,8 @@ float API_SUFFIX(stdlib_strided_svarianceyc_ndarray)( const CBLAS_INT N, const f
di = (double)i;
v = X[ ix ];
sum += v;
d = (float)(di*(double)v) - sum;
S += (float)(1.0/(di*(di-1.0))) * d * d;
d = (float)( di * (double)v ) - sum;
S += (float)( 1.0 / ( di * ( di-1.0 ) ) ) * d * d;
ix += strideX;
}
return (double)S / n;
Expand Down
Loading