diff --git a/lib/node_modules/@stdlib/blas/ext/base/gcusome/README.md b/lib/node_modules/@stdlib/blas/ext/base/gcusome/README.md new file mode 100644 index 000000000000..0d0eab4c5001 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gcusome/README.md @@ -0,0 +1,180 @@ + + +# gcusome + +> Cumulatively test whether at least `k` elements in a strided array are truthy. + +
+ +
+ + + +
+ +## Usage + +```javascript +var gcusome = require( '@stdlib/blas/ext/base/gcusome' ); +``` + +#### gcusome( N, k, x, strideX, out, strideOut ) + +Cumulatively tests whether at least `k` elements in a strided array are truthy. + +```javascript +var x = [ 0, 0, 1, 1, 1 ]; +var out = [ false, false, false, false, false ]; + +gcusome( x.length, 2, x, 1, out, 1 ); +// out => [ false, false, false, true, true ] +``` + +The function has the following parameters: + +- **N**: number of indexed elements. +- **k**: minimum number of truthy elements. +- **x**: input [`Array`][mdn-array] or [`typed array`][mdn-typed-array]. +- **strideX**: stride length for `x`. +- **out**: output [`Array`][mdn-array] or [`typed array`][mdn-typed-array]. +- **strideOut**: stride length for `out`. + +The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. For example, to cumulatively test every other element: + +```javascript +var x = [ 0, 0, 1, 0, 1, 0, 1, 0 ]; +var out = [ false, false, false, false ]; + +gcusome( 4, 2, x, 2, out, 1 ); +// out => [ false, false, true, true ] +``` + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + + + +```javascript +var Uint8Array = require( '@stdlib/array/uint8' ); + +// Initial arrays... +var x0 = new Uint8Array( [ 0, 0, 1, 0, 1, 1 ] ); +var o0 = new Uint8Array( x0.length ); + +// Create offset views... +var x1 = new Uint8Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var o1 = new Uint8Array( o0.buffer, o0.BYTES_PER_ELEMENT*3 ); // start at 4th element + +gcusome( 3, 2, x1, 2, o1, 1 ); +// o0 => [ 0, 0, 0, 0, 0, 0 ] +``` + +#### gcusome.ndarray( N, k, x, strideX, offsetX, out, strideOut, offsetOut ) + +Cumulatively tests whether at least `k` elements in a strided array are truthy using alternative indexing semantics. + +```javascript +var x = [ 0, 0, 1, 1, 1 ]; +var out = [ false, false, false, false, false ]; + +gcusome.ndarray( x.length, 2, x, 1, 0, out, 1, 0 ); +// out => [ false, false, false, true, true ] +``` + +The function has the following additional parameters: + +- **offsetX**: starting index for `x`. +- **offsetOut**: starting index for `out`. + +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, offset parameters support indexing semantics based on starting indices. For example, to cumulatively test every other element starting from the third element: + +```javascript +var x = [ 0, 0, 1, 0, 1, 0, 1, 0 ]; +var out = [ false, false, false ]; + +gcusome.ndarray( 3, 2, x, 2, 2, out, 1, 0 ); +// out => [ false, true, true ] +``` + +
+ + + +
+ +## Notes + +- If `N <= 0`, both functions return `out` unchanged. +- Both functions support array-like objects having getter and setter accessors for array element access (e.g., [`@stdlib/array/base/accessor`][@stdlib/array/base/accessor]). + +
+ + + +
+ +## Examples + + + +```javascript +var bernoulli = require( '@stdlib/random/array/bernoulli' ); +var filled = require( '@stdlib/array/base/filled' ); +var gcusome = require( '@stdlib/blas/ext/base/gcusome' ); + +var x = bernoulli( 10, 0.5, { + 'dtype': 'generic' +}); +console.log( x ); + +var out = filled( false, x.length ); +gcusome( x.length, 2, x, 1, out, 1 ); +console.log( out ); +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/ext/base/gcusome/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/gcusome/benchmark/benchmark.js new file mode 100644 index 000000000000..f79d93cf3a2d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gcusome/benchmark/benchmark.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var bernoulli = require( '@stdlib/random/array/bernoulli' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ); +var filled = require( '@stdlib/array/base/filled' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var gcusome = require( './../lib/main.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'generic' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var out = filled( false, len ); + var x = bernoulli( len, 0.5, options ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var v; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = gcusome( len, len-1, x, 1, out, 1 ); + if ( typeof v[ i%len ] !== 'boolean' ) { + b.fail( 'should return boolean' ); + } + } + b.toc(); + if ( !isBoolean( v[ i%len ] ) ) { + b.fail( 'should return boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( format( '%s:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/gcusome/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gcusome/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..9f4f2d9ee9dd --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gcusome/benchmark/benchmark.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var bernoulli = require( '@stdlib/random/array/bernoulli' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ); +var filled = require( '@stdlib/array/base/filled' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var gcusome = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'generic' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var out = filled( false, len ); + var x = bernoulli( len, 0.5, options ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var v; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = gcusome( len, len-1, x, 1, 0, out, 1, 0 ); + if ( typeof v[ i%len ] !== 'boolean' ) { + b.fail( 'should return boolean' ); + } + } + b.toc(); + if ( !isBoolean( v[ i%len ] ) ) { + b.fail( 'should return boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( format( '%s:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/gcusome/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/gcusome/docs/repl.txt new file mode 100644 index 000000000000..c38289155666 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gcusome/docs/repl.txt @@ -0,0 +1,118 @@ + +{{alias}}( N, k, x, strideX, out, strideOut ) + Cumulatively tests whether at least `k` elements in a strided array are + truthy. + + The `N` and stride parameters determine which elements in the strided arrays + are accessed at runtime. + + Indexing is relative to the first index. To introduce an offset, use a typed + array view. + + If `N <= 0`, the function returns `out` unchanged. + + Parameters + ---------- + N: integer + Number of indexed elements. + + k: integer + Minimum number of truthy elements. + + x: ArrayLikeObject + Input array. + + strideX: integer + Stride length for `x`. + + out: ArrayLikeObject + Output array. + + strideOut: integer + Stride length for `out`. + + Returns + ------- + out: ArrayLikeObject + Output array. + + Examples + -------- + // Standard Usage: + > var x = [ 0, 0, 1, 1, 1 ]; + > var out = [ false, false, false, false, false ]; + > {{alias}}( x.length, 2, x, 1, out, 1 ) + [ false, false, false, true, true ] + + // Using `N` and stride parameters: + > x = [ 0, 0, 1, 0, 1, 0, 1, 0 ]; + > out = [ false, false, false, false ]; + > {{alias}}( 4, 2, x, 2, out, 1 ) + [ false, false, true, true ] + + // Using view offsets: + > var x0 = new {{alias:@stdlib/array/uint8}}( [ 0, 0, 1, 0, 1, 1 ] ); + > var o0 = new {{alias:@stdlib/array/uint8}}( x0.length ); + > var x1 = new {{alias:@stdlib/array/uint8}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); + > var o1 = new {{alias:@stdlib/array/uint8}}( o0.buffer, o0.BYTES_PER_ELEMENT*3 ); + > {{alias}}( 3, 2, x1, 2, o1, 1 ) + [ 0, 0, 0 ] + > o0 + [ 0, 0, 0, 0, 0, 0 ] + + +{{alias}}.ndarray( N, k, x, strideX, offsetX, out, strideOut, offsetOut ) + Cumulatively tests whether at least `k` elements in a strided array are + truthy using alternative indexing semantics. + + While typed array views mandate a view offset based on the underlying + buffer, the offset parameters support indexing semantics based on starting + indices. + + Parameters + ---------- + N: integer + Number of indexed elements. + + k: integer + Minimum number of truthy elements. + + x: ArrayLikeObject + Input array. + + strideX: integer + Stride length for `x`. + + offsetX: integer + Starting index for `x`. + + out: ArrayLikeObject + Output array. + + strideOut: integer + Stride length for `out`. + + offsetOut: integer + Starting index for `out`. + + Returns + ------- + out: ArrayLikeObject + Output array. + + Examples + -------- + // Standard Usage: + > var x = [ 0, 0, 1, 1, 1 ]; + > var out = [ false, false, false, false, false ]; + > {{alias}}.ndarray( x.length, 2, x, 1, 0, out, 1, 0 ) + [ false, false, false, true, true ] + + // Advanced indexing: + > x = [ 0, 0, 1, 0, 1, 0, 1, 0 ]; + > out = [ false, false, false ]; + > {{alias}}.ndarray( 3, 2, x, 2, 2, out, 1, 0 ) + [ false, true, true ] + + See Also + -------- diff --git a/lib/node_modules/@stdlib/blas/ext/base/gcusome/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/gcusome/docs/types/index.d.ts new file mode 100644 index 000000000000..461458d236d2 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gcusome/docs/types/index.d.ts @@ -0,0 +1,112 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { Collection, AccessorArrayLike } from '@stdlib/types/array'; + +/** +* Input array. +*/ +type InputArray = Collection | AccessorArrayLike; + +/** +* Output array. +*/ +type OutputArray = Collection | AccessorArrayLike; + +/** +* Interface describing `gcusome`. +*/ +interface Routine { + /** + * Cumulatively tests whether at least `k` elements in a strided array are truthy. + * + * @param N - number of indexed elements + * @param k - minimum number of truthy elements + * @param x - input array + * @param strideX - stride length for `x` + * @param out - output array + * @param strideOut - stride length for `out` + * @returns output array + * + * @example + * var x = [ 0, 0, 1, 1, 1 ]; + * var out = [ false, false, false, false, false ]; + * + * gcusome( x.length, 2, x, 1, out, 1 ); + * // out => [ false, false, false, true, true ] + */ + = OutputArray>( N: number, k: number, x: InputArray, strideX: number, out: U, strideOut: number ): U; + + /** + * Cumulatively tests whether at least `k` elements in a strided array are truthy using alternative indexing semantics. + * + * @param N - number of indexed elements + * @param k - minimum number of truthy elements + * @param x - input array + * @param strideX - stride length for `x` + * @param offsetX - starting index for `x` + * @param out - output array + * @param strideOut - stride length for `out` + * @param offsetOut - starting index for `out` + * @returns output array + * + * @example + * var x = [ 0, 0, 1, 1, 1 ]; + * var out = [ false, false, false, false, false ]; + * + * gcusome.ndarray( x.length, 2, x, 1, 0, out, 1, 0 ); + * // out => [ false, false, false, true, true ] + */ + ndarray = OutputArray>( N: number, k: number, x: InputArray, strideX: number, offsetX: number, out: U, strideOut: number, offsetOut: number ): U; +} + +/** +* Cumulatively tests whether at least `k` elements in a strided array are truthy. +* +* @param N - number of indexed elements +* @param k - minimum number of truthy elements +* @param x - input array +* @param strideX - stride length for `x` +* @param out - output array +* @param strideOut - stride length for `out` +* @returns output array +* +* @example +* var x = [ 0, 0, 1, 1, 1 ]; +* var out = [ false, false, false, false, false ]; +* +* gcusome( x.length, 2, x, 1, out, 1 ); +* // out => [ false, false, false, true, true ] +* +* @example +* var x = [ 0, 0, 1, 1, 1 ]; +* var out = [ false, false, false, false, false ]; +* +* gcusome.ndarray( x.length, 2, x, 1, 0, out, 1, 0 ); +* // out => [ false, false, false, true, true ] +*/ +declare var gcusome: Routine; + + +// EXPORTS // + +export = gcusome; diff --git a/lib/node_modules/@stdlib/blas/ext/base/gcusome/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/base/gcusome/docs/types/test.ts new file mode 100644 index 000000000000..f82501842fb1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gcusome/docs/types/test.ts @@ -0,0 +1,272 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable space-in-parens */ + +import AccessorArray = require( '@stdlib/array/base/accessor' ); +import BooleanArray = require( '@stdlib/array/bool' ); +import gcusome = require( './index' ); + + +// TESTS // + +// The function returns a boolean array... +{ + const x = [ 0, 0, 1, 1 ]; + const out = new BooleanArray( 4 ); + + gcusome( x.length, 2, x, 1, out, 1 ); // $ExpectType BooleanArray + gcusome( x.length, 2, new AccessorArray( x ), 1, new AccessorArray( [ false, false, false, false ] ), 1 ); // $ExpectType AccessorArray +} + +// The compiler throws an error if the function is provided a first argument which is not a number... +{ + const x = [ 0, 0, 1, 1 ]; + const out = [ false, false, false, false ]; + + gcusome( '10', 2, x, 1, out, 1 ); // $ExpectError + gcusome( true, 2, x, 1, out, 1 ); // $ExpectError + gcusome( false, 2, x, 1, out, 1 ); // $ExpectError + gcusome( null, 2, x, 1, out, 1 ); // $ExpectError + gcusome( undefined, 2, x, 1, out, 1 ); // $ExpectError + gcusome( [], 2, x, 1, out, 1 ); // $ExpectError + gcusome( {}, 2, x, 1, out, 1 ); // $ExpectError + gcusome( ( x: number ): number => x, 2, x, 1, out, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a number... +{ + const x = [ 0, 0, 1, 1 ]; + const out = [ false, false, false, false ]; + + gcusome( x.length, '10', x, 1, out, 1 ); // $ExpectError + gcusome( x.length, true, x, 1, out, 1 ); // $ExpectError + gcusome( x.length, false, x, 1, out, 1 ); // $ExpectError + gcusome( x.length, null, x, 1, out, 1 ); // $ExpectError + gcusome( x.length, undefined, x, 1, out, 1 ); // $ExpectError + gcusome( x.length, [], x, 1, out, 1 ); // $ExpectError + gcusome( x.length, {}, x, 1, out, 1 ); // $ExpectError + gcusome( x.length, ( x: number ): number => x, x, 1, out, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a collection... +{ + const out = [ false, false, false, false ]; + + gcusome( 4, 2, 10, 1, out, 1 ); // $ExpectError + gcusome( 4, 2, true, 1, out, 1 ); // $ExpectError + gcusome( 4, 2, false, 1, out, 1 ); // $ExpectError + gcusome( 4, 2, null, 1, out, 1 ); // $ExpectError + gcusome( 4, 2, undefined, 1, out, 1 ); // $ExpectError + gcusome( 4, 2, {}, 1, out, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const x = [ 0, 0, 1, 1 ]; + const out = [ false, false, false, false ]; + + gcusome( x.length, 2, x, '10', out, 1 ); // $ExpectError + gcusome( x.length, 2, x, true, out, 1 ); // $ExpectError + gcusome( x.length, 2, x, false, out, 1 ); // $ExpectError + gcusome( x.length, 2, x, null, out, 1 ); // $ExpectError + gcusome( x.length, 2, x, undefined, out, 1 ); // $ExpectError + gcusome( x.length, 2, x, [], out, 1 ); // $ExpectError + gcusome( x.length, 2, x, {}, out, 1 ); // $ExpectError + gcusome( x.length, 2, x, ( x: number ): number => x, out, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a collection... +{ + const x = [ 0, 0, 1, 1 ]; + + gcusome( x.length, 2, x, 1, 10, 1 ); // $ExpectError + gcusome( x.length, 2, x, 1, true, 1 ); // $ExpectError + gcusome( x.length, 2, x, 1, false, 1 ); // $ExpectError + gcusome( x.length, 2, x, 1, null, 1 ); // $ExpectError + gcusome( x.length, 2, x, 1, undefined, 1 ); // $ExpectError + gcusome( x.length, 2, x, 1, {}, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a number... +{ + const x = [ 0, 0, 1, 1 ]; + const out = [ false, false, false, false ]; + + gcusome( x.length, 2, x, 1, out, '10' ); // $ExpectError + gcusome( x.length, 2, x, 1, out, true ); // $ExpectError + gcusome( x.length, 2, x, 1, out, false ); // $ExpectError + gcusome( x.length, 2, x, 1, out, null ); // $ExpectError + gcusome( x.length, 2, x, 1, out, undefined ); // $ExpectError + gcusome( x.length, 2, x, 1, out, [] ); // $ExpectError + gcusome( x.length, 2, x, 1, out, {} ); // $ExpectError + gcusome( x.length, 2, x, 1, out, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const x = [ 0, 0, 1, 1 ]; + const out = [ false, false, false, false ]; + + gcusome(); // $ExpectError + gcusome( x.length ); // $ExpectError + gcusome( x.length, 2 ); // $ExpectError + gcusome( x.length, 2, x ); // $ExpectError + gcusome( x.length, 2, x, 1 ); // $ExpectError + gcusome( x.length, 2, x, 1, out ); // $ExpectError + gcusome( x.length, 2, x, 1, out, 1, 10 ); // $ExpectError +} + +// Attached to the main export is an `ndarray` method which returns a boolean array... +{ + const x = [ 0, 0, 1, 1 ]; + const out = new BooleanArray( 4 ); + + gcusome.ndarray( x.length, 2, x, 1, 0, out, 1, 0 ); // $ExpectType BooleanArray + gcusome.ndarray( x.length, 2, new AccessorArray( x ), 1, 0, new AccessorArray( [ false, false, false, false ] ), 1, 0 ); // $ExpectType AccessorArray +} + +// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... +{ + const x = [ 0, 0, 1, 1 ]; + const out = [ false, false, false, false ]; + + gcusome.ndarray( '10', 2, x, 1, 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( true, 2, x, 1, 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( false, 2, x, 1, 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( null, 2, x, 1, 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( undefined, 2, x, 1, 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( [], 2, x, 1, 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( {}, 2, x, 1, 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( ( x: number ): number => x, 2, x, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a second argument which is not a number... +{ + const x = [ 0, 0, 1, 1 ]; + const out = [ false, false, false, false ]; + + gcusome.ndarray( x.length, '10', x, 1, 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, true, x, 1, 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, false, x, 1, 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, null, x, 1, 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, undefined, x, 1, 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, [], x, 1, 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, {}, x, 1, 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, ( x: number ): number => x, x, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a third argument which is not a collection... +{ + const out = [ false, false, false, false ]; + + gcusome.ndarray( 4, 2, 10, 1, 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( 4, 2, true, 1, 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( 4, 2, false, 1, 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( 4, 2, null, 1, 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( 4, 2, undefined, 1, 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( 4, 2, {}, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number... +{ + const x = [ 0, 0, 1, 1 ]; + const out = [ false, false, false, false ]; + + gcusome.ndarray( x.length, 2, x, '10', 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, true, 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, false, 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, null, 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, undefined, 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, [], 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, {}, 0, out, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, ( x: number ): number => x, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a number... +{ + const x = [ 0, 0, 1, 1 ]; + const out = [ false, false, false, false ]; + + gcusome.ndarray( x.length, 2, x, 1, '10', out, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, true, out, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, false, out, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, null, out, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, undefined, out, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, [], out, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, {}, out, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, ( x: number ): number => x, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a sixth argument which is not a collection... +{ + const x = [ 0, 0, 1, 1 ]; + + gcusome.ndarray( x.length, 2, x, 1, 0, 10, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, 0, true, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, 0, false, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, 0, null, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, 0, undefined, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, 0, {}, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a seventh argument which is not a number... +{ + const x = [ 0, 0, 1, 1 ]; + const out = [ false, false, false, false ]; + + gcusome.ndarray( x.length, 2, x, 1, 0, out, '10', 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, 0, out, true, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, 0, out, false, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, 0, out, null, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, 0, out, undefined, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, 0, out, [], 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, 0, out, {}, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, 0, out, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an eighth argument which is not a number... +{ + const x = [ 0, 0, 1, 1 ]; + const out = [ false, false, false, false ]; + + gcusome.ndarray( x.length, 2, x, 1, 0, out, 1, '10' ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, 0, out, 1, true ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, 0, out, 1, false ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, 0, out, 1, null ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, 0, out, 1, undefined ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, 0, out, 1, [] ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, 0, out, 1, {} ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, 0, out, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + const x = [ 0, 0, 1, 1 ]; + const out = [ false, false, false, false ]; + + gcusome.ndarray(); // $ExpectError + gcusome.ndarray( x.length ); // $ExpectError + gcusome.ndarray( x.length, 2 ); // $ExpectError + gcusome.ndarray( x.length, 2, x ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, 0 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, 0, out ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, 0, out, 1 ); // $ExpectError + gcusome.ndarray( x.length, 2, x, 1, 0, out, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/gcusome/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/gcusome/examples/index.js new file mode 100644 index 000000000000..76e78b99f9b0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gcusome/examples/index.js @@ -0,0 +1,32 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var bernoulli = require( '@stdlib/random/array/bernoulli' ); +var filled = require( '@stdlib/array/base/filled' ); +var gcusome = require( './../lib' ); + +var x = bernoulli( 10, 0.5, { + 'dtype': 'generic' +}); +console.log( x ); + +var out = filled( false, x.length ); +gcusome( x.length, 2, x, 1, out, 1 ); +console.log( out ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/gcusome/lib/accessors.js b/lib/node_modules/@stdlib/blas/ext/base/gcusome/lib/accessors.js new file mode 100644 index 000000000000..50a4667e1200 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gcusome/lib/accessors.js @@ -0,0 +1,91 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Cumulatively tests whether at least `k` elements in a strided array are truthy. +* +* @private +* @param {PositiveInteger} N - number of indexed elements +* @param {integer} k - minimum number of truthy elements +* @param {Object} x - input array object +* @param {Collection} x.data - input array data +* @param {Array} x.accessors - array element accessors +* @param {integer} strideX - stride length for `x` +* @param {NonNegativeInteger} offsetX - starting index for `x` +* @param {Object} out - output array object +* @param {Collection} out.data - output array data +* @param {Array} out.accessors - array element accessors +* @param {integer} strideOut - stride length for `out` +* @param {NonNegativeInteger} offsetOut - starting index for `out` +* @returns {Object} output array object +* +* @example +* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +* var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +* +* var x = [ 0, 0, 1, 1, 1 ]; +* var out = [ false, false, false, false, false ]; +* +* gcusome( 5, 2, arraylike2object( toAccessorArray( x ) ), 1, 0, arraylike2object( toAccessorArray( out ) ), 1, 0 ); +* // out => [ false, false, false, true, true ] +*/ +function gcusome( N, k, x, strideX, offsetX, out, strideOut, offsetOut ) { + var xbuf; + var obuf; + var get; + var set; + var flg; + var cnt; + var ix; + var io; + var i; + + // Cache reference to array data: + xbuf = x.data; + obuf = out.data; + + // Cache reference to the element accessors: + get = x.accessors[ 0 ]; + set = out.accessors[ 1 ]; + + flg = false; + cnt = k; + ix = offsetX; + io = offsetOut; + for ( i = 0; i < N; i++ ) { + if ( !flg && get( xbuf, ix ) ) { + cnt -= 1; + if ( cnt <= 0 ) { + flg = true; + } + } + set( obuf, io, flg ); + ix += strideX; + io += strideOut; + } + return out; +} + + +// EXPORTS // + +module.exports = gcusome; diff --git a/lib/node_modules/@stdlib/blas/ext/base/gcusome/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/gcusome/lib/index.js new file mode 100644 index 000000000000..54b9346b604e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gcusome/lib/index.js @@ -0,0 +1,59 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Cumulatively test whether at least `k` elements in a strided array are truthy. +* +* @module @stdlib/blas/ext/base/gcusome +* +* @example +* var gcusome = require( '@stdlib/blas/ext/base/gcusome' ); +* +* var x = [ 0, 0, 1, 1, 1 ]; +* var out = [ false, false, false, false, false ]; +* +* gcusome( x.length, 2, x, 1, out, 1 ); +* // out => [ false, false, false, true, true ] +* +* @example +* var gcusome = require( '@stdlib/blas/ext/base/gcusome' ); +* +* var x = [ 0, 0, 1, 1, 1 ]; +* var out = [ false, false, false, false, false ]; +* +* gcusome.ndarray( x.length, 2, x, 1, 0, out, 1, 0 ); +* // out => [ false, false, false, true, true ] +*/ + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var main = require( './main.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( main, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/blas/ext/base/gcusome/lib/main.js b/lib/node_modules/@stdlib/blas/ext/base/gcusome/lib/main.js new file mode 100644 index 000000000000..fc5f1d77b084 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gcusome/lib/main.js @@ -0,0 +1,56 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var stride2offset = require( '@stdlib/strided/base/stride2offset' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +/** +* Cumulatively tests whether at least `k` elements in a strided array are truthy. +* +* @param {PositiveInteger} N - number of indexed elements +* @param {integer} k - minimum number of truthy elements +* @param {Collection} x - input array +* @param {integer} strideX - stride length for `x` +* @param {Collection} out - output array +* @param {integer} strideOut - stride length for `out` +* @returns {Collection} output array +* +* @example +* var x = [ 0, 0, 1, 1, 1 ]; +* var out = [ false, false, false, false, false ]; +* +* gcusome( x.length, 2, x, 1, out, 1 ); +* // out => [ false, false, false, true, true ] +*/ +function gcusome( N, k, x, strideX, out, strideOut ) { + var ox = stride2offset( N, strideX ); + var oo = stride2offset( N, strideOut ); + return ndarray( N, k, x, strideX, ox, out, strideOut, oo ); +} + + +// EXPORTS // + +module.exports = gcusome; diff --git a/lib/node_modules/@stdlib/blas/ext/base/gcusome/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gcusome/lib/ndarray.js new file mode 100644 index 000000000000..940fc92d27f0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gcusome/lib/ndarray.js @@ -0,0 +1,88 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +var accessors = require( './accessors.js' ); + + +// MAIN // + +/** +* Cumulatively tests whether at least `k` elements in a strided array are truthy using alternative indexing semantics. +* +* @param {PositiveInteger} N - number of indexed elements +* @param {integer} k - minimum number of truthy elements +* @param {Collection} x - input array +* @param {integer} strideX - stride length for `x` +* @param {NonNegativeInteger} offsetX - starting index for `x` +* @param {Collection} out - output array +* @param {integer} strideOut - stride length for `out` +* @param {NonNegativeInteger} offsetOut - starting index for `out` +* @returns {Collection} output array +* +* @example +* var x = [ 0, 0, 1, 1, 1 ]; +* var out = [ false, false, false, false, false ]; +* +* gcusome( 5, 2, x, 1, 0, out, 1, 0 ); +* // out => [ false, false, false, true, true ] +*/ +function gcusome( N, k, x, strideX, offsetX, out, strideOut, offsetOut ) { + var flg; + var cnt; + var ox; + var oo; + var ix; + var io; + var i; + + if ( N <= 0 ) { + return out; + } + ox = arraylike2object( x ); + oo = arraylike2object( out ); + if ( ox.accessorProtocol || oo.accessorProtocol ) { + accessors( N, k, ox, strideX, offsetX, oo, strideOut, offsetOut ); + return out; + } + flg = false; + cnt = k; + ix = offsetX; + io = offsetOut; + for ( i = 0; i < N; i++ ) { + if ( !flg && x[ ix ] ) { + cnt -= 1; + if ( cnt <= 0 ) { + flg = true; + } + } + out[ io ] = flg; + ix += strideX; + io += strideOut; + } + return out; +} + + +// EXPORTS // + +module.exports = gcusome; diff --git a/lib/node_modules/@stdlib/blas/ext/base/gcusome/package.json b/lib/node_modules/@stdlib/blas/ext/base/gcusome/package.json new file mode 100644 index 000000000000..3cc593d625d1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gcusome/package.json @@ -0,0 +1,71 @@ +{ + "name": "@stdlib/blas/ext/base/gcusome", + "version": "0.0.0", + "description": "Cumulatively test whether at least k elements in a strided array are 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", + "stdmath", + "mathematics", + "math", + "blas", + "extended", + "cumulative", + "some", + "truthy", + "test", + "strided", + "strided array", + "typed", + "array", + "ndarray", + "vector", + "gcusome" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/gcusome/test/test.js b/lib/node_modules/@stdlib/blas/ext/base/gcusome/test/test.js new file mode 100644 index 000000000000..3c4dd33e5820 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gcusome/test/test.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var gcusome = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof gcusome, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'attached to the main export is a method providing an ndarray interface', function test( t ) { + t.strictEqual( typeof gcusome.ndarray, 'function', 'method is a function' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/gcusome/test/test.main.js b/lib/node_modules/@stdlib/blas/ext/base/gcusome/test/test.main.js new file mode 100644 index 000000000000..1d89155dbc8a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gcusome/test/test.main.js @@ -0,0 +1,444 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +var gcusome = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof gcusome, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 6', function test( t ) { + t.strictEqual( gcusome.length, 6, 'has expected arity' ); + t.end(); +}); + +tape( 'the function returns a reference to the output array', function test( t ) { + var out; + var x; + var y; + + x = [ 0, 0, 1, 1, 1 ]; + y = [ false, false, false, false, false ]; + + out = gcusome( x.length, 2, x, 1, y, 1 ); + + t.strictEqual( out, y, 'same reference' ); + t.end(); +}); + +tape( 'the function returns a reference to the output array (accessors)', function test( t ) { + var out; + var x; + var y; + + x = toAccessorArray( [ 0, 0, 1, 1, 1 ] ); + y = toAccessorArray( [ false, false, false, false, false ] ); + + out = gcusome( x.length, 2, x, 1, y, 1 ); + + t.strictEqual( out, y, 'same reference' ); + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns the output array unchanged', function test( t ) { + var expected; + var out; + var x; + var y; + + x = [ 0, 0, 1, 1, 1 ]; + y = [ false, false, false, false, false ]; + expected = [ false, false, false, false, false ]; + + out = gcusome( 0, 2, x, 1, y, 1 ); + t.deepEqual( out, expected, 'returns expected value' ); + + out = gcusome( -4, 2, x, 1, y, 1 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns the output array unchanged (accessors)', function test( t ) { + var expected; + var x; + var y; + + x = [ 0, 0, 1, 1, 1 ]; + y = [ false, false, false, false, false ]; + expected = [ false, false, false, false, false ]; + + gcusome( 0, 2, toAccessorArray( x ), 1, toAccessorArray( y ), 1 ); + t.deepEqual( y, expected, 'returns expected value' ); + + gcusome( -4, 2, toAccessorArray( x ), 1, toAccessorArray( y ), 1 ); + t.deepEqual( y, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function cumulatively tests whether at least `k` elements are truthy', function test( t ) { + var expected; + var out; + var x; + + x = [ 0, 1, 1, 1 ]; + out = [ false, false, false, false ]; + expected = [ false, false, true, true ]; + + gcusome( x.length, 2, x, 1, out, 1 ); + t.deepEqual( out, expected, 'returns expected value' ); + + x = [ 0, 0, 1, 1, 1 ]; + out = [ false, false, false, false, false ]; + expected = [ false, false, false, true, true ]; + + gcusome( x.length, 2, x, 1, out, 1 ); + t.deepEqual( out, expected, 'returns expected value' ); + + x = [ 1, 1, 1, 0, 0 ]; + out = [ false, false, false, false, false ]; + expected = [ false, true, true, true, true ]; + + gcusome( x.length, 2, x, 1, out, 1 ); + t.deepEqual( out, expected, 'returns expected value' ); + + x = [ 0, 0, 0, 0, 0 ]; + out = [ false, false, false, false, false ]; + expected = [ false, false, false, false, false ]; + + gcusome( x.length, 2, x, 1, out, 1 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function cumulatively tests whether at least `k` elements are truthy (accessors)', function test( t ) { + var expected; + var out; + var x; + + x = [ 0, 1, 1, 1 ]; + out = [ false, false, false, false ]; + expected = [ false, false, true, true ]; + + gcusome( x.length, 2, toAccessorArray( x ), 1, toAccessorArray( out ), 1 ); + t.deepEqual( out, expected, 'returns expected value' ); + + x = [ 0, 0, 0, 0, 0 ]; + out = [ false, false, false, false, false ]; + expected = [ false, false, false, false, false ]; + + gcusome( x.length, 2, toAccessorArray( x ), 1, toAccessorArray( out ), 1 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided a `k` equal to `0`, the function sets output elements to `true` upon encountering the first truthy element', function test( t ) { + var expected; + var out; + var x; + + x = [ 1, 0, 0 ]; + out = [ false, false, false ]; + expected = [ true, true, true ]; + + gcusome( x.length, 0, x, 1, out, 1 ); + t.deepEqual( out, expected, 'returns expected value' ); + + x = [ 0, 0, 0 ]; + out = [ false, false, false ]; + expected = [ false, false, false ]; + + gcusome( x.length, 0, x, 1, out, 1 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided a `k` equal to `0`, the function sets output elements to `true` upon encountering the first truthy element (accessors)', function test( t ) { + var expected; + var out; + var x; + + x = [ 1, 0, 0 ]; + out = [ false, false, false ]; + expected = [ true, true, true ]; + + gcusome( x.length, 0, toAccessorArray( x ), 1, toAccessorArray( out ), 1 ); + t.deepEqual( out, expected, 'returns expected value' ); + + x = [ 0, 0, 0 ]; + out = [ false, false, false ]; + expected = [ false, false, false ]; + + gcusome( x.length, 0, toAccessorArray( x ), 1, toAccessorArray( out ), 1 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided a `k` greater than `N`, the function returns an output array where all elements are `false`', function test( t ) { + var expected; + var out; + var x; + + x = [ 1, 1, 1 ]; + out = [ false, false, false ]; + expected = [ false, false, false ]; + + gcusome( x.length, 5, x, 1, out, 1 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided a `k` greater than `N`, the function returns an output array where all elements are `false` (accessors)', function test( t ) { + var expected; + var out; + var x; + + x = [ 1, 1, 1 ]; + out = [ false, false, false ]; + expected = [ false, false, false ]; + + gcusome( x.length, 5, toAccessorArray( x ), 1, toAccessorArray( out ), 1 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function cumulatively tests whether at least `k` elements are truthy (k=1)', function test( t ) { + var expected; + var out; + var x; + + x = [ 0, 1, 0, 1 ]; + out = [ false, false, false, false ]; + expected = [ false, true, true, true ]; + + gcusome( x.length, 1, x, 1, out, 1 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function cumulatively tests whether at least `k` elements are truthy (k=1, accessors)', function test( t ) { + var expected; + var out; + var x; + + x = [ 0, 1, 0, 1 ]; + out = [ false, false, false, false ]; + expected = [ false, true, true, true ]; + + gcusome( x.length, 1, toAccessorArray( x ), 1, toAccessorArray( out ), 1 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports an `x` stride', function test( t ) { + var expected; + var out; + var x; + + x = [ + 0, // 0 + 999, + 0, // 1 + 999, + 1, // 2 + 999, + 1 // 3 + ]; + out = [ false, false, false, false ]; + expected = [ false, false, false, true ]; + + gcusome( 4, 2, x, 2, out, 1 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports an `x` stride (accessors)', function test( t ) { + var expected; + var out; + var x; + + x = [ + 0, // 0 + 999, + 0, // 1 + 999, + 1, // 2 + 999, + 1 // 3 + ]; + out = [ false, false, false, false ]; + expected = [ false, false, false, true ]; + + gcusome( 4, 2, toAccessorArray( x ), 2, toAccessorArray( out ), 1 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports an `out` stride', function test( t ) { + var expected; + var out; + var x; + + x = [ 0, 1, 1, 1 ]; + out = [ + false, // 0 + 999, + false, // 1 + 999, + false, // 2 + 999, + false // 3 + ]; + expected = [ + false, + 999, + false, + 999, + true, + 999, + true + ]; + + gcusome( 4, 2, x, 1, out, 2 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports an `out` stride (accessors)', function test( t ) { + var expected; + var out; + var x; + + x = [ 0, 1, 1, 1 ]; + out = [ + false, // 0 + 999, + false, // 1 + 999, + false, // 2 + 999, + false // 3 + ]; + expected = [ + false, + 999, + false, + 999, + true, + 999, + true + ]; + + gcusome( 4, 2, toAccessorArray( x ), 1, toAccessorArray( out ), 2 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports a negative `x` stride', function test( t ) { + var expected; + var out; + var x; + + x = [ + 0, // 3 + 0, // 2 + 1, // 1 + 1 // 0 + ]; + out = [ false, false, false, false ]; + expected = [ false, true, true, true ]; + + gcusome( 4, 2, x, -1, out, 1 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports a negative `x` stride (accessors)', function test( t ) { + var expected; + var out; + var x; + + x = [ + 0, // 3 + 0, // 2 + 1, // 1 + 1 // 0 + ]; + out = [ false, false, false, false ]; + expected = [ false, true, true, true ]; + + gcusome( 4, 2, toAccessorArray( x ), -1, toAccessorArray( out ), 1 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports a negative `out` stride', function test( t ) { + var expected; + var out; + var x; + + x = [ 0, 1, 1, 1 ]; + out = [ false, false, false, false ]; + expected = [ true, true, false, false ]; + + gcusome( 4, 2, x, 1, out, -1 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports a negative `out` stride (accessors)', function test( t ) { + var expected; + var out; + var x; + + x = [ 0, 1, 1, 1 ]; + out = [ false, false, false, false ]; + expected = [ true, true, false, false ]; + + gcusome( 4, 2, toAccessorArray( x ), 1, toAccessorArray( out ), -1 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/gcusome/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gcusome/test/test.ndarray.js new file mode 100644 index 000000000000..c16964f5ccf9 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gcusome/test/test.ndarray.js @@ -0,0 +1,534 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +var gcusome = require( './../lib/ndarray.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof gcusome, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 8', function test( t ) { + t.strictEqual( gcusome.length, 8, 'has expected arity' ); + t.end(); +}); + +tape( 'the function returns a reference to the output array', function test( t ) { + var out; + var x; + var y; + + x = [ 0, 0, 1, 1, 1 ]; + y = [ false, false, false, false, false ]; + + out = gcusome( x.length, 2, x, 1, 0, y, 1, 0 ); + + t.strictEqual( out, y, 'same reference' ); + t.end(); +}); + +tape( 'the function returns a reference to the output array (accessors)', function test( t ) { + var out; + var x; + var y; + + x = toAccessorArray( [ 0, 0, 1, 1, 1 ] ); + y = toAccessorArray( [ false, false, false, false, false ] ); + + out = gcusome( x.length, 2, x, 1, 0, y, 1, 0 ); + + t.strictEqual( out, y, 'same reference' ); + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns the output array unchanged', function test( t ) { + var expected; + var out; + var x; + var y; + + x = [ 0, 0, 1, 1, 1 ]; + y = [ false, false, false, false, false ]; + expected = [ false, false, false, false, false ]; + + out = gcusome( 0, 2, x, 1, 0, y, 1, 0 ); + t.deepEqual( out, expected, 'returns expected value' ); + + out = gcusome( -4, 2, x, 1, 0, y, 1, 0 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns the output array unchanged (accessors)', function test( t ) { + var expected; + var x; + var y; + + x = [ 0, 0, 1, 1, 1 ]; + y = [ false, false, false, false, false ]; + expected = [ false, false, false, false, false ]; + + gcusome( 0, 2, toAccessorArray( x ), 1, 0, toAccessorArray( y ), 1, 0 ); + t.deepEqual( y, expected, 'returns expected value' ); + + gcusome( -4, 2, toAccessorArray( x ), 1, 0, toAccessorArray( y ), 1, 0 ); + t.deepEqual( y, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function cumulatively tests whether at least `k` elements are truthy', function test( t ) { + var expected; + var out; + var x; + + x = [ 0, 1, 1, 1 ]; + out = [ false, false, false, false ]; + expected = [ false, false, true, true ]; + + gcusome( x.length, 2, x, 1, 0, out, 1, 0 ); + t.deepEqual( out, expected, 'returns expected value' ); + + x = [ 0, 0, 1, 1, 1 ]; + out = [ false, false, false, false, false ]; + expected = [ false, false, false, true, true ]; + + gcusome( x.length, 2, x, 1, 0, out, 1, 0 ); + t.deepEqual( out, expected, 'returns expected value' ); + + x = [ 1, 1, 1, 0, 0 ]; + out = [ false, false, false, false, false ]; + expected = [ false, true, true, true, true ]; + + gcusome( x.length, 2, x, 1, 0, out, 1, 0 ); + t.deepEqual( out, expected, 'returns expected value' ); + + x = [ 0, 0, 0, 0, 0 ]; + out = [ false, false, false, false, false ]; + expected = [ false, false, false, false, false ]; + + gcusome( x.length, 2, x, 1, 0, out, 1, 0 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function cumulatively tests whether at least `k` elements are truthy (accessors)', function test( t ) { + var expected; + var out; + var x; + + x = [ 0, 1, 1, 1 ]; + out = [ false, false, false, false ]; + expected = [ false, false, true, true ]; + + gcusome( x.length, 2, toAccessorArray( x ), 1, 0, toAccessorArray( out ), 1, 0 ); + t.deepEqual( out, expected, 'returns expected value' ); + + x = [ 0, 0, 0, 0, 0 ]; + out = [ false, false, false, false, false ]; + expected = [ false, false, false, false, false ]; + + gcusome( x.length, 2, toAccessorArray( x ), 1, 0, toAccessorArray( out ), 1, 0 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided a `k` equal to `0`, the function sets output elements to `true` upon encountering the first truthy element', function test( t ) { + var expected; + var out; + var x; + + x = [ 1, 0, 0 ]; + out = [ false, false, false ]; + expected = [ true, true, true ]; + + gcusome( x.length, 0, x, 1, 0, out, 1, 0 ); + t.deepEqual( out, expected, 'returns expected value' ); + + x = [ 0, 0, 0 ]; + out = [ false, false, false ]; + expected = [ false, false, false ]; + + gcusome( x.length, 0, x, 1, 0, out, 1, 0 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided a `k` equal to `0`, the function sets output elements to `true` upon encountering the first truthy element (accessors)', function test( t ) { + var expected; + var out; + var x; + + x = [ 1, 0, 0 ]; + out = [ false, false, false ]; + expected = [ true, true, true ]; + + gcusome( x.length, 0, toAccessorArray( x ), 1, 0, toAccessorArray( out ), 1, 0 ); + t.deepEqual( out, expected, 'returns expected value' ); + + x = [ 0, 0, 0 ]; + out = [ false, false, false ]; + expected = [ false, false, false ]; + + gcusome( x.length, 0, toAccessorArray( x ), 1, 0, toAccessorArray( out ), 1, 0 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided a `k` greater than `N`, the function returns an output array where all elements are `false`', function test( t ) { + var expected; + var out; + var x; + + x = [ 1, 1, 1 ]; + out = [ false, false, false ]; + expected = [ false, false, false ]; + + gcusome( x.length, 5, x, 1, 0, out, 1, 0 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided a `k` greater than `N`, the function returns an output array where all elements are `false` (accessors)', function test( t ) { + var expected; + var out; + var x; + + x = [ 1, 1, 1 ]; + out = [ false, false, false ]; + expected = [ false, false, false ]; + + gcusome( x.length, 5, toAccessorArray( x ), 1, 0, toAccessorArray( out ), 1, 0 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function cumulatively tests whether at least `k` elements are truthy (k=1)', function test( t ) { + var expected; + var out; + var x; + + x = [ 0, 1, 0, 1 ]; + out = [ false, false, false, false ]; + expected = [ false, true, true, true ]; + + gcusome( x.length, 1, x, 1, 0, out, 1, 0 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function cumulatively tests whether at least `k` elements are truthy (k=1, accessors)', function test( t ) { + var expected; + var out; + var x; + + x = [ 0, 1, 0, 1 ]; + out = [ false, false, false, false ]; + expected = [ false, true, true, true ]; + + gcusome( x.length, 1, toAccessorArray( x ), 1, 0, toAccessorArray( out ), 1, 0 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports an `x` stride', function test( t ) { + var expected; + var out; + var x; + + x = [ + 0, // 0 + 999, + 0, // 1 + 999, + 1, // 2 + 999, + 1 // 3 + ]; + out = [ false, false, false, false ]; + expected = [ false, false, false, true ]; + + gcusome( 4, 2, x, 2, 0, out, 1, 0 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports an `x` stride (accessors)', function test( t ) { + var expected; + var out; + var x; + + x = [ + 0, // 0 + 999, + 0, // 1 + 999, + 1, // 2 + 999, + 1 // 3 + ]; + out = [ false, false, false, false ]; + expected = [ false, false, false, true ]; + + gcusome( 4, 2, toAccessorArray( x ), 2, 0, toAccessorArray( out ), 1, 0 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports an `out` stride', function test( t ) { + var expected; + var out; + var x; + + x = [ 0, 1, 1, 1 ]; + out = [ + false, // 0 + 999, + false, // 1 + 999, + false, // 2 + 999, + false // 3 + ]; + expected = [ + false, + 999, + false, + 999, + true, + 999, + true + ]; + + gcusome( 4, 2, x, 1, 0, out, 2, 0 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports an `out` stride (accessors)', function test( t ) { + var expected; + var out; + var x; + + x = [ 0, 1, 1, 1 ]; + out = [ + false, // 0 + 999, + false, // 1 + 999, + false, // 2 + 999, + false // 3 + ]; + expected = [ + false, + 999, + false, + 999, + true, + 999, + true + ]; + + gcusome( 4, 2, toAccessorArray( x ), 1, 0, toAccessorArray( out ), 2, 0 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports a negative `x` stride', function test( t ) { + var expected; + var out; + var x; + + x = [ + 0, // 3 + 0, // 2 + 1, // 1 + 1 // 0 + ]; + out = [ false, false, false, false ]; + expected = [ false, true, true, true ]; + + gcusome( 4, 2, x, -1, 3, out, 1, 0 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports a negative `x` stride (accessors)', function test( t ) { + var expected; + var out; + var x; + + x = [ + 0, // 3 + 0, // 2 + 1, // 1 + 1 // 0 + ]; + out = [ false, false, false, false ]; + expected = [ false, true, true, true ]; + + gcusome( 4, 2, toAccessorArray( x ), -1, 3, toAccessorArray( out ), 1, 0 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports a negative `out` stride', function test( t ) { + var expected; + var out; + var x; + + x = [ 0, 1, 1, 1 ]; + out = [ false, false, false, false ]; + expected = [ true, true, false, false ]; + + gcusome( 4, 2, x, 1, 0, out, -1, 3 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports a negative `out` stride (accessors)', function test( t ) { + var expected; + var out; + var x; + + x = [ 0, 1, 1, 1 ]; + out = [ false, false, false, false ]; + expected = [ true, true, false, false ]; + + gcusome( 4, 2, toAccessorArray( x ), 1, 0, toAccessorArray( out ), -1, 3 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports an `x` offset', function test( t ) { + var expected; + var out; + var x; + + x = [ 0, 0, 1, 1, 1 ]; + out = [ false, false, false ]; + expected = [ false, true, true ]; + + gcusome( 3, 2, x, 1, 2, out, 1, 0 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports an `x` offset (accessors)', function test( t ) { + var expected; + var out; + var x; + + x = [ 0, 0, 1, 1, 1 ]; + out = [ false, false, false ]; + expected = [ false, true, true ]; + + gcusome( 3, 2, toAccessorArray( x ), 1, 2, toAccessorArray( out ), 1, 0 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports an `out` offset', function test( t ) { + var expected; + var out; + var x; + + x = [ 0, 1, 1 ]; + out = [ 999, 999, false, false, false ]; + expected = [ 999, 999, false, false, true ]; + + gcusome( 3, 2, x, 1, 0, out, 1, 2 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports an `out` offset (accessors)', function test( t ) { + var expected; + var out; + var x; + + x = [ 0, 1, 1 ]; + out = [ 999, 999, false, false, false ]; + expected = [ 999, 999, false, false, true ]; + + gcusome( 3, 2, toAccessorArray( x ), 1, 0, toAccessorArray( out ), 1, 2 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports complex access patterns', function test( t ) { + var expected; + var out; + var x; + + x = [ 0, 1, 0, 1, 0, 1 ]; + out = [ false, false, false, false, false, false ]; + expected = [ false, true, false, true, false, false ]; + + gcusome( 3, 2, x, 2, 1, out, -2, 5 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports complex access patterns (accessors)', function test( t ) { + var expected; + var out; + var x; + + x = [ 0, 1, 0, 1, 0, 1 ]; + out = [ false, false, false, false, false, false ]; + expected = [ false, true, false, true, false, false ]; + + gcusome( 3, 2, toAccessorArray( x ), 2, 1, toAccessorArray( out ), -2, 5 ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +});