From 84d46757ced86ce0200a176e6d751f8e751a646c Mon Sep 17 00:00:00 2001 From: Ayushi Jain Date: Sun, 1 Feb 2026 13:30:57 +0000 Subject: [PATCH 1/2] bench: refactor to use dynamic memory allocation in saxpy/benchmark/c --- .../base/saxpy/benchmark/c/benchmark.length.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/saxpy/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/saxpy/benchmark/c/benchmark.length.c index c8ee55530538..263ad9ba2361 100644 --- a/lib/node_modules/@stdlib/blas/base/saxpy/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/base/saxpy/benchmark/c/benchmark.length.c @@ -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()*100.0f ) - 200.0f; y[ i ] = ( rand_float()*10000.0f ) - 20000.0f; @@ -118,6 +120,8 @@ static double benchmark1( int iterations, int len ) { printf( "should not return NaN\n" ); } return elapsed; + free( x ); + free( y ); } /** @@ -129,11 +133,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()*100.0f ) - 200.0f; y[ i ] = ( rand_float()*10000.0f ) - 20000.0f; @@ -151,6 +157,8 @@ static double benchmark2( int iterations, int len ) { printf( "should not return NaN\n" ); } return elapsed; + free( x ); + free( y ); } /** From 5e7f1fa2618cce5e3325a8f25a7d33b0ac451e48 Mon Sep 17 00:00:00 2001 From: Ayushi Jain Date: Sun, 1 Feb 2026 13:43:35 +0000 Subject: [PATCH 2/2] fix: c error --- .../@stdlib/blas/base/saxpy/benchmark/c/benchmark.length.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/saxpy/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/saxpy/benchmark/c/benchmark.length.c index 263ad9ba2361..ef2095b94af9 100644 --- a/lib/node_modules/@stdlib/blas/base/saxpy/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/base/saxpy/benchmark/c/benchmark.length.c @@ -119,9 +119,9 @@ static double benchmark1( int iterations, int len ) { if ( y[ 0 ] != y[ 0 ] ) { printf( "should not return NaN\n" ); } - return elapsed; free( x ); free( y ); + return elapsed; } /** @@ -156,9 +156,9 @@ static double benchmark2( int iterations, int len ) { if ( y[ 0 ] != y[ 0 ] ) { printf( "should not return NaN\n" ); } - return elapsed; free( x ); free( y ); + return elapsed; } /**