diff --git a/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.at.js b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.at.js new file mode 100644 index 000000000000..a3d06d6c399c --- /dev/null +++ b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.at.js @@ -0,0 +1,83 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var Float64Array = require( './../lib' ); + + +// MAIN // + +bench( format( '%s::nonnegative_indices:at', pkg ), function benchmark( b ) { + var arr; + var N; + var v; + var i; + + arr = new Float64Array( 10 ); + for ( i = 0; i < arr.length; i++ ) { + arr[ i ] = i; + } + N = arr.length; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = arr.at( i%N ); + if ( typeof v !== 'number' ) { + b.fail( 'should return a number' ); + } + } + b.toc(); + if ( typeof v !== 'number' ) { + b.fail( 'should return a number' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( format( '%s::negative_indices:at', pkg ), function benchmark( b ) { + var arr; + var N; + var v; + var i; + + arr = new Float64Array( 10 ); + for ( i = 0; i < arr.length; i++ ) { + arr[ i ] = i; + } + N = arr.length; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = arr.at( -(i%N)-1 ); + if ( typeof v !== 'number' ) { + b.fail( 'should return a number' ); + } + } + b.toc(); + if ( typeof v !== 'number' ) { + b.fail( 'should return a number' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.find_last.js b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.find_last.js new file mode 100644 index 000000000000..a8d0a86767e4 --- /dev/null +++ b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.find_last.js @@ -0,0 +1,55 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var Float64Array = require( './../lib' ); + + +// MAIN // + +bench( format( '%s:findLast', pkg ), function benchmark( b ) { + var arr; + var v; + var i; + + arr = new Float64Array( [ 1, 2, 3, 4, 5, 6 ] ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = arr.findLast( predicate ); + if ( typeof v !== 'number' ) { + b.fail( 'should return a number' ); + } + } + b.toc(); + if ( typeof v !== 'number' ) { + b.fail( 'should return a number' ); + } + b.pass( 'benchmark finished' ); + b.end(); + + function predicate( v ) { + return ( v > 0.0 ); + } +}); diff --git a/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.find_last.length.js b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.find_last.length.js new file mode 100644 index 000000000000..5f63bf72b921 --- /dev/null +++ b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.find_last.length.js @@ -0,0 +1,115 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var Float64Array = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Predicate function. +* +* @private +* @param {number} value - array element +* @param {NonNegativeInteger} idx - array element index +* @param {Float64Array} arr - array instance +* @returns {boolean} boolean indicating whether a value passes a test +*/ +function predicate( value ) { + return ( value < 0.0 ); +} + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var arr; + var i; + + arr = new Float64Array( len ); + arr[ 0 ] = -1.0; + for ( i = 1; i < len; i++ ) { + arr[ i ] = i; + } + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var v; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = arr.findLast( predicate ); + if ( typeof v !== 'number' ) { + b.fail( 'should return a number' ); + } + } + b.toc(); + if ( typeof v !== 'number' ) { + b.fail( 'should return a number' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( format( '%s:findLast:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.find_last_index.js b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.find_last_index.js new file mode 100644 index 000000000000..79b07ad5fa4a --- /dev/null +++ b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.find_last_index.js @@ -0,0 +1,56 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var Float64Array = require( './../lib' ); + + +// MAIN // + +bench( format( '%s:findLastIndex', pkg ), function benchmark( b ) { + var arr; + var idx; + var i; + + arr = new Float64Array( [ 1, 2, 3, 4, 5, 6 ] ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + idx = arr.findLastIndex( predicate ); + if ( typeof idx !== 'number' ) { + b.fail( 'should return an integer' ); + } + } + b.toc(); + if ( !isInteger( idx ) ) { + b.fail( 'should return an integer' ); + } + b.pass( 'benchmark finished' ); + b.end(); + + function predicate( v ) { + return ( v > 0.0 ); + } +}); diff --git a/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.find_last_index.length.js b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.find_last_index.length.js new file mode 100644 index 000000000000..a982853ab059 --- /dev/null +++ b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.find_last_index.length.js @@ -0,0 +1,116 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var Float64Array = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Predicate function. +* +* @private +* @param {number} value - array element +* @param {NonNegativeInteger} idx - array element index +* @param {Float64Array} arr - array instance +* @returns {boolean} boolean indicating whether a value passes a test +*/ +function predicate( value ) { + return ( value < 0.0 ); +} + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var arr; + var i; + + arr = new Float64Array( len ); + arr[ 0 ] = -1.0; + for ( i = 1; i < len; i++ ) { + arr[ i ] = i; + } + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var idx; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + idx = arr.findLastIndex( predicate ); + if ( typeof idx !== 'number' ) { + b.fail( 'should return an integer' ); + } + } + b.toc(); + if ( !isInteger( idx ) ) { + b.fail( 'should return an integer' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( format( '%s:findLastIndex:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.keys.length.js b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.keys.length.js new file mode 100644 index 000000000000..f2945317281c --- /dev/null +++ b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.keys.length.js @@ -0,0 +1,102 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var isIteratorLike = require( '@stdlib/assert/is-iterator-like' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var Float64Array = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var arr; + var i; + + arr = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + arr[ i ] = i; + } + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var iter; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + iter = arr.keys(); + if ( typeof iter !== 'object' ) { + b.fail( 'should return an object' ); + } + } + b.toc(); + if ( !isIteratorLike( iter ) ) { + b.fail( 'should return an iterator protocol-compliant object' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( format( '%s:keys:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.to_reversed.js b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.to_reversed.js new file mode 100644 index 000000000000..37d15bc7fee7 --- /dev/null +++ b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.to_reversed.js @@ -0,0 +1,52 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isFloat64Array = require( '@stdlib/assert/is-float64array' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var Float64Array = require( './../lib' ); + + +// MAIN // + +bench( format( '%s:toReversed', pkg ), function benchmark( b ) { + var out; + var arr; + var i; + + arr = new Float64Array( [ 1, 2, 3, 4, 5, 6 ] ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = arr.toReversed(); + if ( typeof out !== 'object' ) { + b.fail( 'should return an object' ); + } + } + b.toc(); + if ( !isFloat64Array( out ) ) { + b.fail( 'should return a Float64Array' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.to_reversed.length.js b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.to_reversed.length.js new file mode 100644 index 000000000000..435f7e9718e8 --- /dev/null +++ b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.to_reversed.length.js @@ -0,0 +1,102 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isFloat64Array = require( '@stdlib/assert/is-float64array' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var Float64Array = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var arr; + var i; + + arr = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + arr[ i ] = i; + } + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = arr.toReversed(); + if ( typeof out !== 'object' ) { + b.fail( 'should return an object' ); + } + } + b.toc(); + if ( !isFloat64Array( out ) ) { + b.fail( 'should return a Float64Array' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( format( '%s:toReversed:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.to_sorted.js b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.to_sorted.js new file mode 100644 index 000000000000..064ec9f5e1c7 --- /dev/null +++ b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.to_sorted.js @@ -0,0 +1,73 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isFloat64Array = require( '@stdlib/assert/is-float64array' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var Float64Array = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Comparison function. +* +* @private +* @param {number} a - first value for comparison +* @param {number} b - second value for comparison +* @returns {number} comparison result +*/ +function compareFcn( a, b ) { + if ( a < b ) { + return -1; + } + if ( a > b ) { + return 1; + } + return 0; +} + + +// MAIN // + +bench( format( '%s:toSorted', pkg ), function benchmark( b ) { + var out; + var arr; + var i; + + arr = new Float64Array( [ 1, 2, 3, 4, 5, 6 ] ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = arr.toSorted( compareFcn ); + if ( typeof out !== 'object' ) { + b.fail( 'should return an object' ); + } + } + b.toc(); + if ( !isFloat64Array( out ) ) { + b.fail( 'should return a Float64Array' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.to_sorted.length.js b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.to_sorted.length.js new file mode 100644 index 000000000000..c43d25655b1c --- /dev/null +++ b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.to_sorted.length.js @@ -0,0 +1,120 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isFloat64Array = require( '@stdlib/assert/is-float64array' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var Float64Array = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Comparison function. +* +* @private +* @param {number} a - first value for comparison +* @param {number} b - second value for comparison +* @returns {number} comparison result +*/ +function compareFcn( a, b ) { + if ( a < b ) { + return -1; + } + if ( a > b ) { + return 1; + } + return 0; +} + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var arr; + var i; + + arr = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + arr[ i ] = i; + } + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = arr.toSorted( compareFcn ); + if ( typeof out !== 'object' ) { + b.fail( 'should return an object' ); + } + } + b.toc(); + if ( !isFloat64Array( out ) ) { + b.fail( 'should return a Float64Array' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( format( '%s:toSorted:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.values.length.js b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.values.length.js new file mode 100644 index 000000000000..0d61cba11f57 --- /dev/null +++ b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.values.length.js @@ -0,0 +1,102 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var isIteratorLike = require( '@stdlib/assert/is-iterator-like' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var Float64Array = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var arr; + var i; + + arr = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + arr[ i ] = i; + } + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var iter; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + iter = arr.values(); + if ( typeof iter !== 'object' ) { + b.fail( 'should return an object' ); + } + } + b.toc(); + if ( !isIteratorLike( iter ) ) { + b.fail( 'should return an iterator protocol-compliant object' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( format( '%s:values:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.with.js b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.with.js new file mode 100644 index 000000000000..f6388969efab --- /dev/null +++ b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.with.js @@ -0,0 +1,54 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isFloat64Array = require( '@stdlib/assert/is-float64array' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var Float64Array = require( './../lib' ); + + +// MAIN // + +bench( format( '%s:with', pkg ), function benchmark( b ) { + var values; + var arr; + var out; + var i; + + values = [ 1.0, 2.0, 3.0 ]; + arr = new Float64Array( 5 ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = arr.with( i%arr.length, values[ i%values.length ] ); + if ( typeof out !== 'object' ) { + b.fail( 'should return an object' ); + } + } + b.toc(); + if ( !isFloat64Array( out ) ) { + b.fail( 'should return a Float64Array' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.with.length.js b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.with.length.js new file mode 100644 index 000000000000..353c43356cd9 --- /dev/null +++ b/lib/node_modules/@stdlib/array/float64/benchmark/benchmark.with.length.js @@ -0,0 +1,98 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var isFloat64Array = require( '@stdlib/assert/is-float64array' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var Float64Array = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var arr = new Float64Array( len ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var values; + var out; + var i; + + values = [ 1.0, 2.0, 3.0 ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = arr.with( i%len, values[ i%values.length ] ); + if ( typeof out !== 'object' ) { + b.fail( 'should return an object' ); + } + } + b.toc(); + if ( !isFloat64Array( out ) ) { + b.fail( 'should return a Float64Array' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( format( '%s:with:len=%d', pkg, len ), f ); + } +} + +main();