diff --git a/lib/node_modules/@stdlib/math/base/special/cexp/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cexp/benchmark/c/benchmark.c index 524f78dc769e..b5d40ee9bf31 100644 --- a/lib/node_modules/@stdlib/math/base/special/cexp/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cexp/benchmark/c/benchmark.c @@ -89,20 +89,22 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double re[ 100 ]; + double im[ 100 ]; double elapsed; - double re; - double im; double t; int i; double complex z; + for ( i = 0; i < 100; i++ ) { + re[ i ] = ( 100.0*rand_double() ) - 50.0; + im[ i ] = ( 100.0*rand_double() ) - 50.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 100.0*rand_double() ) - 50.0; - im = ( 100.0*rand_double() ) - 50.0; - - z = cexp( re + I * im ); + z = cexp( re[ i%100 ] + I * im[ i%100 ] ); if ( z != z ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/cexp/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cexp/benchmark/c/native/benchmark.c index ad9c53b843f1..c898edb47c7d 100644 --- a/lib/node_modules/@stdlib/math/base/special/cexp/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cexp/benchmark/c/native/benchmark.c @@ -92,20 +92,23 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double v[ 100 ]; double elapsed; double re; double im; double t; - double v; int i; stdlib_complex128_t x; stdlib_complex128_t y; + for ( i = 0; i < 100; i++ ) { + v[ i ] = ( 1000.0*rand_double() ) - 500.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - v = ( 1000.0*rand_double() ) - 500.0; - x = stdlib_complex128( v, v ); + x = stdlib_complex128( v[ i%100 ], v[ i%100 ] ); y = stdlib_base_cexp( x ); stdlib_complex128_reim( y, &re, &im ); if ( re != re ) { diff --git a/lib/node_modules/@stdlib/math/base/special/cexp/test/test.js b/lib/node_modules/@stdlib/math/base/special/cexp/test/test.js index 4ae7b968ab0b..1df455b026ac 100644 --- a/lib/node_modules/@stdlib/math/base/special/cexp/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/cexp/test/test.js @@ -131,8 +131,8 @@ tape( 'if imaginary component is `+Infinity`, the function returns a complex num var v; v = cexp( new Complex128( 0.0, PINF ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns NaN' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); t.end(); }); @@ -140,8 +140,8 @@ tape( 'if imaginary component is `-Infinity`, the function returns a complex num var v; v = cexp( new Complex128( 0.0, NINF ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns NaN' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); t.end(); }); @@ -167,7 +167,7 @@ tape( 'if real component is `NaN` and imaginary component is `0.0`, the function var v; v = cexp( new Complex128( NaN, 0.0 ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); t.strictEqual( imag( v ), 0.0, 'returns 0.0' ); t.end(); }); @@ -176,16 +176,16 @@ tape( 'if imaginary component is `NaN`, the function returns a complex number wi var v; v = cexp( new Complex128( 5.0, NaN ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns NaN' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); v = cexp( new Complex128( 0.0, NaN ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns NaN' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); v = cexp( new Complex128( NaN, NaN ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns NaN' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); t.end(); }); @@ -210,8 +210,8 @@ tape( 'if real component is `NaN` and imaginary component is nonzero, the functi var v; v = cexp( new Complex128( NaN, 3.0 ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns NaN' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); t.end(); }); @@ -219,7 +219,7 @@ tape( 'if real component is `NaN` and imaginary component is `+0.0`, the functio var v; v = cexp( new Complex128( NaN, 0.0 ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); t.strictEqual( isPositiveZero( imag( v ) ), true, 'returns +0.0' ); t.end(); }); @@ -228,7 +228,7 @@ tape( 'if real component is `NaN` and imaginary component is `-0.0`, the functio var v; v = cexp( new Complex128( NaN, -0.0 ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); t.strictEqual( isNegativeZero( imag( v ) ), true, 'returns +0.0' ); t.end(); }); @@ -238,7 +238,7 @@ tape( 'if real component is `+Infinity` and imaginary component is `+Infinity`, v = cexp( new Complex128( PINF, PINF ) ); t.strictEqual( real( v ), NINF, 'returns -Infinity' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/cexp/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/cexp/test/test.native.js index 6cf7a3b331ac..812377d7b094 100644 --- a/lib/node_modules/@stdlib/math/base/special/cexp/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/cexp/test/test.native.js @@ -140,8 +140,8 @@ tape( 'if imaginary component is `+Infinity`, the function returns a complex num var v; v = cexp( new Complex128( 0.0, PINF ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns NaN' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); t.end(); }); @@ -149,8 +149,8 @@ tape( 'if imaginary component is `-Infinity`, the function returns a complex num var v; v = cexp( new Complex128( 0.0, NINF ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns NaN' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); t.end(); }); @@ -176,7 +176,7 @@ tape( 'if real component is `NaN` and imaginary component is `0.0`, the function var v; v = cexp( new Complex128( NaN, 0.0 ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); t.strictEqual( imag( v ), 0.0, 'returns 0.0' ); t.end(); }); @@ -185,16 +185,16 @@ tape( 'if imaginary component is `NaN`, the function returns a complex number wi var v; v = cexp( new Complex128( 5.0, NaN ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns NaN' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); v = cexp( new Complex128( 0.0, NaN ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns NaN' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); v = cexp( new Complex128( NaN, NaN ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns NaN' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); t.end(); }); @@ -219,8 +219,8 @@ tape( 'if real component is `NaN` and imaginary component is nonzero, the functi var v; v = cexp( new Complex128( NaN, 3.0 ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns NaN' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); t.end(); }); @@ -228,7 +228,7 @@ tape( 'if real component is `NaN` and imaginary component is `+0.0`, the functio var v; v = cexp( new Complex128( NaN, 0.0 ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); t.strictEqual( isPositiveZero( imag( v ) ), true, 'returns +0.0' ); t.end(); }); @@ -237,7 +237,7 @@ tape( 'if real component is `NaN` and imaginary component is `-0.0`, the functio var v; v = cexp( new Complex128( NaN, -0.0 ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); t.strictEqual( isNegativeZero( imag( v ) ), true, 'returns +0.0' ); t.end(); }); @@ -247,7 +247,7 @@ tape( 'if real component is `+Infinity` and imaginary component is `+Infinity`, v = cexp( new Complex128( PINF, PINF ) ); t.strictEqual( real( v ), NINF, 'returns -Infinity' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/cflipsign/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cflipsign/benchmark/c/native/benchmark.c index 515b23ecff90..b8bc2322e1d1 100644 --- a/lib/node_modules/@stdlib/math/base/special/cflipsign/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cflipsign/benchmark/c/native/benchmark.c @@ -92,21 +92,24 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double v[ 100 ]; double elapsed; double re; double im; double t; - double v; int i; stdlib_complex128_t x; stdlib_complex128_t y; + for ( i = 0; i < 100; i++ ) { + v[ i ] = ( 1000.0*rand_double() ) - 500.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - v = ( 1000.0*rand_double() ) - 500.0; - x = stdlib_complex128( v, v ); - y = stdlib_base_cflipsign( x, -v ); + x = stdlib_complex128( v[ i%100 ], v[ i%100 ] ); + y = stdlib_base_cflipsign( x, -v[ i%100 ] ); stdlib_complex128_reim( y, &re, &im ); if ( re != re ) { printf( "unexpected result\n" ); diff --git a/lib/node_modules/@stdlib/math/base/special/cflipsignf/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cflipsignf/benchmark/c/native/benchmark.c index 3f734c2fda68..bdab52de6d07 100644 --- a/lib/node_modules/@stdlib/math/base/special/cflipsignf/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cflipsignf/benchmark/c/native/benchmark.c @@ -91,18 +91,21 @@ static float rand_float( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + float v[ 100 ]; float complex x; float complex y; double elapsed; double t; - float v; int i; + for ( i = 0; i < 100; i++ ) { + v[ i ] = ( 1000.0f*rand_float() ) - 500.0f; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - v = ( 1000.0f*rand_float() ) - 500.0f; - x = v + v*I; - y = stdlib_base_cflipsignf( x, -v ); + x = v[ i%100 ] + v[ i%100 ]*I; + y = stdlib_base_cflipsignf( x, -v[ i%100 ] ); if ( crealf( y ) != crealf( y ) ) { printf( "unexpected result\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/cfloor/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/cfloor/benchmark/benchmark.js index 61839392186f..feb7f83eb855 100644 --- a/lib/node_modules/@stdlib/math/base/special/cfloor/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/cfloor/benchmark/benchmark.js @@ -21,7 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var randu = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var Complex128 = require( '@stdlib/complex/float64/ctor' ); var real = require( '@stdlib/complex/float64/real' ); @@ -66,11 +66,12 @@ bench( pkg+'::manual', function benchmark( b ) { var y; var i; + re = randu( 10, -500.0, 500.0 ); + im = randu( 10, -500.0, 500.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - re = ( randu()*1000.0 ) - 500.0; - im = ( randu()*1000.0 ) - 500.0; - y = [ floor( re ), floor( im ) ]; + y = [ floor( re[ i%re.length ] ), floor( im[ i%im.length ] ) ]; if ( y.length === 0 ) { b.fail( 'should not be empty' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/cfloor/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cfloor/benchmark/c/benchmark.c index 0e9d2af8c4c4..b9cf18d81742 100644 --- a/lib/node_modules/@stdlib/math/base/special/cfloor/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cfloor/benchmark/c/benchmark.c @@ -89,20 +89,23 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double re[ 100 ]; + double im[ 100 ]; double elapsed; - double re; - double im; double t; int i; double complex z; double complex y; + for ( i = 0; i < 100; i++ ) { + re[ i ] = ( 1000.0*rand_double() ) - 500.0; + im[ i ] = ( 1000.0*rand_double() ) - 500.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z = re + im*I; + z = re[ i%100 ] + im[ i%100 ]*I; y = floor( creal(z) ) + floor( cimag(z) )*I; if ( y != y ) { printf( "should not return NaN\n" ); diff --git a/lib/node_modules/@stdlib/math/base/special/cfloorn/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cfloorn/benchmark/c/native/benchmark.c index e2220b0ff53e..2b82aad1e876 100644 --- a/lib/node_modules/@stdlib/math/base/special/cfloorn/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cfloorn/benchmark/c/native/benchmark.c @@ -92,20 +92,23 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double v[ 100 ]; double elapsed; double re; double im; double t; - double v; int i; stdlib_complex128_t x; stdlib_complex128_t y; + for ( i = 0; i < 100; i++ ) { + v[ i ] = ( 1000.0*rand_double() ) - 500.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - v = ( 1000.0*rand_double() ) - 500.0; - x = stdlib_complex128( v, v ); + x = stdlib_complex128( v[ i%100 ], v[ i%100 ] ); y = stdlib_base_cfloorn( x, -2 ); stdlib_complex128_reim( y, &re, &im ); if ( re != re ) { diff --git a/lib/node_modules/@stdlib/math/base/special/cinv/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cinv/benchmark/c/benchmark.c index de6787945afe..ab2411302814 100644 --- a/lib/node_modules/@stdlib/math/base/special/cinv/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cinv/benchmark/c/benchmark.c @@ -89,20 +89,23 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double re[ 100 ]; + double im[ 100 ]; double elapsed; - double re; - double im; double t; int i; double complex z1; double complex z2; + for ( i = 0; i < 100; i++ ) { + re[ i ] = ( 1000.0*rand_double() ) - 500.0; + im[ i ] = ( 1000.0*rand_double() ) - 500.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - re = ( 1000.0*rand_double() ) - 500.0; - im = ( 1000.0*rand_double() ) - 500.0; - z1 = re + im*I; + z1 = re[ i%100 ] + im[ i%100 ]*I; z2 = 1.0 / z1; if ( z2 != z2 ) { diff --git a/lib/node_modules/@stdlib/math/base/special/cinv/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cinv/benchmark/c/native/benchmark.c index 172faf7b36a6..815f7442f495 100644 --- a/lib/node_modules/@stdlib/math/base/special/cinv/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cinv/benchmark/c/native/benchmark.c @@ -92,20 +92,23 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double v[ 100 ]; double elapsed; double re; double im; double t; - double v; int i; stdlib_complex128_t x; stdlib_complex128_t y; + for ( i = 0; i < 100; i++ ) { + v[ i ] = ( 1000.0*rand_double() ) - 500.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - v = ( 1000.0*rand_double() ) - 500.0; - x = stdlib_complex128( v, v ); + x = stdlib_complex128( v[ i%100 ], v[ i%100 ] ); y = stdlib_base_cinv( x ); stdlib_complex128_reim( y, &re, &im ); if ( re != re ) { diff --git a/lib/node_modules/@stdlib/math/base/special/cinv/test/test.js b/lib/node_modules/@stdlib/math/base/special/cinv/test/test.js index 12bc7cd47acf..c0fcdaa89b04 100644 --- a/lib/node_modules/@stdlib/math/base/special/cinv/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/cinv/test/test.js @@ -430,16 +430,16 @@ tape( 'if a real or imaginary component is `NaN`, all components are `NaN`', fun var v; v = cinv( new Complex128( NaN, 3.0 ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns NaN' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); v = cinv( new Complex128( 5.0, NaN ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns NaN' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); v = cinv( new Complex128( NaN, NaN ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns NaN' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/cinv/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/cinv/test/test.native.js index ee9244b33b05..43995ac696bc 100644 --- a/lib/node_modules/@stdlib/math/base/special/cinv/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/cinv/test/test.native.js @@ -443,16 +443,16 @@ tape( 'if a real or imaginary component is `NaN`, all components are `NaN`', opt var v; v = cinv( new Complex128( NaN, 3.0 ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns NaN' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); v = cinv( new Complex128( 5.0, NaN ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns NaN' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); v = cinv( new Complex128( NaN, NaN ) ); - t.strictEqual( isnan( real( v ) ), true, 'returns NaN' ); - t.strictEqual( isnan( imag( v ) ), true, 'returns NaN' ); + t.strictEqual( isnan( real( v ) ), true, 'returns expected value' ); + t.strictEqual( isnan( imag( v ) ), true, 'returns expected value' ); t.end(); });