diff --git a/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/benchmark.js index b75cdf493268..eccb66df9704 100644 --- a/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/benchmark.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2020 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var pkg = require( './../package.json' ).name; var rsqrtf = require( './../lib' ); @@ -34,10 +34,13 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = randu( 100, 0.0, 100000.0, { + 'dtype': 'float32' + }); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*100000.0 ) - 0.0; - y = rsqrtf( x ); + y = rsqrtf( x[ i % x.length ] ); if ( isnanf( y ) ) { b.fail( 'should not return NaN' ); } @@ -55,10 +58,13 @@ bench( pkg+'::built-in', function benchmark( b ) { var y; var i; + x = randu( 100, 0.0, 100000.0, { + 'dtype': 'float32' + }); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*100000.0 ) - 0.0; - y = 1.0 / Math.sqrt( x ); // eslint-disable-line stdlib/no-builtin-math + y = 1.0 / Math.sqrt( x[ i % x.length ] ); // eslint-disable-line stdlib/no-builtin-math if ( isnanf( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/benchmark.native.js index b60eeb0ce6d1..0d97b2484bf4 100644 --- a/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/benchmark.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2020 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var randu = require( '@stdlib/random/array/uniform' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -43,10 +43,13 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var i; + x = randu( 100, 0.0, 100000.0, { + 'dtype': 'float32' + }); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*100000.0 ) - 0.0; - y = rsqrtf( x ); + y = rsqrtf( x[ i % x.length ] ); if ( isnanf( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/c/Makefile b/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/c/Makefile index cb39cc3fddb7..635d877081d5 100644 --- a/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/c/Makefile +++ b/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/c/Makefile @@ -1,7 +1,7 @@ #/ # @license Apache-2.0 # -# Copyright (c) 2020 The Stdlib Authors. +# Copyright (c) 2025 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ # limitations under the License. #/ - # VARIABLES # ifndef VERBOSE diff --git a/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/c/benchmark.c index 4c7d75ca5921..08a16a5c864d 100644 --- a/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/c/benchmark.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2020 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -90,15 +90,18 @@ static float rand_float( void ) { */ static double benchmark( void ) { double elapsed; - float x; - float y; + float x[ 100 ]; double t; + float y; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = 100000.0f * rand_float(); + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = rand_float() * 100000.0f; - y = 1.0f / sqrtf( x ); + y = 1.0f / sqrtf( x[ i % 100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/c/native/Makefile b/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/c/native/Makefile index 0577f1d40d44..5d7e79f50788 100644 --- a/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/c/native/Makefile +++ b/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/c/native/Makefile @@ -1,7 +1,7 @@ #/ # @license Apache-2.0 # -# Copyright (c) 2020 The Stdlib Authors. +# Copyright (c) 2025 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -88,15 +88,15 @@ c_targets := benchmark.out # RULES # #/ -# Compiles source files. +# Compiles C source files. # -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files +# @param {string} SOURCE_FILES - list of C source files +# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop`) +# @param {string} [LIBRARIES] - list of libraries (e.g., `-lpthread -lblas`) # @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) +# @param {string} [C_COMPILER] - C compiler +# @param {string} [CFLAGS] - C compiler flags +# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code # # @example # make @@ -112,13 +112,13 @@ all: $(c_targets) # Compiles C source files. # # @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) +# @param {string} SOURCE_FILES - list of C source files +# @param {(string|void)} INCLUDE - list of includes (e.g., `-I /foo/bar -I /beep/boop`) +# @param {(string|void)} LIBRARIES - list of libraries (e.g., `-lpthread -lblas`) +# @param {(string|void)} LIBPATH - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) +# @param {string} CC - C compiler +# @param {string} CFLAGS - C compiler flags +# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code #/ $(c_targets): %.out: %.c $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) diff --git a/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/c/native/benchmark.c index ca30b90b6814..091a4f718151 100644 --- a/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/rsqrtf/benchmark/c/native/benchmark.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2020 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -91,15 +91,18 @@ static float rand_float( void ) { */ static double benchmark( void ) { double elapsed; - float x; - float y; + float x[ 100 ]; double t; + float y; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = 100000.0f * rand_float(); + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = rand_float() * 100000.0f; - y = stdlib_base_rsqrtf( x ); + y = stdlib_base_rsqrtf( x[ i % 100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break;