From af4ed3b03656d02703b43ab0f4ec11c20195553b Mon Sep 17 00:00:00 2001 From: Uday Kakade Date: Tue, 21 Apr 2026 20:18:32 +0530 Subject: [PATCH] bench: refactor to use dynamic memory allocation in stats/strided (batch 2/3) --- .../dcumax/benchmark/c/benchmark.length.c | 16 ++++++++++++---- .../dcumaxabs/benchmark/c/benchmark.length.c | 16 ++++++++++++---- .../dcumin/benchmark/c/benchmark.length.c | 16 ++++++++++++---- .../dcuminabs/benchmark/c/benchmark.length.c | 16 ++++++++++++---- .../dmeanstdev/benchmark/c/benchmark.length.c | 4 +++- .../dmeanstdevpn/benchmark/c/benchmark.length.c | 4 +++- .../dmeanvar/benchmark/c/benchmark.length.c | 4 +++- .../dmeanvarpn/benchmark/c/benchmark.length.c | 8 ++++++-- .../dmeanwd/benchmark/c/benchmark.length.c | 8 ++++++-- .../dnanmeanors/benchmark/c/benchmark.length.c | 8 ++++++-- .../dnanmin/benchmark/c/benchmark.length.c | 8 ++++++-- .../dnanminabs/benchmark/c/benchmark.length.c | 8 ++++++-- .../dnanmskmax/benchmark/c/benchmark.length.c | 8 ++++++-- .../dnanrange/benchmark/c/benchmark.length.c | 8 ++++++-- .../dnanstdevch/benchmark/c/benchmark.length.c | 8 ++++++-- .../dnanstdevpn/benchmark/c/benchmark.length.c | 8 ++++++-- .../dnanstdevtk/benchmark/c/benchmark.length.c | 8 ++++++-- .../dnanstdevwd/benchmark/c/benchmark.length.c | 8 ++++++-- .../dnanstdevyc/benchmark/c/benchmark.length.c | 8 ++++++-- .../dnanvariance/benchmark/c/benchmark.length.c | 8 ++++++-- .../benchmark/c/benchmark.length.c | 8 ++++++-- .../benchmark/c/benchmark.length.c | 8 ++++++-- .../benchmark/c/benchmark.length.c | 8 ++++++-- .../benchmark/c/benchmark.length.c | 8 ++++++-- .../benchmark/c/benchmark.length.c | 8 ++++++-- 25 files changed, 165 insertions(+), 55 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/strided/dcumax/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dcumax/benchmark/c/benchmark.length.c index 3ce2730bdacd..c360428d7319 100644 --- a/lib/node_modules/@stdlib/stats/strided/dcumax/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dcumax/benchmark/c/benchmark.length.c @@ -96,11 +96,13 @@ static double rand_double( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double x[ len ]; - double y[ len ]; + double *x; + double *y; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); + y = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_double() * 20000.0 ) - 10000.0; y[ i ] = 0.0; @@ -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; } @@ -130,11 +134,13 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double x[ len ]; - double y[ len ]; + double *x; + double *y; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); + y = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_double() * 20000.0 ) - 10000.0; y[ i ] = 0.0; @@ -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; } diff --git a/lib/node_modules/@stdlib/stats/strided/dcumaxabs/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dcumaxabs/benchmark/c/benchmark.length.c index 7abccc81a5a4..c6332f637e5b 100644 --- a/lib/node_modules/@stdlib/stats/strided/dcumaxabs/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dcumaxabs/benchmark/c/benchmark.length.c @@ -96,11 +96,13 @@ static double rand_double( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double x[ len ]; - double y[ len ]; + double *x; + double *y; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); + y = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_double() * 20000.0 ) - 10000.0; y[ i ] = 0.0; @@ -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; } @@ -130,11 +134,13 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double x[ len ]; - double y[ len ]; + double *x; + double *y; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); + y = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_double() * 20000.0 ) - 10000.0; y[ i ] = 0.0; @@ -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; } diff --git a/lib/node_modules/@stdlib/stats/strided/dcumin/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dcumin/benchmark/c/benchmark.length.c index e6f730409bc1..01d562602661 100644 --- a/lib/node_modules/@stdlib/stats/strided/dcumin/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dcumin/benchmark/c/benchmark.length.c @@ -96,11 +96,13 @@ static double rand_double( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double x[ len ]; - double y[ len ]; + double *x; + double *y; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); + y = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_double() * 20000.0 ) - 10000.0; y[ i ] = 0.0; @@ -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; } @@ -130,11 +134,13 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double x[ len ]; - double y[ len ]; + double *x; + double *y; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); + y = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_double() * 20000.0 ) - 10000.0; y[ i ] = 0.0; @@ -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; } diff --git a/lib/node_modules/@stdlib/stats/strided/dcuminabs/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dcuminabs/benchmark/c/benchmark.length.c index dc75c481fe20..a332eea4b51c 100644 --- a/lib/node_modules/@stdlib/stats/strided/dcuminabs/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dcuminabs/benchmark/c/benchmark.length.c @@ -96,11 +96,13 @@ static double rand_double( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double x[ len ]; - double y[ len ]; + double *x; + double *y; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); + y = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_double() * 20000.0 ) - 10000.0; y[ i ] = 0.0; @@ -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; } @@ -130,11 +134,13 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double x[ len ]; - double y[ len ]; + double *x; + double *y; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); + y = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_double() * 20000.0 ) - 10000.0; y[ i ] = 0.0; @@ -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; } diff --git a/lib/node_modules/@stdlib/stats/strided/dmeanstdev/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dmeanstdev/benchmark/c/benchmark.length.c index 0f579c0b2b54..55d7eed901f4 100644 --- a/lib/node_modules/@stdlib/stats/strided/dmeanstdev/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dmeanstdev/benchmark/c/benchmark.length.c @@ -97,10 +97,11 @@ static double rand_double( void ) { static double benchmark( int iterations, int len ) { double elapsed; double out[ 2 ]; - double x[ len ]; + double *x; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_double() * 20000.0 ) - 10000.0; } @@ -120,6 +121,7 @@ static double benchmark( int iterations, int len ) { if ( out[ i%2 ] != out[ i%2 ] ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } diff --git a/lib/node_modules/@stdlib/stats/strided/dmeanstdevpn/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dmeanstdevpn/benchmark/c/benchmark.length.c index 82233a45b9c6..a50649ffaf77 100644 --- a/lib/node_modules/@stdlib/stats/strided/dmeanstdevpn/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dmeanstdevpn/benchmark/c/benchmark.length.c @@ -97,10 +97,11 @@ static double rand_double( void ) { static double benchmark( int iterations, int len ) { double elapsed; double out[ 2 ]; - double x[ len ]; + double *x; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_double() * 20000.0 ) - 10000.0; } @@ -120,6 +121,7 @@ static double benchmark( int iterations, int len ) { if ( out[ i%2 ] != out[ i%2 ] ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } diff --git a/lib/node_modules/@stdlib/stats/strided/dmeanvar/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dmeanvar/benchmark/c/benchmark.length.c index 5e649feabfad..bf2621f27d68 100644 --- a/lib/node_modules/@stdlib/stats/strided/dmeanvar/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dmeanvar/benchmark/c/benchmark.length.c @@ -97,10 +97,11 @@ static double rand_double( void ) { static double benchmark( int iterations, int len ) { double elapsed; double out[ 2 ]; - double x[ len ]; + double *x; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_double() * 20000.0 ) - 10000.0; } @@ -119,6 +120,7 @@ static double benchmark( int iterations, int len ) { if ( out[ i%2 ] != out[ i%2 ] ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } diff --git a/lib/node_modules/@stdlib/stats/strided/dmeanvarpn/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dmeanvarpn/benchmark/c/benchmark.length.c index 5e58f54d087c..2d52484876a3 100644 --- a/lib/node_modules/@stdlib/stats/strided/dmeanvarpn/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dmeanvarpn/benchmark/c/benchmark.length.c @@ -97,10 +97,11 @@ static double rand_double( void ) { static double benchmark1( int iterations, int len ) { double elapsed; double out[ 2 ]; - double x[ len ]; + double *x; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_double() * 20000.0 ) - 10000.0; } @@ -120,6 +121,7 @@ static double benchmark1( int iterations, int len ) { if ( out[ i%2 ] != out[ i%2 ] ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -133,10 +135,11 @@ static double benchmark1( int iterations, int len ) { static double benchmark2( int iterations, int len ) { double elapsed; double out[ 2 ]; - double x[ len ]; + double *x; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_double() * 20000.0 ) - 10000.0; } @@ -156,6 +159,7 @@ static double benchmark2( int iterations, int len ) { if ( out[ i%2 ] != out[ i%2 ] ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } diff --git a/lib/node_modules/@stdlib/stats/strided/dmeanwd/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dmeanwd/benchmark/c/benchmark.length.c index 70c6c7b5b5d0..b2c482fd5218 100644 --- a/lib/node_modules/@stdlib/stats/strided/dmeanwd/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dmeanwd/benchmark/c/benchmark.length.c @@ -96,11 +96,12 @@ static double rand_double( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_double() * 20000.0 ) - 10000.0; } @@ -118,6 +119,7 @@ static double benchmark1( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -130,11 +132,12 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_double() * 20000.0 ) - 10000.0; } @@ -152,6 +155,7 @@ static double benchmark2( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } diff --git a/lib/node_modules/@stdlib/stats/strided/dnanmeanors/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dnanmeanors/benchmark/c/benchmark.length.c index ce2895e83c2a..3d0fd2f6745a 100644 --- a/lib/node_modules/@stdlib/stats/strided/dnanmeanors/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dnanmeanors/benchmark/c/benchmark.length.c @@ -96,11 +96,12 @@ static double rand_double( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.5 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -122,6 +123,7 @@ static double benchmark1( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -134,11 +136,12 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.5 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -160,6 +163,7 @@ static double benchmark2( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } diff --git a/lib/node_modules/@stdlib/stats/strided/dnanmin/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dnanmin/benchmark/c/benchmark.length.c index 4fb45fe003c8..d4b0d2faddee 100644 --- a/lib/node_modules/@stdlib/stats/strided/dnanmin/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dnanmin/benchmark/c/benchmark.length.c @@ -96,11 +96,12 @@ static double rand_double( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -122,6 +123,7 @@ static double benchmark1( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -134,11 +136,12 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -160,6 +163,7 @@ static double benchmark2( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } diff --git a/lib/node_modules/@stdlib/stats/strided/dnanminabs/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dnanminabs/benchmark/c/benchmark.length.c index bf0dbeccdbf0..a9f1019bce63 100644 --- a/lib/node_modules/@stdlib/stats/strided/dnanminabs/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dnanminabs/benchmark/c/benchmark.length.c @@ -96,11 +96,12 @@ static double rand_double( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -122,6 +123,7 @@ static double benchmark1( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -134,11 +136,12 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -160,6 +163,7 @@ static double benchmark2( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } diff --git a/lib/node_modules/@stdlib/stats/strided/dnanmskmax/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dnanmskmax/benchmark/c/benchmark.length.c index d5187a760c4d..691f48f3ffbc 100644 --- a/lib/node_modules/@stdlib/stats/strided/dnanmskmax/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dnanmskmax/benchmark/c/benchmark.length.c @@ -97,11 +97,12 @@ static double rand_double( void ) { static double benchmark1( int iterations, int len ) { unsigned char mask[ len ]; double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { mask[ i ] = 1; // missing @@ -124,6 +125,7 @@ static double benchmark1( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -137,11 +139,12 @@ static double benchmark1( int iterations, int len ) { static double benchmark2( int iterations, int len ) { unsigned char mask[ len ]; double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { mask[ i ] = 1; // missing @@ -164,6 +167,7 @@ static double benchmark2( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } diff --git a/lib/node_modules/@stdlib/stats/strided/dnanrange/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dnanrange/benchmark/c/benchmark.length.c index ecc88f54a295..c26876576027 100644 --- a/lib/node_modules/@stdlib/stats/strided/dnanrange/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dnanrange/benchmark/c/benchmark.length.c @@ -96,11 +96,12 @@ static double rand_double( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -122,6 +123,7 @@ static double benchmark1( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -134,11 +136,12 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -160,6 +163,7 @@ static double benchmark2( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } diff --git a/lib/node_modules/@stdlib/stats/strided/dnanstdevch/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dnanstdevch/benchmark/c/benchmark.length.c index 6c86094e8ee8..102caa14b7af 100644 --- a/lib/node_modules/@stdlib/stats/strided/dnanstdevch/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dnanstdevch/benchmark/c/benchmark.length.c @@ -96,11 +96,12 @@ static double rand_double( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -122,6 +123,7 @@ static double benchmark1( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -134,11 +136,12 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -160,6 +163,7 @@ static double benchmark2( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } diff --git a/lib/node_modules/@stdlib/stats/strided/dnanstdevpn/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dnanstdevpn/benchmark/c/benchmark.length.c index 97151c46e64e..f1fa224c4f7d 100644 --- a/lib/node_modules/@stdlib/stats/strided/dnanstdevpn/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dnanstdevpn/benchmark/c/benchmark.length.c @@ -96,11 +96,12 @@ static double rand_double( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -122,6 +123,7 @@ static double benchmark1( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -134,11 +136,12 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -160,6 +163,7 @@ static double benchmark2( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } diff --git a/lib/node_modules/@stdlib/stats/strided/dnanstdevtk/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dnanstdevtk/benchmark/c/benchmark.length.c index 977f5fb34a61..968c1ab15de9 100644 --- a/lib/node_modules/@stdlib/stats/strided/dnanstdevtk/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dnanstdevtk/benchmark/c/benchmark.length.c @@ -96,11 +96,12 @@ static double rand_double( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -122,6 +123,7 @@ static double benchmark1( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -134,11 +136,12 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -160,6 +163,7 @@ static double benchmark2( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } diff --git a/lib/node_modules/@stdlib/stats/strided/dnanstdevwd/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dnanstdevwd/benchmark/c/benchmark.length.c index bbcf862561e4..4d1e9d52ced7 100644 --- a/lib/node_modules/@stdlib/stats/strided/dnanstdevwd/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dnanstdevwd/benchmark/c/benchmark.length.c @@ -96,11 +96,12 @@ static double rand_double( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -122,6 +123,7 @@ static double benchmark1( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -134,11 +136,12 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -160,6 +163,7 @@ static double benchmark2( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } diff --git a/lib/node_modules/@stdlib/stats/strided/dnanstdevyc/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dnanstdevyc/benchmark/c/benchmark.length.c index 9bd89acc011e..9d510a6c42d1 100644 --- a/lib/node_modules/@stdlib/stats/strided/dnanstdevyc/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dnanstdevyc/benchmark/c/benchmark.length.c @@ -96,11 +96,12 @@ static double rand_double( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -122,6 +123,7 @@ static double benchmark1( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -134,11 +136,12 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -160,6 +163,7 @@ static double benchmark2( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } diff --git a/lib/node_modules/@stdlib/stats/strided/dnanvariance/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dnanvariance/benchmark/c/benchmark.length.c index f845862a3f68..35ded2b2963a 100644 --- a/lib/node_modules/@stdlib/stats/strided/dnanvariance/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dnanvariance/benchmark/c/benchmark.length.c @@ -96,11 +96,12 @@ static double rand_double( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -122,6 +123,7 @@ static double benchmark1( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -134,11 +136,12 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -160,6 +163,7 @@ static double benchmark2( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } diff --git a/lib/node_modules/@stdlib/stats/strided/dnanvariancech/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dnanvariancech/benchmark/c/benchmark.length.c index a772cedd1745..49f0e6017108 100644 --- a/lib/node_modules/@stdlib/stats/strided/dnanvariancech/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dnanvariancech/benchmark/c/benchmark.length.c @@ -96,11 +96,12 @@ static double rand_double( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -122,6 +123,7 @@ static double benchmark1( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -134,11 +136,12 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -160,6 +163,7 @@ static double benchmark2( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } diff --git a/lib/node_modules/@stdlib/stats/strided/dnanvariancepn/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dnanvariancepn/benchmark/c/benchmark.length.c index 977312588fcf..3999dd8ab988 100644 --- a/lib/node_modules/@stdlib/stats/strided/dnanvariancepn/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dnanvariancepn/benchmark/c/benchmark.length.c @@ -96,11 +96,12 @@ static double rand_double( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -122,6 +123,7 @@ static double benchmark1( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -134,11 +136,12 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -160,6 +163,7 @@ static double benchmark2( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } diff --git a/lib/node_modules/@stdlib/stats/strided/dnanvariancetk/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dnanvariancetk/benchmark/c/benchmark.length.c index 74069e69d532..d67d98e25a15 100644 --- a/lib/node_modules/@stdlib/stats/strided/dnanvariancetk/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dnanvariancetk/benchmark/c/benchmark.length.c @@ -96,11 +96,12 @@ static double rand_double( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -122,6 +123,7 @@ static double benchmark1( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -134,11 +136,12 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -160,6 +163,7 @@ static double benchmark2( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } diff --git a/lib/node_modules/@stdlib/stats/strided/dnanvariancewd/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dnanvariancewd/benchmark/c/benchmark.length.c index 09bfd8a7754c..8aa1fe462338 100644 --- a/lib/node_modules/@stdlib/stats/strided/dnanvariancewd/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dnanvariancewd/benchmark/c/benchmark.length.c @@ -96,11 +96,12 @@ static double rand_double( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -122,6 +123,7 @@ static double benchmark1( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -134,11 +136,12 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -160,6 +163,7 @@ static double benchmark2( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } diff --git a/lib/node_modules/@stdlib/stats/strided/dnanvarianceyc/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/dnanvarianceyc/benchmark/c/benchmark.length.c index 08fd8982cfb9..834ec168e2c3 100644 --- a/lib/node_modules/@stdlib/stats/strided/dnanvarianceyc/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/dnanvarianceyc/benchmark/c/benchmark.length.c @@ -96,11 +96,12 @@ static double rand_double( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -122,6 +123,7 @@ static double benchmark1( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -134,11 +136,12 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double v; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { if ( rand_double() < 0.2 ) { x[ i ] = 0.0 / 0.0; // NaN @@ -160,6 +163,7 @@ static double benchmark2( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; }