diff --git a/lib/node_modules/@stdlib/ndarray/base/any/README.md b/lib/node_modules/@stdlib/ndarray/base/any/README.md new file mode 100644 index 000000000000..8021d15623f0 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/README.md @@ -0,0 +1,146 @@ + + +# any + +> Test whether at least one element in an ndarray is truthy. + +
+ +
+ + + +
+ +## Usage + +```javascript +var any = require( '@stdlib/ndarray/base/any' ); +``` + +#### any( arrays ) + +Tests whether at least one element in an ndarray is truthy. + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +// Create a data buffer: +var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); + +// Define the shape of the input array: +var shape = [ 3, 1, 2 ]; + +// Define the array strides: +var sx = [ 4, 4, 1 ]; + +// Define the index offset: +var ox = 0; + +// Create the input ndarray-like object: +var x = { + 'dtype': 'float64', + 'data': xbuf, + 'shape': shape, + 'strides': sx, + 'offset': ox, + 'order': 'row-major' +}; + +// Test elements: +var out = any( [ x ] ); +// returns true +``` + +The function accepts the following arguments: + +- **arrays**: array-like object containing an input ndarray. + +The provided ndarray should be an `object` with the following properties: + +- **dtype**: data type. +- **data**: data buffer. +- **shape**: dimensions. +- **strides**: stride lengths. +- **offset**: index offset. +- **order**: specifies whether an ndarray is row-major (C-style) or column major (Fortran-style). + +
+ + + +
+ +## Notes + +- For very high-dimensional ndarrays which are non-contiguous, one should consider copying the underlying data to contiguous memory before performing the operation in order to achieve better performance. +- If provided an empty ndarray, the function returns `false`. + +
+ + + +
+ +## Examples + + + +```javascript +var bernoulli = require( '@stdlib/random/array/bernoulli' ); +var ndarray2array = require( '@stdlib/ndarray/base/to-array' ); +var any = require( '@stdlib/ndarray/base/any' ); + +var x = { + 'dtype': 'generic', + 'data': bernoulli( 10, 0.9, { + 'dtype': 'generic' + }), + 'shape': [ 5, 2 ], + 'strides': [ 2, 1 ], + 'offset': 0, + 'order': 'row-major' +}; +console.log( ndarray2array( x.data, x.shape, x.strides, x.offset, x.order ) ); + +var out = any( [ x ] ); +console.log( out ); +``` + +
+ + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.1d_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.1d_rowmajor.js similarity index 93% rename from lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.1d_rowmajor.js rename to lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.1d_rowmajor.js index 98a753743bff..3a7c457abde4 100644 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.1d_rowmajor.js +++ b/lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.1d_rowmajor.js @@ -23,10 +23,10 @@ var bench = require( '@stdlib/bench' ); var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var pow = require( '@stdlib/math/base/special/pow' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); var pkg = require( './../package.json' ).name; -var every = require( './../lib' ); +var any = require( './../lib' ); // VARIABLES // @@ -49,7 +49,7 @@ var order = 'row-major'; function createBenchmark( len, shape, xtype ) { var x; - x = discreteUniform( len, 1, 100 ); + x = zeros( len, xtype ); x = { 'dtype': xtype, 'data': x, @@ -72,7 +72,7 @@ function createBenchmark( len, shape, xtype ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - out = every( [ x ] ); + out = any( [ x ] ); if ( typeof out !== 'boolean' ) { b.fail( 'should return a boolean' ); } diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.2d_blocked_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.2d_blocked_columnmajor.js similarity index 94% rename from lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.2d_blocked_columnmajor.js rename to lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.2d_blocked_columnmajor.js index 11ca50fcb8fe..8004a0db3986 100644 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.2d_blocked_columnmajor.js +++ b/lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.2d_blocked_columnmajor.js @@ -25,10 +25,10 @@ var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var pow = require( '@stdlib/math/base/special/pow' ); var sqrt = require( '@stdlib/math/base/special/sqrt' ); var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); var pkg = require( './../package.json' ).name; -var every = require( './../lib/2d_blocked.js' ); +var any = require( './../lib/2d_blocked.js' ); // VARIABLES // @@ -51,7 +51,7 @@ var order = 'column-major'; function createBenchmark( len, shape, xtype ) { var x; - x = discreteUniform( len, 1, 100 ); + x = zeros( len, xtype ); x = { 'dtype': xtype, 'data': x, @@ -74,7 +74,7 @@ function createBenchmark( len, shape, xtype ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - out = every( x ); + out = any( x ); if ( typeof out !== 'boolean' ) { b.fail( 'should return a boolean' ); } diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.2d_blocked_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.2d_blocked_rowmajor.js similarity index 94% rename from lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.2d_blocked_rowmajor.js rename to lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.2d_blocked_rowmajor.js index 1f21b678284e..a9d6bc45fb49 100644 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.2d_blocked_rowmajor.js +++ b/lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.2d_blocked_rowmajor.js @@ -25,10 +25,10 @@ var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var pow = require( '@stdlib/math/base/special/pow' ); var sqrt = require( '@stdlib/math/base/special/sqrt' ); var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); var pkg = require( './../package.json' ).name; -var every = require( './../lib/2d_blocked.js' ); +var any = require( './../lib/2d_blocked.js' ); // VARIABLES // @@ -51,7 +51,7 @@ var order = 'row-major'; function createBenchmark( len, shape, xtype ) { var x; - x = discreteUniform( len, 1, 100 ); + x = zeros( len, xtype ); x = { 'dtype': xtype, 'data': x, @@ -74,7 +74,7 @@ function createBenchmark( len, shape, xtype ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - out = every( x ); + out = any( x ); if ( typeof out !== 'boolean' ) { b.fail( 'should return a boolean' ); } diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.2d_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.2d_columnmajor.js similarity index 94% rename from lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.2d_columnmajor.js rename to lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.2d_columnmajor.js index 80c50c4a081d..cb5032322d81 100644 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.2d_columnmajor.js +++ b/lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.2d_columnmajor.js @@ -25,10 +25,10 @@ var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var pow = require( '@stdlib/math/base/special/pow' ); var sqrt = require( '@stdlib/math/base/special/sqrt' ); var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); var pkg = require( './../package.json' ).name; -var every = require( './../lib/2d.js' ); +var any = require( './../lib/2d.js' ); // VARIABLES // @@ -51,7 +51,7 @@ var order = 'column-major'; function createBenchmark( len, shape, xtype ) { var x; - x = discreteUniform( len, 1, 100 ); + x = zeros( len, xtype ); x = { 'dtype': xtype, 'data': x, @@ -74,7 +74,7 @@ function createBenchmark( len, shape, xtype ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - out = every( x ); + out = any( x ); if ( typeof out !== 'boolean' ) { b.fail( 'should return a boolean' ); } diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.2d_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.2d_rowmajor.js similarity index 94% rename from lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.2d_rowmajor.js rename to lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.2d_rowmajor.js index d781f3797128..9601b5214d45 100644 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.2d_rowmajor.js +++ b/lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.2d_rowmajor.js @@ -25,10 +25,10 @@ var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var pow = require( '@stdlib/math/base/special/pow' ); var sqrt = require( '@stdlib/math/base/special/sqrt' ); var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); var pkg = require( './../package.json' ).name; -var every = require( './../lib/2d.js' ); +var any = require( './../lib/2d.js' ); // VARIABLES // @@ -51,7 +51,7 @@ var order = 'row-major'; function createBenchmark( len, shape, xtype ) { var x; - x = discreteUniform( len, 1, 100 ); + x = zeros( len, xtype ); x = { 'dtype': xtype, 'data': x, @@ -74,7 +74,7 @@ function createBenchmark( len, shape, xtype ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - out = every( x ); + out = any( x ); if ( typeof out !== 'boolean' ) { b.fail( 'should return a boolean' ); } diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.2d_rowmajor_accessors.js b/lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.2d_rowmajor_accessors.js similarity index 94% rename from lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.2d_rowmajor_accessors.js rename to lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.2d_rowmajor_accessors.js index 2847079beb40..927aae280493 100644 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.2d_rowmajor_accessors.js +++ b/lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.2d_rowmajor_accessors.js @@ -25,10 +25,10 @@ var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var pow = require( '@stdlib/math/base/special/pow' ); var sqrt = require( '@stdlib/math/base/special/sqrt' ); var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); var pkg = require( './../package.json' ).name; -var every = require( './../lib/2d_accessors.js' ); +var any = require( './../lib/2d_accessors.js' ); // VARIABLES // @@ -75,7 +75,7 @@ function set( buf, idx, value ) { function createBenchmark( len, shape, xtype ) { var x; - x = discreteUniform( len, 1, 100 ); + x = zeros( len, xtype ); x = { 'dtype': xtype, 'data': x, @@ -100,7 +100,7 @@ function createBenchmark( len, shape, xtype ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - out = every( x ); + out = any( x ); if ( typeof out !== 'boolean' ) { b.fail( 'should return a boolean' ); } diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.3d_blocked_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.3d_blocked_columnmajor.js similarity index 94% rename from lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.3d_blocked_columnmajor.js rename to lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.3d_blocked_columnmajor.js index 479b81e31846..d754df7cca6f 100644 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.3d_blocked_columnmajor.js +++ b/lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.3d_blocked_columnmajor.js @@ -25,10 +25,10 @@ var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var pow = require( '@stdlib/math/base/special/pow' ); var cbrt = require( '@stdlib/math/base/special/cbrt' ); var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); var pkg = require( './../package.json' ).name; -var every = require( './../lib/3d_blocked.js' ); +var any = require( './../lib/3d_blocked.js' ); // VARIABLES // @@ -51,7 +51,7 @@ var order = 'column-major'; function createBenchmark( len, shape, xtype ) { var x; - x = discreteUniform( len, 1, 100 ); + x = zeros( len, xtype ); x = { 'dtype': xtype, 'data': x, @@ -74,7 +74,7 @@ function createBenchmark( len, shape, xtype ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - out = every( x ); + out = any( x ); if ( typeof out !== 'boolean' ) { b.fail( 'should return a boolean' ); } diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.3d_blocked_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.3d_blocked_rowmajor.js similarity index 94% rename from lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.3d_blocked_rowmajor.js rename to lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.3d_blocked_rowmajor.js index 78648e8faf42..e810430eca5d 100644 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.3d_blocked_rowmajor.js +++ b/lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.3d_blocked_rowmajor.js @@ -25,10 +25,10 @@ var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var pow = require( '@stdlib/math/base/special/pow' ); var cbrt = require( '@stdlib/math/base/special/cbrt' ); var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); var pkg = require( './../package.json' ).name; -var every = require( './../lib/3d_blocked.js' ); +var any = require( './../lib/3d_blocked.js' ); // VARIABLES // @@ -51,7 +51,7 @@ var order = 'row-major'; function createBenchmark( len, shape, xtype ) { var x; - x = discreteUniform( len, 1, 100 ); + x = zeros( len, xtype ); x = { 'dtype': xtype, 'data': x, @@ -74,7 +74,7 @@ function createBenchmark( len, shape, xtype ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - out = every( x ); + out = any( x ); if ( typeof out !== 'boolean' ) { b.fail( 'should return a boolean' ); } diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.3d_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.3d_columnmajor.js similarity index 94% rename from lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.3d_columnmajor.js rename to lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.3d_columnmajor.js index c35a1a4743bf..fc3128bfe838 100644 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.3d_columnmajor.js +++ b/lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.3d_columnmajor.js @@ -25,10 +25,10 @@ var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var pow = require( '@stdlib/math/base/special/pow' ); var cbrt = require( '@stdlib/math/base/special/cbrt' ); var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); var pkg = require( './../package.json' ).name; -var every = require( './../lib/3d.js' ); +var any = require( './../lib/3d.js' ); // VARIABLES // @@ -51,7 +51,7 @@ var order = 'column-major'; function createBenchmark( len, shape, xtype ) { var x; - x = discreteUniform( len, 1, 100 ); + x = zeros( len, xtype ); x = { 'dtype': xtype, 'data': x, @@ -74,7 +74,7 @@ function createBenchmark( len, shape, xtype ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - out = every( x ); + out = any( x ); if ( typeof out !== 'boolean' ) { b.fail( 'should return a boolean' ); } diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.3d_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.3d_rowmajor.js similarity index 94% rename from lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.3d_rowmajor.js rename to lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.3d_rowmajor.js index cc9d8354d230..84a86c6a4566 100644 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.3d_rowmajor.js +++ b/lib/node_modules/@stdlib/ndarray/base/any/benchmark/benchmark.3d_rowmajor.js @@ -25,10 +25,10 @@ var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var pow = require( '@stdlib/math/base/special/pow' ); var cbrt = require( '@stdlib/math/base/special/cbrt' ); var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); var pkg = require( './../package.json' ).name; -var every = require( './../lib/3d.js' ); +var any = require( './../lib/3d.js' ); // VARIABLES // @@ -51,7 +51,7 @@ var order = 'row-major'; function createBenchmark( len, shape, xtype ) { var x; - x = discreteUniform( len, 1, 100 ); + x = zeros( len, xtype ); x = { 'dtype': xtype, 'data': x, @@ -74,7 +74,7 @@ function createBenchmark( len, shape, xtype ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - out = every( x ); + out = any( x ); if ( typeof out !== 'boolean' ) { b.fail( 'should return a boolean' ); } diff --git a/lib/node_modules/@stdlib/ndarray/base/any/docs/repl.txt b/lib/node_modules/@stdlib/ndarray/base/any/docs/repl.txt new file mode 100644 index 000000000000..c1d7ddd3460c --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/docs/repl.txt @@ -0,0 +1,56 @@ + +{{alias}}( arrays ) + Tests whether at least one element in an ndarray is truthy. + + A provided "ndarray" should be an `object` with the following properties: + + - dtype: data type. + - data: data buffer. + - shape: dimensions. + - strides: stride lengths. + - offset: index offset. + - order: specifies whether an ndarray is row-major (C-style) or column-major + (Fortran-style). + + If provided an empty ndarray, the function returns `false`. + + Parameters + ---------- + arrays: ArrayLikeObject + Array-like object containing an input ndarray. + + Returns + ------- + out: boolean + Boolean indicating whether at least one element in an ndarray is truthy. + + Examples + -------- + // Define ndarray data and meta data... + > var xbuf = new {{alias:@stdlib/array/float64}}( [ 1.0, 0.0, 1.0, 0.0 ] ); + > var dt = 'float64'; + > var sh = [ 2, 2 ]; + > var sx = [ 2, 1 ]; + > var ox = 0; + > var ord = 'row-major'; + + // Using an ndarray... + > var x = {{alias:@stdlib/ndarray/ctor}}( dt, xbuf, sh, sx, ox, ord ); + > {{alias}}( [ x ] ) + true + + // Using a minimal ndarray-like object... + > xbuf = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] ); + > x = { + ... 'dtype': dt, + ... 'data': xbuf, + ... 'shape': sh, + ... 'strides': sx, + ... 'offset': ox, + ... 'order': ord + ... }; + > {{alias}}( [ x ] ) + false + + See Also + -------- diff --git a/lib/node_modules/@stdlib/ndarray/base/any/docs/types/index.d.ts b/lib/node_modules/@stdlib/ndarray/base/any/docs/types/index.d.ts new file mode 100644 index 000000000000..eb3a9318f855 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/docs/types/index.d.ts @@ -0,0 +1,59 @@ +/* +* @license Apache-2.0 +* +* 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. +* 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. +*/ + +// TypeScript Version: 4.1 + +/// + +import { ArrayLike } from '@stdlib/types/array'; +import { typedndarray } from '@stdlib/types/ndarray'; + +/** +* Tests whether at least one element in an ndarray is truthy. +* +* @param arrays - array-like object containing an input ndarray +* @returns boolean indicating whether at least one element is truthy +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* // Create a data buffer: +* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); +* +* // Define the shape of the array: +* var shape = [ 3, 1, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 4, 1 ]; +* +* // Define the index offset: +* var ox = 1; +* +* // Create the input ndarray: +* var x = ndarray( 'float64', xbuf, shape, sx, ox, 'row-major' ); +* +* // Test elements: +* var out = any( [ x ] ); +* // returns true +*/ +declare function any( arrays: ArrayLike> ): boolean; + + +// EXPORTS // + +export = any; diff --git a/lib/node_modules/@stdlib/ndarray/base/any/docs/types/test.ts b/lib/node_modules/@stdlib/ndarray/base/any/docs/types/test.ts new file mode 100644 index 000000000000..8ef3d9e95b74 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/docs/types/test.ts @@ -0,0 +1,54 @@ +/* +* @license Apache-2.0 +* +* 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. +* 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. +*/ + +/// + +import zeros = require( '@stdlib/ndarray/zeros' ); +import any = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + const x = zeros( [ 2, 2 ] ); + const arrays = [ x ]; + + any( arrays ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided a first argument which is not an array-like object containing ndarray-like objects... +{ + any( 5 ); // $ExpectError + any( true ); // $ExpectError + any( false ); // $ExpectError + any( null ); // $ExpectError + any( undefined ); // $ExpectError + any( {} ); // $ExpectError + any( [ 1 ] ); // $ExpectError + any( ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const x = zeros( [ 2, 2 ] ); + const arrays = [ x ]; + + any(); // $ExpectError + any( arrays, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/ndarray/base/any/examples/index.js b/lib/node_modules/@stdlib/ndarray/base/any/examples/index.js new file mode 100644 index 000000000000..df00c79ffdc6 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/examples/index.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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'; + +var bernoulli = require( '@stdlib/random/array/bernoulli' ); +var ndarray2array = require( '@stdlib/ndarray/base/to-array' ); +var any = require( './../lib' ); + +var x = { + 'dtype': 'generic', + 'data': bernoulli( 10, 0.9, { + 'dtype': 'generic' + }), + 'shape': [ 5, 2 ], + 'strides': [ 2, 1 ], + 'offset': 0, + 'order': 'row-major' +}; +console.log( ndarray2array( x.data, x.shape, x.strides, x.offset, x.order ) ); + +var out = any( [ x ] ); +console.log( out ); diff --git a/lib/node_modules/@stdlib/ndarray/base/any/lib/0d.js b/lib/node_modules/@stdlib/ndarray/base/any/lib/0d.js new file mode 100644 index 000000000000..9c0eef508b86 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/lib/0d.js @@ -0,0 +1,75 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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'; + +// MAIN // + +/** +* Tests whether at least one element in an ndarray is truthy. +* +* @private +* @param {Object} x - object containing ndarray meta data +* @param {string} x.dtype - data type +* @param {Collection} x.data - data buffer +* @param {NonNegativeIntegerArray} x.shape - dimensions +* @param {IntegerArray} x.strides - stride lengths +* @param {NonNegativeInteger} x.offset - index offset +* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) +* @returns {boolean} result +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* // Create a data buffer: +* var xbuf = new Float64Array( [ 1.0, 2.0 ] ); +* +* // Define the shape of the input array: +* var shape = []; +* +* // Define the array strides: +* var sx = [ 0 ]; +* +* // Define the index offset: +* var ox = 1; +* +* // Create the input ndarray-like object: +* var x = { +* 'dtype': 'float64', +* 'data': xbuf, +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* // Test elements: +* var out = any0d( x ); +* // returns true +*/ +function any0d( x ) { + if ( x.data[ x.offset ] ) { + return true; + } + return false; +} + + +// EXPORTS // + +module.exports = any0d; diff --git a/lib/node_modules/@stdlib/ndarray/base/any/lib/0d_accessors.js b/lib/node_modules/@stdlib/ndarray/base/any/lib/0d_accessors.js new file mode 100644 index 000000000000..e42e68d3a6b8 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/lib/0d_accessors.js @@ -0,0 +1,78 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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'; + +// MAIN // + +/** +* Tests whether at least one element in an ndarray is truthy. +* +* @private +* @param {Object} x - object containing ndarray meta data +* @param {string} x.dtype - data type +* @param {Collection} x.data - data buffer +* @param {NonNegativeIntegerArray} x.shape - dimensions +* @param {IntegerArray} x.strides - stride lengths +* @param {NonNegativeInteger} x.offset - index offset +* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) +* @param {Array} x.accessors - data buffer accessors +* @returns {boolean} result +* +* @example +* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +* var accessors = require( '@stdlib/array/base/accessors' ); +* +* // Create a data buffer: +* var xbuf = toAccessorArray( [ 1.0, 2.0 ] ); +* +* // Define the shape of the input array: +* var shape = []; +* +* // Define the array strides: +* var sx = [ 0 ]; +* +* // Define the index offset: +* var ox = 1; +* +* // Create the input ndarray-like object: +* var x = { +* 'dtype': 'generic', +* 'data': xbuf, +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': accessors( xbuf ).accessors +* }; +* +* // Test elements: +* var out = any0d( x ); +* // returns true +*/ +function any0d( x ) { + if ( x.accessors[ 0 ]( x.data, x.offset ) ) { + return true; + } + return false; +} + + +// EXPORTS // + +module.exports = any0d; diff --git a/lib/node_modules/@stdlib/ndarray/base/any/lib/0d_complex.js b/lib/node_modules/@stdlib/ndarray/base/any/lib/0d_complex.js new file mode 100644 index 000000000000..69141b8d3fcf --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/lib/0d_complex.js @@ -0,0 +1,75 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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'; + +// MAIN // + +/** +* Tests whether at least one element of a reinterpreted complex number ndarray is truthy. +* +* @private +* @param {Object} x - object containing ndarray meta data +* @param {string} x.dtype - data type +* @param {Collection} x.data - data buffer +* @param {NonNegativeIntegerArray} x.shape - dimensions +* @param {IntegerArray} x.strides - stride lengths +* @param {NonNegativeInteger} x.offset - index offset +* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) +* @returns {boolean} result +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* // Create a data buffer: +* var xbuf = new Float64Array( [ 1.0, 2.0 ] ); +* +* // Define the shape of the input array: +* var shape = []; +* +* // Define the array strides: +* var sx = [ 0 ]; +* +* // Define the index offset: +* var ox = 0; +* +* // Create the input ndarray-like object: +* var x = { +* 'dtype': 'complex128', +* 'data': xbuf, +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* // Test elements: +* var out = any0d( x ); +* // returns true +*/ +function any0d( x ) { + if ( x.data[ x.offset ] || x.data[ x.offset+1 ] ) { + return true; + } + return false; +} + + +// EXPORTS // + +module.exports = any0d; diff --git a/lib/node_modules/@stdlib/ndarray/base/any/lib/1d.js b/lib/node_modules/@stdlib/ndarray/base/any/lib/1d.js new file mode 100644 index 000000000000..ad4a3cfd28c2 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/lib/1d.js @@ -0,0 +1,97 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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'; + +// MAIN // + +/** +* Tests whether at least one element in an ndarray is truthy. +* +* @private +* @param {Object} x - object containing ndarray meta data +* @param {string} x.dtype - data type +* @param {Collection} x.data - data buffer +* @param {NonNegativeIntegerArray} x.shape - dimensions +* @param {IntegerArray} x.strides - stride lengths +* @param {NonNegativeInteger} x.offset - index offset +* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) +* @returns {boolean} result +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* // Create a data buffer: +* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* +* // Define the shape of the input array: +* var shape = [ 4 ]; +* +* // Define the array strides: +* var sx = [ 2 ]; +* +* // Define the index offset: +* var ox = 1; +* +* // Create the input ndarray-like object: +* var x = { +* 'dtype': 'float64', +* 'data': xbuf, +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* // Test elements: +* var out = any1d( x ); +* // returns true +*/ +function any1d( x ) { + var xbuf; + var dx0; + var S0; + var ix; + var i0; + + // Note on variable naming convention: S#, dx#, i# where # corresponds to the loop number, with `0` being the innermost loop... + + // Extract loop variables: dimensions and loop offset (pointer) increments: + S0 = x.shape[ 0 ]; + dx0 = x.strides[ 0 ]; + + // Set a pointer to the first indexed element: + ix = x.offset; + + // Cache a reference to the input ndarray buffer: + xbuf = x.data; + + // Iterate over the ndarray dimensions... + for ( i0 = 0; i0 < S0; i0++ ) { + if ( xbuf[ ix ] ) { + return true; + } + ix += dx0; + } + return false; +} + + +// EXPORTS // + +module.exports = any1d; diff --git a/lib/node_modules/@stdlib/ndarray/base/any/lib/1d_accessors.js b/lib/node_modules/@stdlib/ndarray/base/any/lib/1d_accessors.js new file mode 100644 index 000000000000..4108196fc8aa --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/lib/1d_accessors.js @@ -0,0 +1,104 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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'; + +// MAIN // + +/** +* Tests whether at least one element in an ndarray is truthy. +* +* @private +* @param {Object} x - object containing ndarray meta data +* @param {string} x.dtype - data type +* @param {Collection} x.data - data buffer +* @param {NonNegativeIntegerArray} x.shape - dimensions +* @param {IntegerArray} x.strides - stride lengths +* @param {NonNegativeInteger} x.offset - index offset +* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) +* @param {Array} x.accessors - data buffer accessors +* @returns {boolean} result +* +* @example +* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +* var accessors = require( '@stdlib/array/base/accessors' ); +* +* // Create a data buffer: +* var xbuf = toAccessorArray( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* +* // Define the shape of the input array: +* var shape = [ 4 ]; +* +* // Define the array strides: +* var sx = [ 1 ]; +* +* // Define the index offset: +* var ox = 0; +* +* // Create the input ndarray-like object: +* var x = { +* 'dtype': 'generic', +* 'data': xbuf, +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': accessors( xbuf ).accessors +* }; +* +* // Test elements: +* var out = any1d( x ); +* // returns true +*/ +function any1d( x ) { + var xbuf; + var get; + var dx0; + var S0; + var ix; + var i0; + + // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... + + // Extract loop variables: dimensions and loop offset (pointer) increments... + S0 = x.shape[ 0 ]; + dx0 = x.strides[ 0 ]; + + // Set a pointer to the first indexed element: + ix = x.offset; + + // Cache a reference to the input ndarray buffer: + xbuf = x.data; + + // Cache accessor: + get = x.accessors[ 0 ]; + + // Iterate over the ndarray dimensions... + for ( i0 = 0; i0 < S0; i0++ ) { + if ( get( xbuf, ix ) ) { + return true; + } + ix += dx0; + } + return false; +} + + +// EXPORTS // + +module.exports = any1d; diff --git a/lib/node_modules/@stdlib/ndarray/base/any/lib/1d_complex.js b/lib/node_modules/@stdlib/ndarray/base/any/lib/1d_complex.js new file mode 100644 index 000000000000..af3a8785882e --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/lib/1d_complex.js @@ -0,0 +1,97 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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'; + +// MAIN // + +/** +* Tests whether at least one element of a reinterpreted complex number ndarray is truthy. +* +* @private +* @param {Object} x - object containing ndarray meta data +* @param {string} x.dtype - data type +* @param {Collection} x.data - data buffer +* @param {NonNegativeIntegerArray} x.shape - dimensions +* @param {IntegerArray} x.strides - stride lengths +* @param {NonNegativeInteger} x.offset - index offset +* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) +* @returns {boolean} result +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* // Create a data buffer: +* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* +* // Define the shape of the input array: +* var shape = [ 4 ]; +* +* // Define the array strides: +* var sx = [ 2 ]; +* +* // Define the index offset: +* var ox = 0; +* +* // Create the input ndarray-like object: +* var x = { +* 'dtype': 'complex128', +* 'data': xbuf, +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* // Test elements: +* var out = any1d( x ); +* // returns true +*/ +function any1d( x ) { + var xbuf; + var dx0; + var S0; + var ix; + var i0; + + // Note on variable naming convention: S#, dx#, i# where # corresponds to the loop number, with `0` being the innermost loop... + + // Extract loop variables: dimensions and loop offset (pointer) increments: + S0 = x.shape[ 0 ]; + dx0 = x.strides[ 0 ]; + + // Set a pointer to the first indexed element: + ix = x.offset; + + // Cache a reference to the input ndarray buffer: + xbuf = x.data; + + // Iterate over the ndarray dimensions... + for ( i0 = 0; i0 < S0; i0++ ) { + if ( ( xbuf[ ix ] || xbuf[ ix+1 ] ) ) { + return true; + } + ix += dx0; + } + return false; +} + + +// EXPORTS // + +module.exports = any1d; diff --git a/lib/node_modules/@stdlib/ndarray/base/any/lib/2d.js b/lib/node_modules/@stdlib/ndarray/base/any/lib/2d.js new file mode 100644 index 000000000000..37c1bba8913b --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/lib/2d.js @@ -0,0 +1,122 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 strides2order = require( '@stdlib/ndarray/base/strides2order' ); + + +// MAIN // + +/** +* Tests whether at least one element in an ndarray is truthy. +* +* @private +* @param {Object} x - object containing ndarray meta data +* @param {string} x.dtype - data type +* @param {Collection} x.data - data buffer +* @param {NonNegativeIntegerArray} x.shape - dimensions +* @param {IntegerArray} x.strides - stride lengths +* @param {NonNegativeInteger} x.offset - index offset +* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) +* @returns {boolean} result +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* // Create a data buffer: +* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* +* // Define the shape of the input array: +* var shape = [ 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 1 ]; +* +* // Define the index offset: +* var ox = 1; +* +* // Create the input ndarray-like object: +* var x = { +* 'dtype': 'float64', +* 'data': xbuf, +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* // Test elements: +* var out = any2d( x ); +* // returns true +*/ +function any2d( x ) { + var xbuf; + var dx0; + var dx1; + var sh; + var S0; + var S1; + var sx; + var ix; + var i0; + var i1; + + // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... + + // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... + sh = x.shape; + sx = x.strides; + if ( strides2order( sx ) === 1 ) { + // For row-major ndarrays, the last dimensions have the fastest changing indices... + S0 = sh[ 1 ]; + S1 = sh[ 0 ]; + dx0 = sx[ 1 ]; // offset increment for innermost loop + dx1 = sx[ 0 ] - ( S0*sx[1] ); // offset increment for outermost loop + } else { // order === 'column-major' + // For column-major ndarrays, the first dimensions have the fastest changing indices... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + dx0 = sx[ 0 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[0] ); // offset increment for outermost loop + } + // Set a pointer to the first indexed element: + ix = x.offset; + + // Cache a reference to the input ndarray buffer: + xbuf = x.data; + + // Iterate over the ndarray dimensions... + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + if ( xbuf[ ix ] ) { + return true; + } + ix += dx0; + } + ix += dx1; + } + return false; +} + + +// EXPORTS // + +module.exports = any2d; diff --git a/lib/node_modules/@stdlib/ndarray/base/any/lib/2d_accessors.js b/lib/node_modules/@stdlib/ndarray/base/any/lib/2d_accessors.js new file mode 100644 index 000000000000..5b1f8e814e44 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/lib/2d_accessors.js @@ -0,0 +1,129 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 strides2order = require( '@stdlib/ndarray/base/strides2order' ); + + +// MAIN // + +/** +* Tests whether at least one element in an ndarray is truthy. +* +* @private +* @param {Object} x - object containing ndarray meta data +* @param {string} x.dtype - data type +* @param {Collection} x.data - data buffer +* @param {NonNegativeIntegerArray} x.shape - dimensions +* @param {IntegerArray} x.strides - stride lengths +* @param {NonNegativeInteger} x.offset - index offset +* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) +* @param {Array} x.accessors - data buffer accessors +* @returns {boolean} result +* +* @example +* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +* var accessors = require( '@stdlib/array/base/accessors' ); +* +* // Create a data buffer: +* var xbuf = toAccessorArray( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* +* // Define the shape of the input array: +* var shape = [ 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 2, 1 ]; +* +* // Define the index offset: +* var ox = 0; +* +* // Create the input ndarray-like object: +* var x = { +* 'dtype': 'generic', +* 'data': xbuf, +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': accessors( xbuf ).accessors +* }; +* +* // Test elements: +* var out = any2d( x ); +* // returns true +*/ +function any2d( x ) { + var xbuf; + var get; + var dx0; + var dx1; + var sh; + var S0; + var S1; + var sx; + var ix; + var i0; + var i1; + + // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... + + // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... + sh = x.shape; + sx = x.strides; + if ( strides2order( sx ) === 1 ) { + // For row-major ndarrays, the last dimensions have the fastest changing indices... + S0 = sh[ 1 ]; + S1 = sh[ 0 ]; + dx0 = sx[ 1 ]; // offset increment for innermost loop + dx1 = sx[ 0 ] - ( S0*sx[1] ); // offset increment for outermost loop + } else { // order === 'column-major' + // For column-major ndarrays, the first dimensions have the fastest changing indices... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + dx0 = sx[ 0 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[0] ); // offset increment for outermost loop + } + // Set a pointer to the first indexed element: + ix = x.offset; + + // Cache a reference to the input ndarray buffer: + xbuf = x.data; + + // Cache accessor: + get = x.accessors[ 0 ]; + + // Iterate over the ndarray dimensions... + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + if ( get( xbuf, ix ) ) { + return true; + } + ix += dx0; + } + ix += dx1; + } + return false; +} + + +// EXPORTS // + +module.exports = any2d; diff --git a/lib/node_modules/@stdlib/ndarray/base/any/lib/2d_blocked.js b/lib/node_modules/@stdlib/ndarray/base/any/lib/2d_blocked.js new file mode 100644 index 000000000000..f750689667c3 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/lib/2d_blocked.js @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 loopOrder = require( '@stdlib/ndarray/base/nullary-loop-interchange-order' ); +var blockSize = require( '@stdlib/ndarray/base/nullary-tiling-block-size' ); + + +// MAIN // + +/** +* Tests whether at least one element in an ndarray is truthy via loop blocking. +* +* @private +* @param {Object} x - object containing ndarray meta data +* @param {string} x.dtype - data type +* @param {Collection} x.data - data buffer +* @param {NonNegativeIntegerArray} x.shape - dimensions +* @param {IntegerArray} x.strides - stride lengths +* @param {NonNegativeInteger} x.offset - index offset +* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) +* @returns {boolean} result +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* // Create a data buffer: +* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* +* // Define the shape of the input array: +* var shape = [ 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 1 ]; +* +* // Define the index offset: +* var ox = 1; +* +* // Create the input ndarray-like object: +* var x = { +* 'dtype': 'float64', +* 'data': xbuf, +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* // Test elements: +* var out = blockedany2d( x ); +* // returns true +*/ +function blockedany2d( x ) { + var bsize; + var xbuf; + var dx0; + var dx1; + var ox1; + var sh; + var s0; + var s1; + var sx; + var ox; + var ix; + var i0; + var i1; + var j0; + var j1; + var o; + + // Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... + + // Resolve the loop interchange order: + o = loopOrder( x.shape, x.strides ); + sh = o.sh; + sx = o.sx; + + // Determine the block size: + bsize = blockSize( x.dtype ); + + // Set a pointer to the first indexed element: + ox = x.offset; + + // Cache a reference to the input ndarray buffer: + xbuf = x.data; + + // Cache the offset increment for the innermost loop: + dx0 = sx[0]; + + // Iterate over blocks... + for ( j1 = sh[1]; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + ox1 = ox + ( j1*sx[1] ); + for ( j0 = sh[0]; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + // Compute the index offset for the first input ndarray element in the current block: + ix = ox1 + ( j0*sx[0] ); + + // Compute the loop offset increment: + dx1 = sx[1] - ( s0*sx[0] ); + + // Iterate over the ndarray dimensions... + for ( i1 = 0; i1 < s1; i1++ ) { + for ( i0 = 0; i0 < s0; i0++ ) { + if ( xbuf[ ix ] ) { + return true; + } + ix += dx0; + } + ix += dx1; + } + } + } + return false; +} + + +// EXPORTS // + +module.exports = blockedany2d; diff --git a/lib/node_modules/@stdlib/ndarray/base/any/lib/2d_blocked_accessors.js b/lib/node_modules/@stdlib/ndarray/base/any/lib/2d_blocked_accessors.js new file mode 100644 index 000000000000..5843d7c1b2d2 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/lib/2d_blocked_accessors.js @@ -0,0 +1,157 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 loopOrder = require( '@stdlib/ndarray/base/nullary-loop-interchange-order' ); +var blockSize = require( '@stdlib/ndarray/base/nullary-tiling-block-size' ); + + +// MAIN // + +/** +* Tests whether at least one element in an ndarray is truthy via loop blocking. +* +* @private +* @param {Object} x - object containing ndarray meta data +* @param {string} x.dtype - data type +* @param {Collection} x.data - data buffer +* @param {NonNegativeIntegerArray} x.shape - dimensions +* @param {IntegerArray} x.strides - stride lengths +* @param {NonNegativeInteger} x.offset - index offset +* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) +* @param {Array} x.accessors - data buffer accessors +* @returns {boolean} result +* +* @example +* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +* var accessors = require( '@stdlib/array/base/accessors' ); +* +* // Create a data buffer: +* var xbuf = toAccessorArray( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* +* // Define the shape of the input array: +* var shape = [ 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 2, 1 ]; +* +* // Define the index offset: +* var ox = 0; +* +* // Create the input ndarray-like object: +* var x = { +* 'dtype': 'generic', +* 'data': xbuf, +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': accessors( xbuf ).accessors +* }; +* +* // Test elements: +* var out = blockedany2d( x ); +* // returns true +*/ +function blockedany2d( x ) { + var bsize; + var xbuf; + var get; + var dx0; + var dx1; + var ox1; + var sh; + var s0; + var s1; + var sx; + var ox; + var ix; + var i0; + var i1; + var j0; + var j1; + var o; + + // Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... + + // Resolve the loop interchange order: + o = loopOrder( x.shape, x.strides ); + sh = o.sh; + sx = o.sx; + + // Determine the block size: + bsize = blockSize( x.dtype ); + + // Set a pointer to the first indexed element: + ox = x.offset; + + // Cache a reference to the input ndarray buffer: + xbuf = x.data; + + // Cache the offset increment for the innermost loop: + dx0 = sx[0]; + + // Cache accessor: + get = x.accessors[0]; + + // Iterate over blocks... + for ( j1 = sh[1]; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + ox1 = ox + ( j1*sx[1] ); + for ( j0 = sh[0]; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + // Compute the index offset for the first input ndarray element in the current block: + ix = ox1 + ( j0*sx[0] ); + + // Compute the loop offset increment: + dx1 = sx[1] - ( s0*sx[0] ); + + // Iterate over the ndarray dimensions... + for ( i1 = 0; i1 < s1; i1++ ) { + for ( i0 = 0; i0 < s0; i0++ ) { + if ( get( xbuf, ix ) ) { + return true; + } + ix += dx0; + } + ix += dx1; + } + } + } + return false; +} + + +// EXPORTS // + +module.exports = blockedany2d; diff --git a/lib/node_modules/@stdlib/ndarray/base/any/lib/2d_blocked_complex.js b/lib/node_modules/@stdlib/ndarray/base/any/lib/2d_blocked_complex.js new file mode 100644 index 000000000000..5f0f4a271e01 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/lib/2d_blocked_complex.js @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 loopOrder = require( '@stdlib/ndarray/base/nullary-loop-interchange-order' ); +var blockSize = require( '@stdlib/ndarray/base/nullary-tiling-block-size' ); + + +// MAIN // + +/** +* Tests whether at least one element of a reinterpreted complex number ndarray is truthy via loop blocking. +* +* @private +* @param {Object} x - object containing ndarray meta data +* @param {string} x.dtype - data type +* @param {Collection} x.data - data buffer +* @param {NonNegativeIntegerArray} x.shape - dimensions +* @param {IntegerArray} x.strides - stride lengths +* @param {NonNegativeInteger} x.offset - index offset +* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) +* @returns {boolean} result +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* // Create a data buffer: +* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* +* // Define the shape of the input array: +* var shape = [ 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 2 ]; +* +* // Define the index offset: +* var ox = 0; +* +* // Create the input ndarray-like object: +* var x = { +* 'dtype': 'complex128', +* 'data': xbuf, +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* // Test elements: +* var out = blockedany2d( x ); +* // returns true +*/ +function blockedany2d( x ) { + var bsize; + var xbuf; + var dx0; + var dx1; + var ox1; + var sh; + var s0; + var s1; + var sx; + var ox; + var ix; + var i0; + var i1; + var j0; + var j1; + var o; + + // Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... + + // Resolve the loop interchange order: + o = loopOrder( x.shape, x.strides ); + sh = o.sh; + sx = o.sx; + + // Determine the block size: + bsize = blockSize( x.dtype ); + + // Set a pointer to the first indexed element: + ox = x.offset; + + // Cache a reference to the input ndarray buffer: + xbuf = x.data; + + // Cache the offset increment for the innermost loop: + dx0 = sx[0]; + + // Iterate over blocks... + for ( j1 = sh[1]; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + ox1 = ox + ( j1*sx[1] ); + for ( j0 = sh[0]; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + // Compute the index offset for the first input ndarray element in the current block: + ix = ox1 + ( j0*sx[0] ); + + // Compute the loop offset increment: + dx1 = sx[1] - ( s0*sx[0] ); + + // Iterate over the ndarray dimensions... + for ( i1 = 0; i1 < s1; i1++ ) { + for ( i0 = 0; i0 < s0; i0++ ) { + if ( ( xbuf[ ix ] || xbuf[ ix+1 ] ) ) { + return true; + } + ix += dx0; + } + ix += dx1; + } + } + } + return false; +} + + +// EXPORTS // + +module.exports = blockedany2d; diff --git a/lib/node_modules/@stdlib/ndarray/base/any/lib/2d_complex.js b/lib/node_modules/@stdlib/ndarray/base/any/lib/2d_complex.js new file mode 100644 index 000000000000..a7e2a064e511 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/lib/2d_complex.js @@ -0,0 +1,122 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 strides2order = require( '@stdlib/ndarray/base/strides2order' ); + + +// MAIN // + +/** +* Tests whether at least one element of a reinterpreted complex number ndarray is truthy. +* +* @private +* @param {Object} x - object containing ndarray meta data +* @param {string} x.dtype - data type +* @param {Collection} x.data - data buffer +* @param {NonNegativeIntegerArray} x.shape - dimensions +* @param {IntegerArray} x.strides - stride lengths +* @param {NonNegativeInteger} x.offset - index offset +* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) +* @returns {boolean} result +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* // Create a data buffer: +* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* +* // Define the shape of the input array: +* var shape = [ 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 2 ]; +* +* // Define the index offset: +* var ox = 0; +* +* // Create the input ndarray-like object: +* var x = { +* 'dtype': 'complex128', +* 'data': xbuf, +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* // Test elements: +* var out = any2d( x ); +* // returns true +*/ +function any2d( x ) { + var xbuf; + var dx0; + var dx1; + var sh; + var S0; + var S1; + var sx; + var ix; + var i0; + var i1; + + // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... + + // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... + sh = x.shape; + sx = x.strides; + if ( strides2order( sx ) === 1 ) { + // For row-major ndarrays, the last dimensions have the fastest changing indices... + S0 = sh[ 1 ]; + S1 = sh[ 0 ]; + dx0 = sx[ 1 ]; // offset increment for innermost loop + dx1 = sx[ 0 ] - ( S0*sx[1] ); // offset increment for outermost loop + } else { // order === 'column-major' + // For column-major ndarrays, the first dimensions have the fastest changing indices... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + dx0 = sx[ 0 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[0] ); // offset increment for outermost loop + } + // Set a pointer to the first indexed element: + ix = x.offset; + + // Cache a reference to the input ndarray buffer: + xbuf = x.data; + + // Iterate over the ndarray dimensions... + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + if ( ( xbuf[ ix ] || xbuf[ ix+1 ] ) ) { + return true; + } + ix += dx0; + } + ix += dx1; + } + return false; +} + + +// EXPORTS // + +module.exports = any2d; diff --git a/lib/node_modules/@stdlib/ndarray/base/any/lib/3d.js b/lib/node_modules/@stdlib/ndarray/base/any/lib/3d.js new file mode 100644 index 000000000000..ed182389ac50 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/lib/3d.js @@ -0,0 +1,132 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 strides2order = require( '@stdlib/ndarray/base/strides2order' ); + + +// MAIN // + +/** +* Tests whether at least one element in an ndarray is truthy. +* +* @private +* @param {Object} x - object containing ndarray meta data +* @param {string} x.dtype - data type +* @param {Collection} x.data - data buffer +* @param {NonNegativeIntegerArray} x.shape - dimensions +* @param {IntegerArray} x.strides - stride lengths +* @param {NonNegativeInteger} x.offset - index offset +* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) +* @returns {boolean} result +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* // Create a data buffer: +* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); +* +* // Define the shape of the input array: +* var shape = [ 3, 1, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 4, 1 ]; +* +* // Define the index offset: +* var ox = 1; +* +* // Create the input ndarray-like object: +* var x = { +* 'dtype': 'float64', +* 'data': xbuf, +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* // Test elements: +* var out = any3d( x ); +* // returns true +*/ +function any3d( x ) { + var xbuf; + var dx0; + var dx1; + var dx2; + var sh; + var S0; + var S1; + var S2; + var sx; + var ix; + var i0; + var i1; + var i2; + + // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... + + // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... + sh = x.shape; + sx = x.strides; + if ( strides2order( sx ) === 1 ) { + // For row-major ndarrays, the last dimensions have the fastest changing indices... + S0 = sh[ 2 ]; + S1 = sh[ 1 ]; + S2 = sh[ 0 ]; + dx0 = sx[ 2 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[2] ); + dx2 = sx[ 0 ] - ( S1*sx[1] ); // offset increment for outermost loop + } else { // order === 'column-major' + // For column-major ndarrays, the first dimensions have the fastest changing indices... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + S2 = sh[ 2 ]; + dx0 = sx[ 0 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[0] ); + dx2 = sx[ 2 ] - ( S1*sx[1] ); // offset increment for outermost loop + } + // Set a pointer to the first indexed element: + ix = x.offset; + + // Cache a reference to the input ndarray buffer: + xbuf = x.data; + + // Iterate over the ndarray dimensions... + for ( i2 = 0; i2 < S2; i2++ ) { + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + if ( xbuf[ ix ] ) { + return true; + } + ix += dx0; + } + ix += dx1; + } + ix += dx2; + } + return false; +} + + +// EXPORTS // + +module.exports = any3d; diff --git a/lib/node_modules/@stdlib/ndarray/base/any/lib/3d_accessors.js b/lib/node_modules/@stdlib/ndarray/base/any/lib/3d_accessors.js new file mode 100644 index 000000000000..b4620c5c0964 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/lib/3d_accessors.js @@ -0,0 +1,139 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 strides2order = require( '@stdlib/ndarray/base/strides2order' ); + + +// MAIN // + +/** +* Tests whether at least one element in an ndarray is truthy. +* +* @private +* @param {Object} x - object containing ndarray meta data +* @param {string} x.dtype - data type +* @param {Collection} x.data - data buffer +* @param {NonNegativeIntegerArray} x.shape - dimensions +* @param {IntegerArray} x.strides - stride lengths +* @param {NonNegativeInteger} x.offset - index offset +* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) +* @param {Array} x.accessors - data buffer accessors +* @returns {boolean} result +* +* @example +* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +* var accessors = require( '@stdlib/array/base/accessors' ); +* +* // Create a data buffer: +* var xbuf = toAccessorArray( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* +* // Define the shape of the input array: +* var shape = [ 1, 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 2, 1 ]; +* +* // Define the index offset: +* var ox = 0; +* +* // Create the input ndarray-like object: +* var x = { +* 'dtype': 'generic', +* 'data': xbuf, +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': accessors( xbuf ).accessors +* }; +* +* // Test elements: +* var out = any3d( x ); +* // returns true +*/ +function any3d( x ) { + var xbuf; + var get; + var dx0; + var dx1; + var dx2; + var sh; + var S0; + var S1; + var S2; + var sx; + var ix; + var i0; + var i1; + var i2; + + // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... + + // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... + sh = x.shape; + sx = x.strides; + if ( strides2order( sx ) === 1 ) { + // For row-major ndarrays, the last dimensions have the fastest changing indices... + S0 = sh[ 2 ]; + S1 = sh[ 1 ]; + S2 = sh[ 0 ]; + dx0 = sx[ 2 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[2] ); + dx2 = sx[ 0 ] - ( S1*sx[1] ); // offset increment for outermost loop + } else { // order === 'column-major' + // For column-major ndarrays, the first dimensions have the fastest changing indices... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + S2 = sh[ 2 ]; + dx0 = sx[ 0 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[0] ); + dx2 = sx[ 2 ] - ( S1*sx[1] ); // offset increment for outermost loop + } + // Set a pointer to the first indexed element: + ix = x.offset; + + // Cache a reference to the input ndarray buffer: + xbuf = x.data; + + // Cache accessor: + get = x.accessors[ 0 ]; + + // Iterate over the ndarray dimensions... + for ( i2 = 0; i2 < S2; i2++ ) { + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + if ( get( xbuf, ix ) ) { + return true; + } + ix += dx0; + } + ix += dx1; + } + ix += dx2; + } + return false; +} + + +// EXPORTS // + +module.exports = any3d; diff --git a/lib/node_modules/@stdlib/ndarray/base/any/lib/3d_blocked.js b/lib/node_modules/@stdlib/ndarray/base/any/lib/3d_blocked.js new file mode 100644 index 000000000000..9d9a91f7ed16 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/lib/3d_blocked.js @@ -0,0 +1,171 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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. +*/ + +/* eslint-disable max-depth */ + +'use strict'; + +// MODULES // + +var loopOrder = require( '@stdlib/ndarray/base/nullary-loop-interchange-order' ); +var blockSize = require( '@stdlib/ndarray/base/nullary-tiling-block-size' ); + + +// MAIN // + +/** +* Tests whether at least one element in an ndarray is truthy via loop blocking. +* +* @private +* @param {Object} x - object containing ndarray meta data +* @param {string} x.dtype - data type +* @param {Collection} x.data - data buffer +* @param {NonNegativeIntegerArray} x.shape - dimensions +* @param {IntegerArray} x.strides - stride lengths +* @param {NonNegativeInteger} x.offset - index offset +* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) +* @returns {boolean} result +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* // Create a data buffer: +* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); +* +* // Define the shape of the input array: +* var shape = [ 3, 1, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 4, 1 ]; +* +* // Define the index offset: +* var ox = 1; +* +* // Create the input ndarray-like object: +* var x = { +* 'dtype': 'float64', +* 'data': xbuf, +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* // Test elements: +* var out = blockedany3d( x ); +* // returns true +*/ +function blockedany3d( x ) { + var bsize; + var xbuf; + var dx0; + var dx1; + var dx2; + var ox1; + var ox2; + var sh; + var s0; + var s1; + var s2; + var sx; + var ox; + var ix; + var i0; + var i1; + var i2; + var j0; + var j1; + var j2; + var o; + + // Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... + + // Resolve the loop interchange order: + o = loopOrder( x.shape, x.strides ); + sh = o.sh; + sx = o.sx; + + // Determine the block size: + bsize = blockSize( x.dtype ); + + // Set a pointer to the first indexed element: + ox = x.offset; + + // Cache a reference to the input ndarray buffer: + xbuf = x.data; + + // Cache the offset increment for the innermost loop: + dx0 = sx[0]; + + // Iterate over blocks... + for ( j2 = sh[2]; j2 > 0; ) { + if ( j2 < bsize ) { + s2 = j2; + j2 = 0; + } else { + s2 = bsize; + j2 -= bsize; + } + ox2 = ox + ( j2*sx[2] ); + for ( j1 = sh[1]; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + dx2 = sx[2] - ( s1*sx[1] ); + ox1 = ox2 + ( j1*sx[1] ); + for ( j0 = sh[0]; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + // Compute the index offset for the first input ndarray element in the current block: + ix = ox1 + ( j0*sx[0] ); + + // Compute the loop offset increment: + dx1 = sx[1] - ( s0*sx[0] ); + + // Iterate over the ndarray dimensions... + for ( i2 = 0; i2 < s2; i2++ ) { + for ( i1 = 0; i1 < s1; i1++ ) { + for ( i0 = 0; i0 < s0; i0++ ) { + if ( xbuf[ ix ] ) { + return true; + } + ix += dx0; + } + ix += dx1; + } + ix += dx2; + } + } + } + } + return false; +} + + +// EXPORTS // + +module.exports = blockedany3d; diff --git a/lib/node_modules/@stdlib/ndarray/base/any/lib/3d_blocked_accessors.js b/lib/node_modules/@stdlib/ndarray/base/any/lib/3d_blocked_accessors.js new file mode 100644 index 000000000000..22ee2e6c677b --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/lib/3d_blocked_accessors.js @@ -0,0 +1,178 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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. +*/ + +/* eslint-disable max-depth */ + +'use strict'; + +// MODULES // + +var loopOrder = require( '@stdlib/ndarray/base/nullary-loop-interchange-order' ); +var blockSize = require( '@stdlib/ndarray/base/nullary-tiling-block-size' ); + + +// MAIN // + +/** +* Tests whether at least one element in an ndarray is truthy via loop blocking. +* +* @private +* @param {Object} x - object containing ndarray meta data +* @param {string} x.dtype - data type +* @param {Collection} x.data - data buffer +* @param {NonNegativeIntegerArray} x.shape - dimensions +* @param {IntegerArray} x.strides - stride lengths +* @param {NonNegativeInteger} x.offset - index offset +* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) +* @param {Array} x.accessors - data buffer accessors +* @returns {boolean} result +* +* @example +* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +* var accessors = require( '@stdlib/array/base/accessors' ); +* +* // Create a data buffer: +* var xbuf = toAccessorArray( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* +* // Define the shape of the input array: +* var shape = [ 1, 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 2, 1 ]; +* +* // Define the index offset: +* var ox = 0; +* +* // Create the input ndarray-like object: +* var x = { +* 'dtype': 'generic', +* 'data': xbuf, +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': accessors( xbuf ).accessors +* }; +* +* // Test elements: +* var out = blockedany3d( x ); +* // returns true +*/ +function blockedany3d( x ) { + var bsize; + var xbuf; + var get; + var dx0; + var dx1; + var dx2; + var ox1; + var ox2; + var sh; + var s0; + var s1; + var s2; + var sx; + var ox; + var ix; + var i0; + var i1; + var i2; + var j0; + var j1; + var j2; + var o; + + // Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... + + // Resolve the loop interchange order: + o = loopOrder( x.shape, x.strides ); + sh = o.sh; + sx = o.sx; + + // Determine the block size: + bsize = blockSize( x.dtype ); + + // Set a pointer to the first indexed element: + ox = x.offset; + + // Cache a reference to the input ndarray buffer: + xbuf = x.data; + + // Cache the offset increment for the innermost loop: + dx0 = sx[0]; + + // Cache accessor: + get = x.accessors[0]; + + // Iterate over blocks... + for ( j2 = sh[2]; j2 > 0; ) { + if ( j2 < bsize ) { + s2 = j2; + j2 = 0; + } else { + s2 = bsize; + j2 -= bsize; + } + ox2 = ox + ( j2*sx[2] ); + for ( j1 = sh[1]; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + dx2 = sx[2] - ( s1*sx[1] ); + ox1 = ox2 + ( j1*sx[1] ); + for ( j0 = sh[0]; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + // Compute the index offset for the first input ndarray element in the current block: + ix = ox1 + ( j0*sx[0] ); + + // Compute the loop offset increment: + dx1 = sx[1] - ( s0*sx[0] ); + + // Iterate over the ndarray dimensions... + for ( i2 = 0; i2 < s2; i2++ ) { + for ( i1 = 0; i1 < s1; i1++ ) { + for ( i0 = 0; i0 < s0; i0++ ) { + if ( get( xbuf, ix ) ) { + return true; + } + ix += dx0; + } + ix += dx1; + } + ix += dx2; + } + } + } + } + return false; +} + + +// EXPORTS // + +module.exports = blockedany3d; diff --git a/lib/node_modules/@stdlib/ndarray/base/any/lib/3d_blocked_complex.js b/lib/node_modules/@stdlib/ndarray/base/any/lib/3d_blocked_complex.js new file mode 100644 index 000000000000..41be569e1607 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/lib/3d_blocked_complex.js @@ -0,0 +1,171 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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. +*/ + +/* eslint-disable max-depth */ + +'use strict'; + +// MODULES // + +var loopOrder = require( '@stdlib/ndarray/base/nullary-loop-interchange-order' ); +var blockSize = require( '@stdlib/ndarray/base/nullary-tiling-block-size' ); + + +// MAIN // + +/** +* Tests whether at least one element of a reinterpreted complex number ndarray is truthy via loop blocking. +* +* @private +* @param {Object} x - object containing ndarray meta data +* @param {string} x.dtype - data type +* @param {Collection} x.data - data buffer +* @param {NonNegativeIntegerArray} x.shape - dimensions +* @param {IntegerArray} x.strides - stride lengths +* @param {NonNegativeInteger} x.offset - index offset +* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) +* @returns {boolean} result +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* // Create a data buffer: +* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* +* // Define the shape of the input array: +* var shape = [ 1, 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 8, 4, 2 ]; +* +* // Define the index offset: +* var ox = 0; +* +* // Create the input ndarray-like object: +* var x = { +* 'dtype': 'complex128', +* 'data': xbuf, +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* // Test elements: +* var out = blockedany3d( x ); +* // returns true +*/ +function blockedany3d( x ) { + var bsize; + var xbuf; + var dx0; + var dx1; + var dx2; + var ox1; + var ox2; + var sh; + var s0; + var s1; + var s2; + var sx; + var ox; + var ix; + var i0; + var i1; + var i2; + var j0; + var j1; + var j2; + var o; + + // Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... + + // Resolve the loop interchange order: + o = loopOrder( x.shape, x.strides ); + sh = o.sh; + sx = o.sx; + + // Determine the block size: + bsize = blockSize( x.dtype ); + + // Set a pointer to the first indexed element: + ox = x.offset; + + // Cache a reference to the input ndarray buffer: + xbuf = x.data; + + // Cache the offset increment for the innermost loop: + dx0 = sx[0]; + + // Iterate over blocks... + for ( j2 = sh[2]; j2 > 0; ) { + if ( j2 < bsize ) { + s2 = j2; + j2 = 0; + } else { + s2 = bsize; + j2 -= bsize; + } + ox2 = ox + ( j2*sx[2] ); + for ( j1 = sh[1]; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + dx2 = sx[2] - ( s1*sx[1] ); + ox1 = ox2 + ( j1*sx[1] ); + for ( j0 = sh[0]; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + // Compute the index offset for the first input ndarray element in the current block: + ix = ox1 + ( j0*sx[0] ); + + // Compute the loop offset increment: + dx1 = sx[1] - ( s0*sx[0] ); + + // Iterate over the ndarray dimensions... + for ( i2 = 0; i2 < s2; i2++ ) { + for ( i1 = 0; i1 < s1; i1++ ) { + for ( i0 = 0; i0 < s0; i0++ ) { + if ( ( xbuf[ ix ] || xbuf[ ix+1 ] ) ) { + return true; + } + ix += dx0; + } + ix += dx1; + } + ix += dx2; + } + } + } + } + return false; +} + + +// EXPORTS // + +module.exports = blockedany3d; diff --git a/lib/node_modules/@stdlib/ndarray/base/any/lib/3d_complex.js b/lib/node_modules/@stdlib/ndarray/base/any/lib/3d_complex.js new file mode 100644 index 000000000000..a36a80dcb1c2 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/lib/3d_complex.js @@ -0,0 +1,132 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 strides2order = require( '@stdlib/ndarray/base/strides2order' ); + + +// MAIN // + +/** +* Tests whether at least one element of a reinterpreted complex number ndarray is truthy. +* +* @private +* @param {Object} x - object containing ndarray meta data +* @param {string} x.dtype - data type +* @param {Collection} x.data - data buffer +* @param {NonNegativeIntegerArray} x.shape - dimensions +* @param {IntegerArray} x.strides - stride lengths +* @param {NonNegativeInteger} x.offset - index offset +* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) +* @returns {boolean} result +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* // Create a data buffer: +* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* +* // Define the shape of the input array: +* var shape = [ 1, 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 8, 4, 2 ]; +* +* // Define the index offset: +* var ox = 0; +* +* // Create the input ndarray-like object: +* var x = { +* 'dtype': 'complex128', +* 'data': xbuf, +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* // Test elements: +* var out = any3d( x ); +* // returns true +*/ +function any3d( x ) { + var xbuf; + var dx0; + var dx1; + var dx2; + var sh; + var S0; + var S1; + var S2; + var sx; + var ix; + var i0; + var i1; + var i2; + + // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... + + // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... + sh = x.shape; + sx = x.strides; + if ( strides2order( sx ) === 1 ) { + // For row-major ndarrays, the last dimensions have the fastest changing indices... + S0 = sh[ 2 ]; + S1 = sh[ 1 ]; + S2 = sh[ 0 ]; + dx0 = sx[ 2 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[2] ); + dx2 = sx[ 0 ] - ( S1*sx[1] ); // offset increment for outermost loop + } else { // order === 'column-major' + // For column-major ndarrays, the first dimensions have the fastest changing indices... + S0 = sh[ 0 ]; + S1 = sh[ 1 ]; + S2 = sh[ 2 ]; + dx0 = sx[ 0 ]; // offset increment for innermost loop + dx1 = sx[ 1 ] - ( S0*sx[0] ); + dx2 = sx[ 2 ] - ( S1*sx[1] ); // offset increment for outermost loop + } + // Set a pointer to the first indexed element: + ix = x.offset; + + // Cache a reference to the input ndarray buffer: + xbuf = x.data; + + // Iterate over the ndarray dimensions... + for ( i2 = 0; i2 < S2; i2++ ) { + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + if ( ( xbuf[ ix ] || xbuf[ ix+1 ] ) ) { + return true; + } + ix += dx0; + } + ix += dx1; + } + ix += dx2; + } + return false; +} + + +// EXPORTS // + +module.exports = any3d; diff --git a/lib/node_modules/@stdlib/ndarray/base/any/lib/index.js b/lib/node_modules/@stdlib/ndarray/base/any/lib/index.js new file mode 100644 index 000000000000..6194d7c931eb --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/lib/index.js @@ -0,0 +1,65 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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'; + +/** +* Test whether at least one element in an ndarray is truthy. +* +* @module @stdlib/ndarray/base/any +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var any = require( '@stdlib/ndarray/base/any' ); +* +* // Create a data buffer: +* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); +* +* // Define the shape of the input array: +* var shape = [ 3, 1, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 4, 1 ]; +* +* // Define the index offset: +* var ox = 1; +* +* // Create the input ndarray-like object: +* var x = { +* 'ref': null, +* 'dtype': 'float64', +* 'data': xbuf, +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* // Test elements: +* var out = any( [ x ], predicate ); +* // returns true +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/ndarray/base/any/lib/main.js b/lib/node_modules/@stdlib/ndarray/base/any/lib/main.js new file mode 100644 index 000000000000..34a8b4150646 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/lib/main.js @@ -0,0 +1,291 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 isComplexArray = require( '@stdlib/array/base/assert/is-complex-typed-array' ); +var isBooleanArray = require( '@stdlib/array/base/assert/is-booleanarray' ); +var iterationOrder = require( '@stdlib/ndarray/base/iteration-order' ); +var minmaxViewBufferIndex = require( '@stdlib/ndarray/base/minmax-view-buffer-index' ); +var ndarray2object = require( '@stdlib/ndarray/base/ndarraylike2object' ); +var reinterpretComplex = require( '@stdlib/strided/base/reinterpret-complex' ); +var reinterpretBoolean = require( '@stdlib/strided/base/reinterpret-boolean' ); +var gscal = require( '@stdlib/blas/base/gscal' ); +var blockedaccessorany2d = require( './2d_blocked_accessors.js' ); +var blockedaccessorany3d = require( './3d_blocked_accessors.js' ); +var blockedcomplexany2d = require( './2d_blocked_complex.js' ); +var blockedcomplexany3d = require( './3d_blocked_complex.js' ); +var blockedany2d = require( './2d_blocked.js' ); +var blockedany3d = require( './3d_blocked.js' ); +var accessorany0d = require( './0d_accessors.js' ); +var accessorany1d = require( './1d_accessors.js' ); +var accessorany2d = require( './2d_accessors.js' ); +var accessorany3d = require( './3d_accessors.js' ); +var accessoranynd = require( './nd_accessors.js' ); +var complexany0d = require( './0d_complex.js' ); +var complexany1d = require( './1d_complex.js' ); +var complexany2d = require( './2d_complex.js' ); +var complexany3d = require( './3d_complex.js' ); +var complexanynd = require( './nd_complex.js' ); +var any0d = require( './0d.js' ); +var any1d = require( './1d.js' ); +var any2d = require( './2d.js' ); +var any3d = require( './3d.js' ); +var anynd = require( './nd.js' ); + + +// VARIABLES // + +var ANY = [ + any0d, + any1d, + any2d, + any3d +]; +var ACCESSOR_ANY = [ + accessorany0d, + accessorany1d, + accessorany2d, + accessorany3d +]; +var COMPLEX_ANY = [ + complexany0d, + complexany1d, + complexany2d, + complexany3d +]; +var BLOCKED_ANY = [ + blockedany2d, // 0 + blockedany3d +]; +var BLOCKED_ACCESSOR_ANY = [ + blockedaccessorany2d, // 0 + blockedaccessorany3d +]; +var BLOCKED_COMPLEX_ANY = [ + blockedcomplexany2d, // 0 + blockedcomplexany3d +]; +var MAX_DIMS = ANY.length - 1; + + +// MAIN // + +/** +* Tests whether at least one element in an ndarray is truthy. +* +* ## Notes +* +* - A provided ndarray should be an `object` with the following properties: +* +* - **dtype**: data type. +* - **data**: data buffer. +* - **shape**: dimensions. +* - **strides**: stride lengths. +* - **offset**: index offset. +* - **order**: specifies whether an ndarray is row-major (C-style) or column major (Fortran-style). +* +* @param {ArrayLikeObject} arrays - array-like object containing one input array +* @returns {boolean} result +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* // Create a data buffer: +* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); +* +* // Define the shape of the input array: +* var shape = [ 3, 1, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 4, 1 ]; +* +* // Define the index offset: +* var ox = 1; +* +* // Create the input ndarray-like object: +* var x = { +* 'dtype': 'float64', +* 'data': xbuf, +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* // Test elements: +* var out = any( [ x ] ); +* // returns true +*/ +function any( arrays ) { + var isCmplx; + var ndims; + var xmmv; + var shx; + var iox; + var len; + var sx; + var ox; + var ns; + var x; + var d; + var i; + + // Unpack the ndarray and standardize ndarray meta data: + x = ndarray2object( arrays[ 0 ] ); + shx = x.shape; + ndims = shx.length; + + // Check for known array types which can be reinterpreted for better iteration performance... + if ( isBooleanArray( x.data ) ) { + x.data = reinterpretBoolean( x.data, 0 ); + x.accessorProtocol = false; + } else if ( isComplexArray( x.data ) ) { + x.data = reinterpretComplex( x.data, 0 ); + x.accessorProtocol = false; + x.strides = gscal( ndims, 2, x.strides, 1 ); + x.offset *= 2; + isCmplx = true; + } + // Determine whether we can avoid iteration altogether... + if ( ndims === 0 ) { + if ( x.accessorProtocol ) { + return ACCESSOR_ANY[ ndims ]( x ); + } + if ( isCmplx ) { + return COMPLEX_ANY[ ndims ]( x ); + } + return ANY[ ndims ]( x ); + } + // Compute the number of elements and the number of singleton dimensions... + len = 1; // number of elements + ns = 0; // number of singleton dimensions + for ( i = 0; i < ndims; i++ ) { + d = shx[ i ]; + + // Note that, if one of the dimensions is `0`, the length will be `0`... + len *= d; + + // Check whether the current dimension is a singleton dimension... + if ( d === 1 ) { + ns += 1; + } + } + // Check whether we were provided an empty ndarray... + if ( len === 0 ) { + return false; + } + // Determine whether the ndarray is one-dimensional and thus readily translates to a one-dimensional strided array... + if ( ndims === 1 ) { + if ( x.accessorProtocol ) { + return ACCESSOR_ANY[ ndims ]( x ); + } + if ( isCmplx ) { + return COMPLEX_ANY[ ndims ]( x ); + } + return ANY[ ndims ]( x ); + } + sx = x.strides; + + // Determine whether the ndarray has only **one** non-singleton dimension (e.g., ndims=4, shape=[10,1,1,1]) so that we can treat an ndarray as being equivalent to a one-dimensional strided array... + if ( ns === ndims-1 ) { + // Get the index of the non-singleton dimension... + for ( i = 0; i < ndims; i++ ) { + if ( shx[ i ] !== 1 ) { + break; + } + } + x.shape = [ shx[i] ]; + x.strides = [ sx[i] ]; + if ( x.accessorProtocol ) { + return ACCESSOR_ANY[ 1 ]( x ); + } + if ( isCmplx ) { + return COMPLEX_ANY[ 1 ]( x ); + } + return ANY[ 1 ]( x ); + } + iox = iterationOrder( sx ); // +/-1 + + // Determine whether we can avoid blocked iteration... + if ( iox !== 0 ) { + // Determine the minimum and maximum linear indices which are accessible by the array view: + xmmv = minmaxViewBufferIndex( shx, sx, x.offset ); + + // Determine whether we can ignore shape (and strides) and treat the ndarray as a linear one-dimensional strided array... + if ( len === ( xmmv[1]-xmmv[0]+1 ) || ( isCmplx && len*2 === ( xmmv[1]-xmmv[0]+1 ) ) ) { // eslint-disable-line max-len + // Note: the above is equivalent to @stdlib/ndarray/base/assert/is-contiguous, but in-lined so we can retain computed values... + if ( iox === 1 ) { + ox = xmmv[ 0 ]; + } else { + ox = xmmv[ 1 ]; + } + x.shape = [ len ]; + x.strides = [ ( isCmplx ) ? iox*2 : iox ]; + x.offset = ox; + if ( x.accessorProtocol ) { + return ACCESSOR_ANY[ 1 ]( x ); + } + if ( isCmplx ) { + return COMPLEX_ANY[ 1 ]( x ); + } + return ANY[ 1 ]( x ); + } + // The ndarray is non-contiguous, so we cannot directly use one-dimensional array functionality... + + // Determine whether we can use simple nested loops... + if ( ndims <= MAX_DIMS ) { + // So long as iteration always moves in the same direction (i.e., no mixed sign strides), we can leverage cache-optimal (i.e., normal) nested loops without resorting to blocked iteration... + if ( x.accessorProtocol ) { + return ACCESSOR_ANY[ ndims ]( x ); + } + if ( isCmplx ) { + return COMPLEX_ANY[ ndims ]( x ); + } + return ANY[ ndims ]( x ); + } + // Fall-through to blocked iteration... + } + // At this point, we're either dealing with a non-contiguous n-dimensional array or a high dimensional n-dimensional array, so our only hope is that we can still perform blocked iteration... + + // Determine whether we can perform blocked iteration... + if ( ndims <= MAX_DIMS ) { + if ( x.accessorProtocol ) { + return BLOCKED_ACCESSOR_ANY[ ndims-2 ]( x ); + } + if ( isCmplx ) { + return BLOCKED_COMPLEX_ANY[ ndims-2 ]( x ); + } + return BLOCKED_ANY[ ndims-2 ]( x ); + } + // Fall-through to linear view iteration without regard for how data is stored in memory (i.e., take the slow path)... + if ( x.accessorProtocol ) { + return accessoranynd( x ); + } + if ( isCmplx ) { + return complexanynd( x ); + } + return anynd( x ); +} + + +// EXPORTS // + +module.exports = any; diff --git a/lib/node_modules/@stdlib/ndarray/base/any/lib/nd.js b/lib/node_modules/@stdlib/ndarray/base/any/lib/nd.js new file mode 100644 index 000000000000..27b3184fd08f --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/lib/nd.js @@ -0,0 +1,116 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 numel = require( '@stdlib/ndarray/base/numel' ); +var vind2bind = require( '@stdlib/ndarray/base/vind2bind' ); + + +// VARIABLES // + +var MODE = 'throw'; + + +// MAIN // + +/** +* Tests whether at least one element in an ndarray is truthy. +* +* @private +* @param {Object} x - object containing ndarray meta data +* @param {string} x.dtype - data type +* @param {Collection} x.data - data buffer +* @param {NonNegativeIntegerArray} x.shape - dimensions +* @param {IntegerArray} x.strides - stride lengths +* @param {NonNegativeInteger} x.offset - index offset +* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) +* @returns {boolean} result +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* // Create a data buffer: +* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* +* // Define the shape of the input array: +* var shape = [ 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 1 ]; +* +* // Define the index offset: +* var ox = 1; +* +* // Create the input ndarray-like object: +* var x = { +* 'dtype': 'float64', +* 'data': xbuf, +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* // Test elements: +* var out = anynd( x ); +* // returns true +*/ +function anynd( x ) { + var xbuf; + var ordx; + var len; + var sh; + var sx; + var ox; + var ix; + var i; + + sh = x.shape; + + // Compute the total number of elements over which to iterate: + len = numel( sh ); + + // Cache a reference to the output ndarray data buffer: + xbuf = x.data; + + // Cache a reference to the stride array: + sx = x.strides; + + // Cache the index of the first indexed element: + ox = x.offset; + + // Cache the array order: + ordx = x.order; + + // Iterate over each element based on the linear **view** index, regardless as to how the data is stored in memory... + for ( i = 0; i < len; i++ ) { + ix = vind2bind( sh, sx, ox, ordx, i, MODE ); + if ( xbuf[ ix ] ) { + return true; + } + } + return false; +} + + +// EXPORTS // + +module.exports = anynd; diff --git a/lib/node_modules/@stdlib/ndarray/base/any/lib/nd_accessors.js b/lib/node_modules/@stdlib/ndarray/base/any/lib/nd_accessors.js new file mode 100644 index 000000000000..83494a542a58 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/lib/nd_accessors.js @@ -0,0 +1,123 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 numel = require( '@stdlib/ndarray/base/numel' ); +var vind2bind = require( '@stdlib/ndarray/base/vind2bind' ); + + +// VARIABLES // + +var MODE = 'throw'; + + +// MAIN // + +/** +* Tests whether at least one element in an ndarray is truthy. +* +* @private +* @param {Object} x - object containing ndarray meta data +* @param {string} x.dtype - data type +* @param {Collection} x.data - data buffer +* @param {NonNegativeIntegerArray} x.shape - dimensions +* @param {IntegerArray} x.strides - stride lengths +* @param {NonNegativeInteger} x.offset - index offset +* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) +* @param {Array} x.accessors - data buffer accessors +* @returns {boolean} result +* +* @example +* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +* var accessors = require( '@stdlib/array/base/accessors' ); +* +* // Create a data buffer: +* var xbuf = toAccessorArray( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* +* // Define the shape of the input array: +* var shape = [ 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 1 ]; +* +* // Define the index offset: +* var ox = 0; +* +* // Create the input ndarray-like object: +* var x = { +* 'dtype': 'generic', +* 'data': xbuf, +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major', +* 'accessors': accessors( xbuf ).accessors +* }; +* +* // Test elements: +* var out = anynd( x ); +* // returns true +*/ +function anynd( x ) { + var xbuf; + var ordx; + var len; + var get; + var sh; + var sx; + var ox; + var ix; + var i; + + sh = x.shape; + + // Compute the total number of elements over which to iterate: + len = numel( sh ); + + // Cache a reference to the output ndarray data buffer: + xbuf = x.data; + + // Cache a reference to the stride array: + sx = x.strides; + + // Cache the index of the first indexed element: + ox = x.offset; + + // Cache the array order: + ordx = x.order; + + // Cache accessor: + get = x.accessors[ 0 ]; + + // Iterate over each element based on the linear **view** index, regardless as to how the data is stored in memory... + for ( i = 0; i < len; i++ ) { + ix = vind2bind( sh, sx, ox, ordx, i, MODE ); + if ( get( xbuf, ix ) ) { + return true; + } + } + return false; +} + + +// EXPORTS // + +module.exports = anynd; diff --git a/lib/node_modules/@stdlib/ndarray/base/any/lib/nd_complex.js b/lib/node_modules/@stdlib/ndarray/base/any/lib/nd_complex.js new file mode 100644 index 000000000000..830fe66ef6ff --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/lib/nd_complex.js @@ -0,0 +1,116 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 numel = require( '@stdlib/ndarray/base/numel' ); +var vind2bind = require( '@stdlib/ndarray/base/vind2bind' ); + + +// VARIABLES // + +var MODE = 'throw'; + + +// MAIN // + +/** +* Tests whether at least one element of a reinterpreted complex number ndarray is truthy. +* +* @private +* @param {Object} x - object containing ndarray meta data +* @param {string} x.dtype - data type +* @param {Collection} x.data - data buffer +* @param {NonNegativeIntegerArray} x.shape - dimensions +* @param {IntegerArray} x.strides - stride lengths +* @param {NonNegativeInteger} x.offset - index offset +* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) +* @returns {boolean} result +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* // Create a data buffer: +* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* +* // Define the shape of the input array: +* var shape = [ 2, 2 ]; +* +* // Define the array strides: +* var sx = [ 4, 2 ]; +* +* // Define the index offset: +* var ox = 0; +* +* // Create the input ndarray-like object: +* var x = { +* 'dtype': 'complex128', +* 'data': xbuf, +* 'shape': shape, +* 'strides': sx, +* 'offset': ox, +* 'order': 'row-major' +* }; +* +* // Test elements: +* var out = anynd( x ); +* // returns true +*/ +function anynd( x ) { + var xbuf; + var ordx; + var len; + var sh; + var sx; + var ox; + var ix; + var i; + + sh = x.shape; + + // Compute the total number of elements over which to iterate: + len = numel( sh ); + + // Cache a reference to the output ndarray data buffer: + xbuf = x.data; + + // Cache a reference to the stride array: + sx = x.strides; + + // Cache the index of the first indexed element: + ox = x.offset; + + // Cache the array order: + ordx = x.order; + + // Iterate over each element based on the linear **view** index, regardless as to how the data is stored in memory... + for ( i = 0; i < len; i++ ) { + ix = vind2bind( sh, sx, ox, ordx, i, MODE ); + if ( ( xbuf[ ix ] || xbuf[ ix+1 ] ) ) { + return true; + } + } + return false; +} + + +// EXPORTS // + +module.exports = anynd; diff --git a/lib/node_modules/@stdlib/ndarray/base/any/package.json b/lib/node_modules/@stdlib/ndarray/base/any/package.json new file mode 100644 index 000000000000..b1c0772e952c --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/package.json @@ -0,0 +1,63 @@ +{ + "name": "@stdlib/ndarray/base/any", + "version": "0.0.0", + "description": "Test whether at least one element in an ndarray is truthy.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "base", + "strided", + "array", + "ndarray", + "any", + "utility", + "utils", + "truthy" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/ndarray/base/any/test/test.0d.js b/lib/node_modules/@stdlib/ndarray/base/any/test/test.0d.js new file mode 100644 index 000000000000..89258574e5f6 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/test/test.0d.js @@ -0,0 +1,97 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); +var ndarray = require( '@stdlib/ndarray/ctor' ); +var any = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof any, 'function', 'main export is a function'); + t.end(); +}); + +tape( 'the function tests whether at least one element in a 0-dimensional ndarray is truthy', function test( t ) { + var actual; + var x; + + x = scalar2ndarray( 0.0, { + 'dtype': 'float64' + }); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = scalar2ndarray( 1.0, { + 'dtype': 'float64' + }); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 0-dimensional ndarray is truthy (accessors)', function test( t ) { + var actual; + var x; + + x = ndarray( 'float64', toAccessorArray( new Float64Array( [ 0.0 ] ) ), [], [ 0 ], 0, 'row-major' ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( 'float64', toAccessorArray( new Float64Array( [ 1.0 ] ) ), [], [ 0 ], 0, 'row-major' ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 0-dimensional ndarray is truthy (complex)', function test( t ) { + var actual; + var x; + + x = scalar2ndarray( new Complex128( 0.0, 0.0 ), { + 'dtype': 'complex128' + }); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = scalar2ndarray( new Complex128( 1.0, 0.0 ), { + 'dtype': 'complex128' + }); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ndarray/base/any/test/test.1d.js b/lib/node_modules/@stdlib/ndarray/base/any/test/test.1d.js new file mode 100644 index 000000000000..9e0d6aa33cab --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/test/test.1d.js @@ -0,0 +1,88 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 tape = require( 'tape' ); +var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +var zeros = require( '@stdlib/array/zeros' ); +var ones = require( '@stdlib/array/ones' ); +var ndarray = require( '@stdlib/ndarray/ctor' ); +var any = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof any, 'function', 'main export is a function'); + t.end(); +}); + +tape( 'the function tests whether at least one element in a 1-dimensional ndarray is truthy', function test( t ) { + var actual; + var x; + + x = ndarray( 'float64', zeros( 8, 'float64' ), [ 4 ], [ 2 ], 1, 'row-major' ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( 'float64', ones( 8, 'float64' ), [ 4 ], [ 2 ], 1, 'row-major' ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 1-dimensional ndarray is truthy (accessors)', function test( t ) { + var actual; + var x; + + x = ndarray( 'float64', toAccessorArray( zeros( 8, 'float64' ) ), [ 4 ], [ 2 ], 1, 'row-major' ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( 'float64', toAccessorArray( ones( 8, 'float64' ) ), [ 4 ], [ 2 ], 1, 'row-major' ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 1-dimensional ndarray is truthy (complex)', function test( t ) { + var actual; + var x; + + x = ndarray( 'complex128', zeros( 6, 'complex128' ), [ 4 ], [ 1 ], 1, 'row-major' ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( 'complex128', ones( 6, 'complex128' ), [ 4 ], [ 1 ], 1, 'row-major' ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ndarray/base/any/test/test.2d.js b/lib/node_modules/@stdlib/ndarray/base/any/test/test.2d.js new file mode 100644 index 000000000000..8d3d4077de46 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/test/test.2d.js @@ -0,0 +1,1197 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 tape = require( 'tape' ); +var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +var zeros = require( '@stdlib/array/zeros' ); +var ones = require( '@stdlib/array/ones' ); +var numel = require( '@stdlib/ndarray/base/numel' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var strides2offset = require( '@stdlib/ndarray/base/strides2offset' ); +var ndarray = require( '@stdlib/ndarray/ctor' ); +var blockSize = require( '@stdlib/ndarray/base/nullary-tiling-block-size' ); +var any = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof any, 'function', 'main export is a function'); + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (row-major, singleton dimensions)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 4, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (row-major, singleton dimensions, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 4, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (row-major, contiguous)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 2, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (row-major, contiguous, negative strides)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 2, 2 ]; + st = [ -2, -1 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (row-major, non-contiguous, same sign strides)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 2, 2 ]; + st = [ 4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( 8, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( 8, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (row-major, non-contiguous, mixed sign strides)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 2, 2 ]; + st = [ 4, -2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( 8, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( 8, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (row-major, non-contiguous, large arrays)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 2 ]; + st = [ -4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (row-major, non-contiguous, large arrays)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2 ]; + st = [ bsize*4, -2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (row-major, contiguous, complex)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + sh = [ 2, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (row-major, contiguous, negative strides, complex)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + sh = [ 2, 2 ]; + st = [ -2, -1 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (row-major, non-contiguous, same sign strides, complex)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + sh = [ 2, 2 ]; + st = [ 4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( 8, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( 8, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (row-major, non-contiguous, mixed sign strides, complex)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + sh = [ 2, 2 ]; + st = [ 4, -2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( 8, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( 8, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (row-major, non-contiguous, large arrays, complex)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 2 ]; + st = [ -4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (row-major, non-contiguous, large arrays, complex)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2 ]; + st = [ bsize*4, -2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (row-major, contiguous, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 2, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (row-major, contiguous, negative strides, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 2, 2 ]; + st = [ -2, -1 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 2, 2 ]; + st = [ 4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( 8, dt ) ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( 8, dt ) ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 2, 2 ]; + st = [ 4, -2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( 8, dt ) ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( 8, dt ) ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 2 ]; + st = [ -4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2 ]; + st = [ bsize*4, -2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (column-major, singleton dimensions)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 4, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (column-major, singleton dimensions, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 4, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (column-major, contiguous)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 2, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (column-major, contiguous, negative strides)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 2, 2 ]; + st = [ -1, -2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (column-major, non-contiguous, same sign strides)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 2, 2 ]; + st = [ 2, 4 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( 8, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( 8, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (column-major, non-contiguous, mixed sign strides)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 2, 2 ]; + st = [ -2, 4 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( 8, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( 8, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (column-major, non-contiguous, large arrays)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 2 ]; + st = [ 2, -bsize*4 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (column-major, non-contiguous, large arrays)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2 ]; + st = [ -2, 4 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (column-major, contiguous, complex)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'column-major'; + sh = [ 2, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (column-major, contiguous, negative strides, complex)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'column-major'; + sh = [ 2, 2 ]; + st = [ -1, -2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (column-major, non-contiguous, same sign strides, complex)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'column-major'; + sh = [ 2, 2 ]; + st = [ 2, 4 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( 8, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( 8, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (column-major, non-contiguous, mixed sign strides, complex)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'column-major'; + sh = [ 2, 2 ]; + st = [ -2, 4 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( 8, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( 8, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (column-major, non-contiguous, large arrays, complex)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 2 ]; + st = [ -2, bsize*2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (column-major, non-contiguous, large arrays, complex)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2 ]; + st = [ 2, -4 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (column-major, contiguous, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 2, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (column-major, contiguous, negative strides, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 2, 2 ]; + st = [ -1, -2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 2, 2 ]; + st = [ 2, 4 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( 8, dt ) ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( 8, dt ) ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 2, 2 ]; + st = [ -2, 4 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( 8, dt ) ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( 8, dt ) ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 2 ]; + st = [ -2, bsize*2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 2-dimensional ndarray is truthy (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2 ]; + st = [ 2, -4 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ndarray/base/any/test/test.3d.js b/lib/node_modules/@stdlib/ndarray/base/any/test/test.3d.js new file mode 100644 index 000000000000..5771f179c0b5 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/test/test.3d.js @@ -0,0 +1,1383 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 tape = require( 'tape' ); +var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +var zeros = require( '@stdlib/array/zeros' ); +var ones = require( '@stdlib/array/ones' ); +var numel = require( '@stdlib/ndarray/base/numel' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var strides2offset = require( '@stdlib/ndarray/base/strides2offset' ); +var ndarray = require( '@stdlib/ndarray/ctor' ); +var blockSize = require( '@stdlib/ndarray/base/nullary-tiling-block-size' ); +var any = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof any, 'function', 'main export is a function'); + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (row-major, singleton dimensions)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 4, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (row-major, singleton dimensions, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 4, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (row-major, contiguous)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (row-major, contiguous, negative strides)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 2, 1, 2 ]; + st = [ -2, -2, -1 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (row-major, non-contiguous, same sign strides)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 2, 1, 2 ]; + st = [ 4, 4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (row-major, non-contiguous, mixed sign strides)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 2, 1, 2 ]; + st = [ -4, -4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (row-major, non-contiguous, large arrays)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2 ]; + st = [ -4, -4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (row-major, non-contiguous, large arrays)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 1, bsize*2, 2 ]; + st = [ -8, -4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (row-major, non-contiguous, large arrays)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 1, 2, bsize*2 ]; + st = [ bsize*8, bsize*4, -2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (row-major, contiguous, complex)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + sh = [ 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (row-major, contiguous, negative strides, complex)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + sh = [ 2, 2, 2 ]; + st = [ -4, -2, -1 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (row-major, non-contiguous, same sign strides, complex)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + sh = [ 2, 1, 2 ]; + st = [ 4, 4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (row-major, non-contiguous, mixed sign strides, complex)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + sh = [ 2, 1, 2 ]; + st = [ -4, -4, -2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (row-major, non-contiguous, large arrays, complex)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2 ]; + st = [ -4, -4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (row-major, non-contiguous, large arrays, complex)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 1, bsize*2, 2 ]; + st = [ -8, -4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (row-major, non-contiguous, large arrays, complex)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 1, 2, bsize*2 ]; + st = [ -bsize*8, -bsize*4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (row-major, contiguous, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (row-major, contiguous, negative strides, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 2, 2, 2 ]; + st = [ -2, -2, -1 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 2, 1, 2 ]; + st = [ 4, 4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 2, 1, 2 ]; + st = [ -3, -2, 1 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2 ]; + st = [ -4, -4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 1, bsize*2, 2 ]; + st = [ -8, -4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 1, 2, bsize*2 ]; + st = [ bsize*8, bsize*4, -2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (column-major, singleton dimensions)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 4, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (column-major, singleton dimensions, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 4, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (column-major, contiguous)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (column-major, contiguous, negative strides)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 2, 1, 2 ]; + st = [ -1, -2, -2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (column-major, non-contiguous, same sign strides)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 2, 1, 2 ]; + st = [ 2, 4, 4 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (column-major, non-contiguous, mixed sign strides)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 2, 1, 2 ]; + st = [ 2, -4, -4 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (column-major, non-contiguous, large arrays)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2 ]; + st = [ 2, -bsize*4, -bsize*4 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (column-major, non-contiguous, large arrays)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 1, bsize*2, 2 ]; + st = [ 2, -2, -bsize*4 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (column-major, non-contiguous, large arrays)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2 ]; + st = [ 2, -4, -4 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (column-major, contiguous, complex)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'column-major'; + sh = [ 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (column-major, contiguous, negative strides, complex)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'column-major'; + sh = [ 2, 2, 2 ]; + st = [ -1, -2, -4 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (column-major, non-contiguous, same sign strides, complex)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'column-major'; + sh = [ 2, 1, 2 ]; + st = [ 2, 4, 4 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (column-major, non-contiguous, mixed sign strides, complex)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'column-major'; + sh = [ 2, 1, 2 ]; + st = [ -2, -4, -4 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (column-major, non-contiguous, large arrays, complex)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 2, 1 ]; + st = [ 2, -bsize*4, -bsize*8 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (column-major, non-contiguous, large arrays, complex)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 1, bsize*2, 2 ]; + st = [ 2, -2, bsize*4 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (column-major, non-contiguous, large arrays, complex)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2 ]; + st = [ 2, -4, -4 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (column-major, contiguous, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (column-major, contiguous, negative strides, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 2, 2, 2 ]; + st = [ -1, -2, -4 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 2, 1, 2 ]; + st = [ 2, 4, 4 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 2, 1, 2 ]; + st = [ 1, -2, -3 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 2, 1 ]; + st = [ 2, -bsize*4, -bsize*8 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 1, bsize*2, 2 ]; + st = [ -2, -2, -bsize*4 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a 3-dimensional ndarray is truthy (column-major, non-contiguous, large arrays, accessors)', function test( t ) { + var actual; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2 ]; + st = [ 2, -4, -4 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh )*2, dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ndarray/base/any/test/test.js b/lib/node_modules/@stdlib/ndarray/base/any/test/test.js new file mode 100644 index 000000000000..e4625a304a5c --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/test/test.js @@ -0,0 +1,47 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 tape = require( 'tape' ); +var zeros = require( '@stdlib/array/zeros' ); +var ndarray = require( '@stdlib/ndarray/ctor' ); +var any = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof any, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns `false` if the input is an empty ndarray', function test( t ) { + var actual; + var x; + + x = ndarray( 'float64', zeros( 8, 'float64' ), [ 0 ], [ 1 ], 0, 'row-major' ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ndarray/base/any/test/test.nd.js b/lib/node_modules/@stdlib/ndarray/base/any/test/test.nd.js new file mode 100644 index 000000000000..7fb53a5d8ecc --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/base/any/test/test.nd.js @@ -0,0 +1,656 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 tape = require( 'tape' ); +var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +var zeros = require( '@stdlib/array/zeros' ); +var ones = require( '@stdlib/array/ones' ); +var numel = require( '@stdlib/ndarray/base/numel' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var strides2offset = require( '@stdlib/ndarray/base/strides2offset' ); +var ndarray = require( '@stdlib/ndarray/ctor' ); +var any = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof any, 'function', 'main export is a function'); + t.end(); +}); + +tape( 'the function tests whether at least one element in a n-dimensional ndarray is truthy (row-major, singleton dimensions)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a n-dimensional ndarray is truthy (row-major, singleton dimensions, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a n-dimensional ndarray is truthy (row-major, contiguous)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a n-dimensional ndarray is truthy (row-major, non-contiguous, same sign strides)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 16, 16, 16, 16, 16, 16, 8, 4, 2, 1 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( 16, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a n-dimensional ndarray is truthy (row-major, non-contiguous, mixed sign strides)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 16, 16, 16, 16, 16, 16, -8, -4, -2, 1 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( 16, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a n-dimensional ndarray is truthy (row-major, contiguous, complex)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a n-dimensional ndarray is truthy (row-major, non-contiguous, same sign strides, complex)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 16, 16, 16, 16, 16, 16, 8, 4, 2, 1 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( 16, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a n-dimensional ndarray is truthy (row-major, non-contiguous, mixed sign strides, complex)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 16, 16, 16, 16, -16, 16, -8, -4, -2, 1 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( 16, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a n-dimensional ndarray is truthy (row-major, contiguous, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a n-dimensional ndarray is truthy (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 16, 16, 16, 16, 16, 16, 8, 4, 2, 1 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( 16, dt ) ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( 16, dt ) ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a n-dimensional ndarray is truthy (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 16, 16, 16, 16, -16, 16, -8, -4, -2, 1 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( 16, dt ) ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( 16, dt ) ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a n-dimensional ndarray is truthy (column-major, singleton dimensions)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a n-dimensional ndarray is truthy (column-major, singleton dimensions, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a n-dimensional ndarray is truthy (column-major, contiguous)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a n-dimensional ndarray is truthy (column-major, non-contiguous, same sign strides)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 8, 8 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( 16, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a n-dimensional ndarray is truthy (column-major, non-contiguous, mixed sign strides)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 1, 1, 1, 1, 1, -1, -4, 8, -8 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( 16, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a n-dimensional ndarray is truthy (column-major, contiguous, complex)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( numel( sh ), dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a n-dimensional ndarray is truthy (column-major, non-contiguous, same sign strides, complex)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 8, 8 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( 16, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a n-dimensional ndarray is truthy (column-major, non-contiguous, mixed sign strides, complex)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 1, -1, 1, -1, 1, 1, -4, -8, 8 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, ones( 16, dt ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a n-dimensional ndarray is truthy (column-major, contiguous, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( numel( sh ), dt ) ), sh, st, o, ord ); // eslint-disable-line max-len + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a n-dimensional ndarray is truthy (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 8, 8 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( 16, dt ) ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( 16, dt ) ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function tests whether at least one element in a n-dimensional ndarray is truthy (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var actual; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 1, -1, 1, -1, 1, 1, -4, -8, 8 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, toAccessorArray( zeros( 16, dt ) ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, false, 'returns expected value' ); + + x = ndarray( dt, toAccessorArray( ones( 16, dt ) ), sh, st, o, ord ); + + actual = any( [ x ] ); + t.strictEqual( actual, true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.10d_blocked_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.10d_blocked_columnmajor.js deleted file mode 100644 index fd03fcba9ccd..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.10d_blocked_columnmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/10d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/10.0 ) ); - sh = [ len, len, len, len, len, len, len, len, len, len ]; - len *= pow( len, 9 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.10d_blocked_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.10d_blocked_rowmajor.js deleted file mode 100644 index 7944927eaaa4..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.10d_blocked_rowmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/10d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/10.0 ) ); - sh = [ len, len, len, len, len, len, len, len, len, len ]; - len *= pow( len, 9 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.10d_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.10d_columnmajor.js deleted file mode 100644 index e9b10e2b92c6..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.10d_columnmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/10d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/10.0 ) ); - sh = [ len, len, len, len, len, len, len, len, len, len ]; - len *= pow( len, 9 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.10d_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.10d_rowmajor.js deleted file mode 100644 index f78b35c2294e..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.10d_rowmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/10d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/10.0 ) ); - sh = [ len, len, len, len, len, len, len, len, len, len ]; - len *= pow( len, 9 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.11d_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.11d_columnmajor.js deleted file mode 100644 index 899299641698..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.11d_columnmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/nd.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/11.0 ) ); - sh = [ len, len, len, len, len, len, len, len, len, len, len ]; - len *= pow( len, 10 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.11d_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.11d_rowmajor.js deleted file mode 100644 index a752baf87341..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.11d_rowmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/nd.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/11.0 ) ); - sh = [ len, len, len, len, len, len, len, len, len, len, len ]; - len *= pow( len, 10 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.1d_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.1d_columnmajor.js deleted file mode 100644 index 6b7e6dddda69..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.1d_columnmajor.js +++ /dev/null @@ -1,122 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( [ x ] ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.2d_rowmajor_accessors_complex.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.2d_rowmajor_accessors_complex.js deleted file mode 100644 index 9248f6a0a5ce..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.2d_rowmajor_accessors_complex.js +++ /dev/null @@ -1,162 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var sqrt = require( '@stdlib/math/base/special/sqrt' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var ctors = require( '@stdlib/array/typed-complex-ctors' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/2d_accessors.js' ); - - -// VARIABLES // - -var types = [ 'complex64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Returns an array data buffer element. -* -* @private -* @param {Collection} buf - data buffer -* @param {NonNegativeInteger} idx - element index -* @returns {*} element -*/ -function get( buf, idx ) { - return buf.get( idx ); -} - -/** -* Sets an array data buffer element. -* -* @private -* @param {Collection} buf - data buffer -* @param {NonNegativeInteger} idx - element index -* @param {*} value - value to set -*/ -function set( buf, idx, value ) { - buf.set( value, idx ); -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var xbuf; - var x; - - xbuf = discreteUniform( len*2, 1, 100 ); - x = { - 'dtype': xtype, - 'data': new ( ctors( xtype ) )( xbuf.buffer ), - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order, - 'accessorProtocol': true, - 'accessors': [ get, set ] - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 5; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::accessors:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::accessors:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( sqrt( len ) ); - sh = [ len, len ]; - len *= len; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::accessors:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.4d_blocked_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.4d_blocked_columnmajor.js deleted file mode 100644 index cc8edb67488e..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.4d_blocked_columnmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/4d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/4.0 ) ); - sh = [ len, len, len, len ]; - len *= len * len * len; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.4d_blocked_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.4d_blocked_rowmajor.js deleted file mode 100644 index e901f8d6be99..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.4d_blocked_rowmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/4d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/4.0 ) ); - sh = [ len, len, len, len ]; - len *= len * len * len; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.4d_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.4d_columnmajor.js deleted file mode 100644 index 7b3c16d14a30..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.4d_columnmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/4d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/4.0 ) ); - sh = [ len, len, len, len ]; - len *= len * len * len; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.4d_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.4d_rowmajor.js deleted file mode 100644 index a7e16ae16a98..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.4d_rowmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/4d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/4.0 ) ); - sh = [ len, len, len, len ]; - len *= len * len * len; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.5d_blocked_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.5d_blocked_columnmajor.js deleted file mode 100644 index 380f79db2102..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.5d_blocked_columnmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/5d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/5.0 ) ); - sh = [ len, len, len, len, len ]; - len *= pow( len, 4 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.5d_blocked_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.5d_blocked_rowmajor.js deleted file mode 100644 index 150e6c281eeb..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.5d_blocked_rowmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/5d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/5.0 ) ); - sh = [ len, len, len, len, len ]; - len *= pow( len, 4 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.5d_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.5d_columnmajor.js deleted file mode 100644 index ce5a3c8eacdd..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.5d_columnmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/5d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/5.0 ) ); - sh = [ len, len, len, len, len ]; - len *= pow( len, 4 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.5d_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.5d_rowmajor.js deleted file mode 100644 index 83f67c31ff4e..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.5d_rowmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/5d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/5.0 ) ); - sh = [ len, len, len, len, len ]; - len *= pow( len, 4 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.6d_blocked_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.6d_blocked_columnmajor.js deleted file mode 100644 index a831dcf4990b..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.6d_blocked_columnmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/6d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/6.0 ) ); - sh = [ len, len, len, len, len, len ]; - len *= pow( len, 5 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.6d_blocked_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.6d_blocked_rowmajor.js deleted file mode 100644 index 4b3452830383..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.6d_blocked_rowmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/6d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/6.0 ) ); - sh = [ len, len, len, len, len, len ]; - len *= pow( len, 5 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.6d_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.6d_columnmajor.js deleted file mode 100644 index d09293ab2b95..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.6d_columnmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/6d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/6.0 ) ); - sh = [ len, len, len, len, len, len ]; - len *= pow( len, 5 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.6d_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.6d_rowmajor.js deleted file mode 100644 index 7f64fdaccab7..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.6d_rowmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/6d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/6.0 ) ); - sh = [ len, len, len, len, len, len ]; - len *= pow( len, 5 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.7d_blocked_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.7d_blocked_columnmajor.js deleted file mode 100644 index 9928f4c12934..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.7d_blocked_columnmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/7d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/7.0 ) ); - sh = [ len, len, len, len, len, len, len ]; - len *= pow( len, 6 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.7d_blocked_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.7d_blocked_rowmajor.js deleted file mode 100644 index 0fb4c8074ee9..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.7d_blocked_rowmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/7d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/7.0 ) ); - sh = [ len, len, len, len, len, len, len ]; - len *= pow( len, 6 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.7d_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.7d_columnmajor.js deleted file mode 100644 index 8dfb9ddf424d..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.7d_columnmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/7d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/7.0 ) ); - sh = [ len, len, len, len, len, len, len ]; - len *= pow( len, 6 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.7d_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.7d_rowmajor.js deleted file mode 100644 index c82431321336..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.7d_rowmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/7d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/7.0 ) ); - sh = [ len, len, len, len, len, len, len ]; - len *= pow( len, 6 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.8d_blocked_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.8d_blocked_columnmajor.js deleted file mode 100644 index 82b9f39315f8..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.8d_blocked_columnmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/8d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/8.0 ) ); - sh = [ len, len, len, len, len, len, len, len ]; - len *= pow( len, 7 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.8d_blocked_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.8d_blocked_rowmajor.js deleted file mode 100644 index 82b9f39315f8..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.8d_blocked_rowmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/8d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/8.0 ) ); - sh = [ len, len, len, len, len, len, len, len ]; - len *= pow( len, 7 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.8d_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.8d_columnmajor.js deleted file mode 100644 index 481b1e392b7f..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.8d_columnmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/8d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/8.0 ) ); - sh = [ len, len, len, len, len, len, len, len ]; - len *= pow( len, 7 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.8d_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.8d_rowmajor.js deleted file mode 100644 index 9e9977654222..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.8d_rowmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/8d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/8.0 ) ); - sh = [ len, len, len, len, len, len, len, len ]; - len *= pow( len, 7 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.9d_blocked_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.9d_blocked_columnmajor.js deleted file mode 100644 index d5cb26f72dd1..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.9d_blocked_columnmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/9d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/9.0 ) ); - sh = [ len, len, len, len, len, len, len, len, len ]; - len *= pow( len, 8 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.9d_blocked_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.9d_blocked_rowmajor.js deleted file mode 100644 index 1368e17e557c..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.9d_blocked_rowmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/9d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/9.0 ) ); - sh = [ len, len, len, len, len, len, len, len, len ]; - len *= pow( len, 8 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.9d_columnmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.9d_columnmajor.js deleted file mode 100644 index 481e9718f93e..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.9d_columnmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/9d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/9.0 ) ); - sh = [ len, len, len, len, len, len, len, len, len ]; - len *= pow( len, 8 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main(); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.9d_rowmajor.js b/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.9d_rowmajor.js deleted file mode 100644 index a2ebf196fa79..000000000000 --- a/lib/node_modules/@stdlib/ndarray/base/every/benchmark/benchmark.9d_rowmajor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -var pkg = require( './../package.json' ).name; -var every = require( './../lib/9d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype ) { - var x; - - x = discreteUniform( len, 1, 100 ); - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - 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 = every( x ); - if ( typeof out !== 'boolean' ) { - b.fail( 'should return a boolean' ); - } - } - b.toc(); - if ( !isBoolean( out ) ) { - b.fail( 'should return a boolean' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - - len = floor( pow( len, 1.0/9.0 ) ); - sh = [ len, len, len, len, len, len, len, len, len ]; - len *= pow( len, 8 ); - f = createBenchmark( len, sh, t1 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',xtype='+t1, f ); - } - } -} - -main();