From 3fc2ef2c3d1f0cfc090fe7a44031499027e43e54 Mon Sep 17 00:00:00 2001 From: ishwarthecodddr Date: Tue, 16 Dec 2025 13:38:05 +0530 Subject: [PATCH 1/3] bench: refactor csrot benchmark to use dynamic allocation --- .../base/csrot/benchmark/c/benchmark.length.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/csrot/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/csrot/benchmark/c/benchmark.length.c index f2612a68663a..664ca75af840 100644 --- a/lib/node_modules/@stdlib/blas/base/csrot/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/base/csrot/benchmark/c/benchmark.length.c @@ -96,11 +96,12 @@ static float rand_float( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - float x[ len*2 ]; - float y[ len*2 ]; + float *x; + float *y; double t; int i; - + x = (float *)malloc( len * 2 * sizeof(float) ); + y = (float *)malloc( len * 2 * sizeof(float) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_float()*10000.0f ) - 5000.0f; x[ i+1 ] = ( rand_float()*10000.0f ) - 5000.0f; @@ -119,6 +120,8 @@ static double benchmark1( int iterations, int len ) { if ( y[ 0 ] != y[ 0 ] ) { printf( "should not return NaN\n" ); } + free( x ); + free( y ); return elapsed; } @@ -131,11 +134,14 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - float x[ len*2 ]; - float y[ len*2 ]; + float *x; + float *y; double t; int i; + x = (float *)malloc( len * 2 * sizeof(float) ); + y = (float *)malloc( len * 2 * sizeof(float) ); + for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_float()*10000.0f ) - 5000.0f; x[ i+1 ] = ( rand_float()*10000.0f ) - 5000.0f; @@ -154,6 +160,8 @@ static double benchmark2( int iterations, int len ) { if ( y[ 0 ] != y[ 0 ] ) { printf( "should not return NaN\n" ); } + free( x ); + free( y ); return elapsed; } From ec761aca1d90ce7c4ffd3e58391378a18d1b48d9 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 17 Dec 2025 01:28:33 -0800 Subject: [PATCH 2/3] style: adjust whitespace Signed-off-by: Athan --- .../blas/base/csrot/benchmark/c/benchmark.length.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/csrot/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/csrot/benchmark/c/benchmark.length.c index 664ca75af840..c1648786607e 100644 --- a/lib/node_modules/@stdlib/blas/base/csrot/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/base/csrot/benchmark/c/benchmark.length.c @@ -100,8 +100,9 @@ static double benchmark1( int iterations, int len ) { float *y; double t; int i; - x = (float *)malloc( len * 2 * sizeof(float) ); - y = (float *)malloc( len * 2 * sizeof(float) ); + + x = (float *) malloc( len * 2 * sizeof( float ) ); + y = (float *) malloc( len * 2 * sizeof( float ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_float()*10000.0f ) - 5000.0f; x[ i+1 ] = ( rand_float()*10000.0f ) - 5000.0f; @@ -139,8 +140,8 @@ static double benchmark2( int iterations, int len ) { double t; int i; - x = (float *)malloc( len * 2 * sizeof(float) ); - y = (float *)malloc( len * 2 * sizeof(float) ); + x = (float *) malloc( len * 2 * sizeof( float ) ); + y = (float *) malloc( len * 2 * sizeof( float ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_float()*10000.0f ) - 5000.0f; From 7da1886c1ea6835a18796c4032869ccae1d5480e Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 17 Dec 2025 01:28:59 -0800 Subject: [PATCH 3/3] style: remove empty line Signed-off-by: Athan --- .../@stdlib/blas/base/csrot/benchmark/c/benchmark.length.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/csrot/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/csrot/benchmark/c/benchmark.length.c index c1648786607e..e3444a33988a 100644 --- a/lib/node_modules/@stdlib/blas/base/csrot/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/base/csrot/benchmark/c/benchmark.length.c @@ -142,7 +142,6 @@ static double benchmark2( int iterations, int len ) { x = (float *) malloc( len * 2 * sizeof( float ) ); y = (float *) malloc( len * 2 * sizeof( float ) ); - for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_float()*10000.0f ) - 5000.0f; x[ i+1 ] = ( rand_float()*10000.0f ) - 5000.0f;