Skip to content

Commit

Permalink
bench: adjust sample values to prevent overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kgryte committed Jul 29, 2024
1 parent 9efefa0 commit 308005e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ static double benchmark( int iterations, int len ) {
double t;
int i;

ca = stdlib_complex64( rand_float()*5.0f, rand_float()*2.0f );
ca = stdlib_complex64( 1.0f, 0.0f );
for ( i = 0; i < len*2; i += 2 ) {
cx[ i ] = ( rand_float()*10000.0f ) - 5000.0f;
cx[ i+1 ] = ( rand_float()*10000.0f ) - 5000.0f;
cx[ i ] = ( rand_float()*2.0f ) - 1.0f;
cx[ i+1 ] = ( rand_float()*2.0f ) - 1.0f;
}
t = tic();
for ( i = 0; i < iterations; i++ ) {
Expand Down
4 changes: 2 additions & 2 deletions lib/node_modules/@stdlib/blas/base/cscal/src/cscal.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ void API_SUFFIX(c_cscal)( const CBLAS_INT N, const stdlib_complex64_t ca, void *
return;
}
for ( i = 0; i < N; i++, ip1 += is1 ) {
z = *( (stdlib_complex64_t *)ip1 );
*( (stdlib_complex64_t *)ip1 ) = stdlib_base_complex64_mul( ca, z );
z = *(stdlib_complex64_t *)ip1;
*(stdlib_complex64_t *)ip1 = stdlib_base_complex64_mul( ca, z );
}
return;
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ static double benchmark( int iterations, int len ) {
double t;
int i;

za = stdlib_complex128( rand_double()*1.0, rand_double()*0.0 );
za = stdlib_complex128( 1.0, 0.0 );
for ( i = 0; i < len*2; i+=2 ) {
zx[ i ] = ( rand_double()*10000.0 ) - 5000.0;
zx[ i+1 ] = ( rand_double()*10000.0 ) - 5000.0;
zx[ i ] = ( rand_double()*2.0 ) - 1.0;
zx[ i+1 ] = ( rand_double()*2.0 ) - 1.0;
}
t = tic();
for ( i = 0; i < iterations; i++ ) {
Expand Down
4 changes: 2 additions & 2 deletions lib/node_modules/@stdlib/blas/base/zscal/src/zscal.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ void API_SUFFIX(c_zscal)( const CBLAS_INT N, const stdlib_complex128_t za, void
return;
}
for ( i = 0; i < N; i++, ip1 += is1 ) {
z = *( (stdlib_complex128_t *)ip1 );
*( (stdlib_complex128_t *)ip1 ) = stdlib_base_complex128_mul( za, z );
z = *(stdlib_complex128_t *)ip1;
*(stdlib_complex128_t *)ip1 = stdlib_base_complex128_mul( za, z );
}
return;
}

0 comments on commit 308005e

Please sign in to comment.