Skip to content
Merged
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 @@ -45,8 +45,12 @@ static napi_value addon( napi_env env, napi_callback_info info ) {
assert( status == napi_ok );
return NULL;
}
// Create a const-qualified view of the argument pointer list:
const struct ndarray *arr[ 1 ] = {
arrays[ 0 ]
};
// Perform computation:
STDLIB_NAPI_CREATE_DOUBLE( env, stdlib_blas_ext_dnansum( arrays ), v );
STDLIB_NAPI_CREATE_DOUBLE( env, stdlib_blas_ext_dnansum( arr ), v );

// Free allocated memory:
stdlib_ndarray_free( arrays[ 0 ] );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ static napi_value addon( napi_env env, napi_callback_info info ) {
assert( status == napi_ok );
return NULL;
}
// Create a const-qualified view of the argument pointer list:
const struct ndarray *arr[ 1 ] = {
arrays[ 0 ]
};
// Perform computation:
STDLIB_NAPI_CREATE_DOUBLE( env, stdlib_blas_ext_dsum( arrays ), v );
STDLIB_NAPI_CREATE_DOUBLE( env, stdlib_blas_ext_dsum( arr ), v );

// Free allocated memory:
stdlib_ndarray_free( arrays[ 0 ] );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ static napi_value addon( napi_env env, napi_callback_info info ) {
assert( status == napi_ok );
return NULL;
}
// Create a const-qualified view of the argument pointer list:
const struct ndarray *arr[ 1 ] = {
arrays[ 0 ]
};
// Perform computation:
STDLIB_NAPI_CREATE_DOUBLE( env, (double)stdlib_blas_ext_snansum( arrays ), v );
STDLIB_NAPI_CREATE_DOUBLE( env, (double)stdlib_blas_ext_snansum( arr ), v );

// Free allocated memory:
stdlib_ndarray_free( arrays[ 0 ] );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ static napi_value addon( napi_env env, napi_callback_info info ) {
assert( status == napi_ok );
return NULL;
}
// Create a const-qualified view of the argument pointer list:
const struct ndarray *arr[ 1 ] = {
arrays[ 0 ]
};
// Perform computation:
STDLIB_NAPI_CREATE_DOUBLE( env, (double)stdlib_blas_ext_ssum( arrays ), v );
STDLIB_NAPI_CREATE_DOUBLE( env, (double)stdlib_blas_ext_ssum( arr ), v );

// Free allocated memory:
stdlib_ndarray_free( arrays[ 0 ] );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,15 @@ static double rand_double( void ) {
* @return elapsed time in seconds
*/
static double benchmark1( int iterations, int len ) {
unsigned char mask[ len ];
unsigned char *mask;
double elapsed;
double x[ len ];
double *x;
double v;
double t;
int i;

x = (double *)malloc( len * sizeof( double ) );
mask = (unsigned char *)malloc( len * sizeof( unsigned char ) );
for ( i = 0; i < len; i++ ) {
if ( rand_double() < 0.2 ) {
mask[ i ] = 1; // missing
Expand All @@ -124,6 +126,8 @@ static double benchmark1( int iterations, int len ) {
if ( v != v ) {
printf( "should not return NaN\n" );
}
free( x );
free( mask );
return elapsed;
}

Expand All @@ -135,13 +139,15 @@ static double benchmark1( int iterations, int len ) {
* @return elapsed time in seconds
*/
static double benchmark2( int iterations, int len ) {
unsigned char mask[ len ];
unsigned char *mask;
double elapsed;
double x[ len ];
double *x;
double v;
double t;
int i;

x = (double *)malloc( len * sizeof( double ) );
mask = (unsigned char *)malloc( len * sizeof( unsigned char ) );
for ( i = 0; i < len; i++ ) {
if ( rand_double() < 0.2 ) {
mask[ i ] = 1; // missing
Expand All @@ -164,6 +170,8 @@ static double benchmark2( int iterations, int len ) {
if ( v != v ) {
printf( "should not return NaN\n" );
}
free( x );
free( mask );
return elapsed;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,15 @@ static double rand_double( void ) {
* @return elapsed time in seconds
*/
static double benchmark1( int iterations, int len ) {
unsigned char mask[ len ];
unsigned char *mask;
double elapsed;
double x[ len ];
double *x;
double v;
double t;
int i;

x = (double *)malloc( len * sizeof( double ) );
mask = (unsigned char *)malloc( len * sizeof( unsigned char ) );
for ( i = 0; i < len; i++ ) {
if ( rand_double() < 0.2 ) {
mask[ i ] = 1; // missing
Expand All @@ -124,6 +126,8 @@ static double benchmark1( int iterations, int len ) {
if ( v != v ) {
printf( "should not return NaN\n" );
}
free( x );
free( mask );
return elapsed;
}

Expand All @@ -135,13 +139,15 @@ static double benchmark1( int iterations, int len ) {
* @return elapsed time in seconds
*/
static double benchmark2( int iterations, int len ) {
unsigned char mask[ len ];
unsigned char *mask;
double elapsed;
double x[ len ];
double *x;
double v;
double t;
int i;

x = (double *)malloc( len * sizeof( double ) );
mask = (unsigned char *)malloc( len * sizeof( unsigned char ) );
for ( i = 0; i < len; i++ ) {
if ( rand_double() < 0.2 ) {
mask[ i ] = 1; // missing
Expand All @@ -164,6 +170,8 @@ static double benchmark2( int iterations, int len ) {
if ( v != v ) {
printf( "should not return NaN\n" );
}
free( x );
free( mask );
return elapsed;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,13 @@ static float rand_float( void ) {
*/
static double benchmark1( int iterations, int len ) {
double elapsed;
float x[ len ];
float y[ len ];
float *x;
float *y;
double t;
int i;

x = (float *)malloc( len * sizeof( float ) );
y = (float *)malloc( len * sizeof( float ) );
for ( i = 0; i < len; i++ ) {
x[ i ] = ( rand_float() * 20000.0f ) - 10000.0f;
y[ i ] = 0.0f;
Expand All @@ -118,6 +120,8 @@ static double benchmark1( int iterations, int len ) {
if ( y[ len-1 ] != y[ len-1 ] ) {
printf( "should not return NaN\n" );
}
free( x );
free( y );
return elapsed;
}

Expand All @@ -130,11 +134,13 @@ static double benchmark1( int iterations, int len ) {
*/
static double benchmark2( int iterations, int len ) {
double elapsed;
float x[ len ];
float y[ len ];
float *x;
float *y;
double t;
int i;

x = (float *)malloc( len * sizeof( float ) );
y = (float *)malloc( len * sizeof( float ) );
for ( i = 0; i < len; i++ ) {
x[ i ] = ( rand_float() * 20000.0f ) - 10000.0f;
y[ i ] = 0.0f;
Expand All @@ -152,6 +158,8 @@ static double benchmark2( int iterations, int len ) {
if ( y[ len-1 ] != y[ len-1 ] ) {
printf( "should not return NaN\n" );
}
free( x );
free( y );
return elapsed;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,13 @@ static float rand_float( void ) {
*/
static double benchmark1( int iterations, int len ) {
double elapsed;
float x[ len ];
float y[ len ];
float *x;
float *y;
double t;
int i;

x = (float *)malloc( len * sizeof( float ) );
y = (float *)malloc( len * sizeof( float ) );
for ( i = 0; i < len; i++ ) {
x[ i ] = ( rand_float() * 20000.0f ) - 10000.0f;
y[ i ] = 0.0f;
Expand All @@ -118,6 +120,8 @@ static double benchmark1( int iterations, int len ) {
if ( y[ len-1 ] != y[ len-1 ] ) {
printf( "should not return NaN\n" );
}
free( x );
free( y );
return elapsed;
}

Expand All @@ -130,11 +134,13 @@ static double benchmark1( int iterations, int len ) {
*/
static double benchmark2( int iterations, int len ) {
double elapsed;
float x[ len ];
float y[ len ];
float *x;
float *y;
double t;
int i;

x = (float *)malloc( len * sizeof( float ) );
y = (float *)malloc( len * sizeof( float ) );
for ( i = 0; i < len; i++ ) {
x[ i ] = ( rand_float() * 20000.0f ) - 10000.0f;
y[ i ] = 0.0f;
Expand All @@ -152,6 +158,8 @@ static double benchmark2( int iterations, int len ) {
if ( y[ len-1 ] != y[ len-1 ] ) {
printf( "should not return NaN\n" );
}
free( x );
free( y );
return elapsed;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,13 @@ static float rand_float( void ) {
*/
static double benchmark1( int iterations, int len ) {
double elapsed;
float x[ len ];
float y[ len ];
float *x;
float *y;
double t;
int i;

x = (float *)malloc( len * sizeof( float ) );
y = (float *)malloc( len * sizeof( float ) );
for ( i = 0; i < len; i++ ) {
x[ i ] = ( rand_float() * 20000.0f ) - 10000.0f;
y[ i ] = 0.0f;
Expand All @@ -118,6 +120,8 @@ static double benchmark1( int iterations, int len ) {
if ( y[ len-1 ] != y[ len-1 ] ) {
printf( "should not return NaN\n" );
}
free( x );
free( y );
return elapsed;
}

Expand All @@ -130,11 +134,13 @@ static double benchmark1( int iterations, int len ) {
*/
static double benchmark2( int iterations, int len ) {
double elapsed;
float x[ len ];
float y[ len ];
float *x;
float *y;
double t;
int i;

x = (float *)malloc( len * sizeof( float ) );
y = (float *)malloc( len * sizeof( float ) );
for ( i = 0; i < len; i++ ) {
x[ i ] = ( rand_float() * 20000.0f ) - 10000.0f;
y[ i ] = 0.0f;
Expand All @@ -152,6 +158,8 @@ static double benchmark2( int iterations, int len ) {
if ( y[ len-1 ] != y[ len-1 ] ) {
printf( "should not return NaN\n" );
}
free( x );
free( y );
return elapsed;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,13 @@ static float rand_float( void ) {
*/
static double benchmark1( int iterations, int len ) {
double elapsed;
float x[ len ];
float y[ len ];
float *x;
float *y;
double t;
int i;

x = (float *)malloc( len * sizeof( float ) );
y = (float *)malloc( len * sizeof( float ) );
for ( i = 0; i < len; i++ ) {
x[ i ] = ( rand_float() * 20000.0f ) - 10000.0f;
y[ i ] = 0.0f;
Expand All @@ -118,6 +120,8 @@ static double benchmark1( int iterations, int len ) {
if ( y[ len-1 ] != y[ len-1 ] ) {
printf( "should not return NaN\n" );
}
free( x );
free( y );
return elapsed;
}

Expand All @@ -130,11 +134,13 @@ static double benchmark1( int iterations, int len ) {
*/
static double benchmark2( int iterations, int len ) {
double elapsed;
float x[ len ];
float y[ len ];
float *x;
float *y;
double t;
int i;

x = (float *)malloc( len * sizeof( float ) );
y = (float *)malloc( len * sizeof( float ) );
for ( i = 0; i < len; i++ ) {
x[ i ] = ( rand_float() * 20000.0f ) - 10000.0f;
y[ i ] = 0.0f;
Expand All @@ -152,6 +158,8 @@ static double benchmark2( int iterations, int len ) {
if ( y[ len-1 ] != y[ len-1 ] ) {
printf( "should not return NaN\n" );
}
free( x );
free( y );
return elapsed;
}

Expand Down
Loading