From 308005e8a9cf48917f0c68451bd05f7d6fb06ba4 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Sun, 28 Jul 2024 23:39:40 -0700 Subject: [PATCH] bench: adjust sample values to prevent overflow --- .../@stdlib/blas/base/cscal/benchmark/c/benchmark.length.c | 6 +++--- lib/node_modules/@stdlib/blas/base/cscal/src/cscal.c | 4 ++-- .../@stdlib/blas/base/zscal/benchmark/c/benchmark.length.c | 6 +++--- lib/node_modules/@stdlib/blas/base/zscal/src/zscal.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/cscal/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/cscal/benchmark/c/benchmark.length.c index 3c8311becf8f..239d6f67ca95 100644 --- a/lib/node_modules/@stdlib/blas/base/cscal/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/base/cscal/benchmark/c/benchmark.length.c @@ -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++ ) { diff --git a/lib/node_modules/@stdlib/blas/base/cscal/src/cscal.c b/lib/node_modules/@stdlib/blas/base/cscal/src/cscal.c index c708862d7023..2dc84e61b5d3 100644 --- a/lib/node_modules/@stdlib/blas/base/cscal/src/cscal.c +++ b/lib/node_modules/@stdlib/blas/base/cscal/src/cscal.c @@ -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; } diff --git a/lib/node_modules/@stdlib/blas/base/zscal/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/zscal/benchmark/c/benchmark.length.c index 49dbb001923d..71d0a8857363 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/base/zscal/benchmark/c/benchmark.length.c @@ -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++ ) { diff --git a/lib/node_modules/@stdlib/blas/base/zscal/src/zscal.c b/lib/node_modules/@stdlib/blas/base/zscal/src/zscal.c index affa48c8c210..1e76ed849b12 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/src/zscal.c +++ b/lib/node_modules/@stdlib/blas/base/zscal/src/zscal.c @@ -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; }