From 155335a06472575771237177ce01913459b7a544 Mon Sep 17 00:00:00 2001 From: Neerajpathak07 Date: Tue, 26 Nov 2024 20:31:09 +0530 Subject: [PATCH 01/14] feat: add implementation for array/base/broadcasted-quinary4d --- .../base/broadcasted-quinary4d/README.md | 159 +++++ .../benchmark/benchmark.js | 153 +++++ .../base/broadcasted-quinary4d/docs/repl.txt | 33 ++ .../docs/types/index.d.ts | 127 ++++ .../broadcasted-quinary4d/docs/types/test.ts | 125 ++++ .../broadcasted-quinary4d/examples/index.js | 58 ++ .../base/broadcasted-quinary4d/lib/index.js | 62 ++ .../base/broadcasted-quinary4d/lib/main.js | 264 +++++++++ .../base/broadcasted-quinary4d/package.json | 68 +++ .../base/broadcasted-quinary4d/test/test.js | 556 ++++++++++++++++++ 10 files changed, 1605 insertions(+) create mode 100644 lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/README.md create mode 100644 lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/examples/index.js create mode 100644 lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/index.js create mode 100644 lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/main.js create mode 100644 lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/package.json create mode 100644 lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/test/test.js diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/README.md b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/README.md new file mode 100644 index 000000000000..43b8fe630fc5 --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/README.md @@ -0,0 +1,159 @@ + + +# bquinary4d + +> Apply a quinary callback to elements in four [broadcasted][@stdlib/array/base/broadcast-array] nested input arrays and assign results to elements in a four-dimensional nested output array. + +
+ +
+ + + +
+ +## Usage + +```javascript +var bquinary4d = require( '@stdlib/array/base/broadcasted-quinary4d' ); +``` + +#### bquinary4d( arrays, shapes, fcn ) + +Applies a quinary callback to elements in four [broadcasted][@stdlib/array/base/broadcast-array] nested input arrays and assigns results to elements in a four-dimensional nested output array. + +```javascript +var zeros4d = require( '@stdlib/array/base/zeros4d' ); + +function add( x, y, z, w, v ) { + return x + y + z + w + v; +} + +var x = [ [ [ [ 1.0, 2.0 ] ] ] ]; +var y = [ [ [ [ 3.0 ], [ 4.0 ] ] ] ]; +var z = [ [ [ [ 5.0 ] ] ] ]; +var w = [ [ [ [ 2.0 ] ] ] ]; +var v = [ [ [ [ 1.0 ] ] ] ]; +var out = zeros4d( [ 2, 2 ] ); + +var shapes = [ + [ 1, 1, 1, 2 ], + [ 1, 1, 2, 1 ], + [ 1, 1, 2, 2 ], + [ 1, 2, 1, 1 ], + [ 2, 2, 2, 2 ], + [ 2, 2, 2, 2 ] +]; + +bquinary4d( [ x, y, z, w, v, out ], shapes, add ); +// out => [ [ [ [ 12.0, 13.0 ], [ 13.0, 14.0 ] ] ] ] +``` + +The function accepts the following arguments: + +- **arrays**: array-like object containing five input nested arrays and one output nested array. +- **shapes**: array shapes. +- **fcn**: quinary function to apply. + +
+ + + +
+ +## Notes + +- The input and output array shapes must be broadcast [compatible][@stdlib/ndarray/base/broadcast-shapes]. + +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var filled4dBy = require( '@stdlib/array/base/filled4d-by' ); +var zeros4d = require( '@stdlib/array/base/zeros4d' ); +var bquinary4d = require( '@stdlib/array/base/broadcasted-quinary4d' ); + +function add( x, y, z, w, v ) { + return x + y + z + w + v; +} + +var shapes = [ + [ 1, 3, 3, 3 ], + [ 3, 1, 1, 3 ], + [ 3, 3, 1, 3 ], + [ 3, 3, 3, 1 ], + [ 3, 3, 3, 3 ], + [ 3, 3, 3, 3 ] +]; + +var x = filled4dBy( shapes[ 0 ], discreteUniform( -100, 100 ) ); +console.log( x ); + +var y = filled4dBy( shapes[ 1 ], discreteUniform( -100, 100 ) ); +console.log( y ); + +var z = filled4dBy( shapes[ 2 ], discreteUniform( -100, 100 ) ); +console.log( z ); + +var w = filled4dBy( shapes[ 3 ], discreteUniform( -100, 100 ) ); +console.log( w ); + +var v = filled4dBy( shapes[ 4 ], discreteUniform( -100, 100 ) ); +console.log( v ); + +var out = zeros4d( shapes[ 5 ] ); +console.log( out ); + +bquinary4d( [ x, y, z, w, v, out ], shapes, add ); +console.log( out ); +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/benchmark/benchmark.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/benchmark/benchmark.js new file mode 100644 index 000000000000..2e26aadc0d04 --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/benchmark/benchmark.js @@ -0,0 +1,153 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 uniform = require( '@stdlib/random/base/uniform' ).factory; +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var filled4dBy = require( '@stdlib/array/base/filled4d-by' ); +var zeros4d = require( '@stdlib/array/base/zeros4d' ); +var numel = require( '@stdlib/ndarray/base/numel' ); +var pkg = require( './../package.json' ).name; +var bquinary4d = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Returns the sum. +* +* @private +* @param {number} x - first value +* @param {number} y - second value +* @param {number} z - third value +* @param {number} w - fourth value +* @param {number} v - fifth value +* @returns {number} sum +*/ +function add( x, y, z, w, v ) { + return x + y + z + w + v; +} + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveIntegerArray} shape - output array shape +* @returns {Function} benchmark function +*/ +function createBenchmark( shape ) { + var arrays; + var shapes; + var out; + var x; + var y; + var z; + var w; + var v; + + shapes = [ + [ 1, 1, 1, shape[ 0 ] ], + [ 1, 1, shape[ 1 ], 1 ], + [ 1, 1, shape[ 2 ], shape[ 3 ] ], + [ 1, shape[ 3 ], 1, 1 ], + [ shape[ 0 ], shape[ 1 ], shape[ 2 ], shape[ 3 ] ], + shape + ]; + x = filled4dBy( shapes[ 0 ], uniform( -100.0, 100.0 ) ); + y = filled4dBy( shapes[ 1 ], uniform( -100.0, 100.0 ) ); + z = filled4dBy( shapes[ 2 ], uniform( -100.0, 100.0 ) ); + w = filled4dBy( shapes[ 3 ], uniform( -100.0, 100.0 ) ); + v = filled4dBy( shapes[ 4 ], uniform( -100.0, 100.0 ) ); + out = zeros4d( shapes[ 5 ] ); + + arrays = [ x, y, z, w, v, out ]; + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i0; + var i1; + var i2; + var i3; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + bquinary4d( arrays, shapes, add ); + i3 = i % shapes[ 1 ][ 0 ]; + i2 = i % shapes[ 1 ][ 1 ]; + i1 = i % shapes[ 1 ][ 2 ]; + i0 = i % shapes[ 1 ][ 3 ]; + if ( isnan( arrays[ 5 ][ i0 ][ i1 ][ i2 ][ i3 ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + + i3 = i % shapes[ 1 ][ 0 ]; + i2 = i % shapes[ 1 ][ 1 ]; + i1 = i % shapes[ 1 ][ 2 ]; + i0 = i % shapes[ 1 ][ 3 ]; + if ( isnan( arrays[ 5 ][ i0 ][ i1 ][ i2 ][ i3 ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var sh; + var N; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); + sh = [ N, N, N, N ]; + f = createBenchmark( sh ); + bench( pkg+'::square_matrix:size='+numel( sh ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt new file mode 100644 index 000000000000..125fb395561f --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt @@ -0,0 +1,33 @@ + +{{alias}}( arrays, shapes, fcn ) + Applies a quinary callback to elements in four broadcasted input arrays + and assigns results to elements in a four-dimensional nested output array. + + Parameters + ---------- + arrays: ArrayLikeObject + Array-like object containing five input nested arrays and one output + nested array. + + shapes: Array> + Array shapes. + + fcn: Function + Quinary callback. + + Examples + -------- + > function fcn( x, y, z, w, v ) { return x + y + z + w + v; }; + > var x = [ 1.0, 2.0 ]; + > var y = [ [ [ [ 3.0 ], [ 4.0 ] ] ] ]; + > var z = [ [ [ [ 1.0 ] ] ] ]; + > var w = [ 2.0 ]; + > var v = [ 1.0 ]; + > var out = [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ]; + > var shapes = [ [ [ [ 2 ], [ 2, 1 ], [ 1, 1 ], [ 1 ], [ 1 ], [ 2, 2 ] ] ] ]; + > {{alias}}( [ x, y, z, w, v, out ], shapes, fcn ); + > out + [ [ [ [ 8.0, 9.0 ], [ 9.0, 10.0 ] ] ] ] + + See Also + -------- diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/types/index.d.ts b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/types/index.d.ts new file mode 100644 index 000000000000..208913daf746 --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/types/index.d.ts @@ -0,0 +1,127 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2024 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 { Array1D, Array2D, Array3D, Array4D } from '@stdlib/types/array'; +import { Shape1D, Shape2D, Shape3D, Shape4D } from '@stdlib/types/ndarray'; + +/** +* Quinary callback. +* +* @param v1 - element from first input array +* @param v2 - element from second input array +* @param v3 - element from third input array +* @param v4 - element from fourth input array +* @param v5 - element from fifth input array +* @returns result +*/ +type Quinary = ( v1: T, v2: U, v3: V, v4: W, v5: X ) => Y; + +/** +* Input array. +*/ +type InputArray = Array1D | Array2D | Array3D | Array4D; + +/** +* Input array shape. +*/ +type InputArrayShape = Shape1D | Shape2D | Shape3D | Shape4D; + +/** +* Output array. +*/ +type OutputArray = Array4D; + +/** +* Output array shape. +*/ +type OutputArrayShape = Shape4D; + +/** +* Input and output arrays. +*/ +type InOutArrays = [ + InputArray, + InputArray, + InputArray, + InputArray, + InputArray, + OutputArray +]; + +/** +* Input and output array shapes. +*/ +type InOutShapes = [ + InputArrayShape, + InputArrayShape, + InputArrayShape, + InputArrayShape, + InputArrayShape, + OutputArrayShape +]; + +/** +* Applies a quinary callback to elements in four broadcasted input arrays and assigns results to elements in a four-dimensional nested output array. +* +* ## Notes +* +* - The input array shapes must be broadcast compatible with the output array shape. +* +* @param arrays - array containing five input nested arrays and one output nested array +* @param shapes - array shapes +* @param fcn - quinary callback +* +* @example +* var ones4d = require( '@stdlib/array/base/ones4d' ); +* var zeros4d = require( '@stdlib/array/base/zeros4d' ); +* +* function add( x, y, z, w, v ) { +* return x + y + z + w + v; +* } +* +* var shapes = [ +* [ 1, 1, 1, 2 ], +* [ 1, 1, 2, 1 ], +* [ 1, 1, 2, 2 ], +* [ 1, 2, 1, 1 ], +* [ 2, 2, 2, 2 ], +* [ 2, 2, 2, 2 ] +* ]; +* +* var x = ones4d( shapes[ 0 ] ); +* var y = ones4d( shapes[ 1 ] ); +* var z = ones4d( shapes[ 2 ] ); +* var w = ones4d( shapes[ 3 ] ); +* var v = ones4d( shapes[ 4 ] ); +* var out = zeros4d( shapes[ 5 ] ); +* +* bquinary4d( [ x, y, z, w, v, out ], shapes, add ); +* +* console.log( out ); +* // => [ [ [ [ 5.0, 5.0 ], [ 5.0, 5.0 ] ] ] ] +*/ +declare function bquinary4d( arrays: InOutArrays, shapes: InOutShapes, fcn: Quinary ): void; + + +// EXPORTS // + +export = bquinary4d; diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/types/test.ts b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/types/test.ts new file mode 100644 index 000000000000..93e235b1e6ef --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/types/test.ts @@ -0,0 +1,125 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2024 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 bquinary4d = require( './index' ); + +/** +* Quinary function. +* +* @param x - input value +* @param y - input value +* @param z - input value +* @param w - input value +* @param v - input value +* @returns result +*/ +function fcn( x: number, y: number, z: number, w: number, v: number ): number { + return x + y + z + w + v; +} + +/** +* List of input and output array shapes. +*/ +type InOutShapes = [ Array, Array, Array, Array, Array, Array ]; + + +// TESTS // + +// The function returns undefined... +{ + const x = [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ]; + const y = [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ]; + const z = [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ]; + const w = [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ]; + const v = [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ]; + const out = [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ]; + + const shapes: InOutShapes = [ [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ] ]; + + bquinary4d( [ x, y, z, w, v, out ], shapes, fcn ); // $ExpectType void + bquinary4d( [ x[ 0 ], y, z, w, v, out ], [ [ shapes[ 0 ][ 1 ][ 2 ][ 3 ] ], shapes[ 1 ], shapes[ 2 ], shapes [ 3 ], shapes[ 4 ], shapes[ 5 ] ] , fcn ); // $ExpectType void +} + +// The compiler throws an error if the function is provided a first argument which is not an array of nested arrays... +{ + const shapes: InOutShapes = [ [ 2, 2, 2, 2 ] , [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ] ]; + + bquinary4d( 'abc', shapes, fcn ); // $ExpectError + bquinary4d( 3.14, shapes, fcn ); // $ExpectError + bquinary4d( true, shapes, fcn ); // $ExpectError + bquinary4d( false, shapes, fcn ); // $ExpectError + bquinary4d( null, shapes, fcn ); // $ExpectError + bquinary4d( [ '1' ], shapes, fcn ); // $ExpectError + bquinary4d( {}, shapes, fcn ); // $ExpectError + bquinary4d( ( x: number ): number => x, shapes, fcn ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not an array of arrays... +{ + const x = [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ]; + const y = [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ]; + const z = [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ]; + const w = [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ]; + const v = [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ]; + const out = [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ]; + + bquinary4d( [ x, y, z, w, v, out ], 'abc', fcn ); // $ExpectError + bquinary4d( [ x, y, z, w, v, out ], 3.14, fcn ); // $ExpectError + bquinary4d( [ x, y, z, w, v, out ], true, fcn ); // $ExpectError + bquinary4d( [ x, y, z, w, v, out ], false, fcn ); // $ExpectError + bquinary4d( [ x, y, z, w, v, out ], null, fcn ); // $ExpectError + bquinary4d( [ x, y, z, w, v, out ], [ '1' ], fcn ); // $ExpectError + bquinary4d( [ x, y, z, w, v, out ], {}, fcn ); // $ExpectError + bquinary4d( [ x, y, z, w, v, out ], ( x: number ): number => x, fcn ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a valid callback... +{ + const x = [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ]; + const y = [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ]; + const z = [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ]; + const w = [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ]; + const v = [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ]; + const out = [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ]; + + const shapes: InOutShapes = [ [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], [ 2, 2, 2 ,2 ] ]; + + bquinary4d( [ x, y, z, w, v, out ], shapes, 'abc' ); // $ExpectError + bquinary4d( [ x, y, z, w, v, out ], shapes, 3.14 ); // $ExpectError + bquinary4d( [ x, y, z, w, v, out ], shapes, true ); // $ExpectError + bquinary4d( [ x, y, z, w, v, out ], shapes, false ); // $ExpectError + bquinary4d( [ x, y, z, w, v, out ], shapes, null ); // $ExpectError + bquinary4d( [ x, y, z, w, v, out ], shapes, [ '1' ] ); // $ExpectError + bquinary4d( [ x, y, z, w, v, out ], shapes, {} ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const x = [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ]; + const y = [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ]; + const z = [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ]; + const w = [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ]; + const v = [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ]; + const out = [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ]; + + const shapes: InOutShapes = [ [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], [ 2, 2, 2 ,2 ], [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ] ]; + + bquinary4d(); // $ExpectError + bquinary4d( [ x, y, z, w, v, out ] ); // $ExpectError + bquinary4d( [ x, y, z, w, v, out ], shapes, fcn, {} ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/examples/index.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/examples/index.js new file mode 100644 index 000000000000..7c947deb15a5 --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/examples/index.js @@ -0,0 +1,58 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var filled4dBy = require( '@stdlib/array/base/filled4d-by' ); +var zeros4d = require( '@stdlib/array/base/zeros4d' ); +var bquinary4d = require( './../lib' ); + +function add( x, y, z, w, v ) { + return x + y + z + w + v; +} + +var shapes = [ + [ 1, 1, 1, 3 ], + [ 1, 1, 3, 1 ], + [ 1, 1, 3, 3 ], + [ 1, 3, 1, 1 ], + [ 3, 3, 3, 3 ], + [ 3, 3, 3, 3 ] +]; + +var x = filled4dBy( shapes[ 0 ], discreteUniform( -100, 100 ) ); +console.log( x ); + +var y = filled4dBy( shapes[ 1 ], discreteUniform( -100, 100 ) ); +console.log( y ); + +var z = filled4dBy( shapes[ 2 ], discreteUniform( -100, 100 ) ); +console.log( z ); + +var w = filled4dBy( shapes[ 3 ], discreteUniform( -100, 100 ) ); +console.log( w ); + +var v = filled4dBy( shapes[ 4 ], discreteUniform( -100, 100 ) ); +console.log( v ); + +var out = zeros4d( shapes[ 5 ] ); +console.log( out ); + +bquinary4d( [ x, y, z, w, v, out ], shapes, add ); +console.log( out ); diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/index.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/index.js new file mode 100644 index 000000000000..979c0690bbbe --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/index.js @@ -0,0 +1,62 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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'; + +/** +* Apply a quinary callback to elements in four broadcasted input arrays and assign results to elements in a four-dimensional nested output array. +* +* @module @stdlib/array/base/broadcasted-quinary3d +* +* @example +* var ones4d = require( '@stdlib/array/base/ones4d' ); +* var zeros4d = require( '@stdlib/array/base/zeros4d' ); +* var bquinary4d = require( '@stdlib/array/base/broadcasted-quinary4d' ); +* +* function add( x, y, z, w, v ) { +* return x + y + z + w + v; +* } +* +* var shapes = [ +* [ 1, 1, 1, 2 ], +* [ 1, 1, 2, 1 ], +* [ 1, 1, 2, 2 ], +* [ 1, 2, 1, 1 ], +* [ 2, 2, 2, 2 ], +* [ 2, 2, 2, 2 ] +* ]; +* +* var x = ones4d( shapes[ 0 ] ); +* var y = ones4d( shapes[ 1 ] ); +* var z = ones4d( shapes[ 2 ] ); +* var w = ones4d( shapes[ 3 ] ); +* var v = ones4d( shapes[ 4 ] ); +* var out = zeros4d( shapes[ 5 ] ); +* +* bquinary4d( [ x, y, z, w, v, out ], shapes, add ); +* +* console.log( out ); +* // => [ [ [ [ 5.0, 5.0 ], [ 5.0, 5.0 ] ] ] ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/main.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/main.js new file mode 100644 index 000000000000..11db45cf10cd --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/main.js @@ -0,0 +1,264 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 broadcastArray = require( '@stdlib/array/base/broadcast-array' ); + + +// MAIN // + +/** +* Applies a quinary callback to elements in four broadcasted input arrays and assigns results to elements in a fou4-dimensional nested output array. +* +* @param {ArrayLikeObject>} arrays - array-like object containing five input nested arrays and one output nested array +* @param {ArrayLikeObject} shapes - array shapes +* @param {Callback} fcn - quinary callback +* @returns {void} +* +* @example +* var ones4d = require( '@stdlib/array/base/ones4d' ); +* var zeros4d = require( '@stdlib/array/base/zeros4d' ); +* +* function add( x, y, z, w, v ) { +* return x + y + z + w + v; +* } +* +* var shapes = [ +* [ 1, 1, 1, 2 ], +* [ 1, 1, 2, 1 ], +* [ 1, 1, 2, 2 ], +* [ 1, 2, 1, 1 ], +* [ 2, 2, 2, 2 ], +* [ 2, 2, 2, 2 ] +* ]; +* +* var x = ones4d( shapes[ 0 ] ); +* var y = ones4d( shapes[ 1 ] ); +* var z = ones4d( shapes[ 2 ] ); +* var w = ones4d( shapes[ 3 ] ); +* var v = ones4d( shapes[ 4 ] ); +* var out = zeros4d( shapes[ 5 ] ); +* +* bquinary4d( [ x, y, z, w, v, out ], shapes, add ); +* +* console.log( out ); +* // => [ [ [ [ 5.0, 5.0 ], [ 5.0, 5.0 ] ] ] ] +*/ +function bquinary4d( arrays, shapes, fcn ) { // eslint-disable-line max-statements + var dx0; + var dx1; + var dx2; + var dx3; + var dy0; + var dy1; + var dy2; + var dy3; + var dz0; + var dz1; + var dz2; + var dz3; + var dw0; + var dw1; + var dw2; + var dw3; + var du0; + var du1; + var du2; + var du3; + var S0; + var S1; + var S2; + var S3; + var i0; + var i1; + var i2; + var i3; + var j0; + var j1; + var j2; + var j3; + var k0; + var k1; + var k2; + var k3; + var m0; + var m1; + var m2; + var m3; + var n0; + var n1; + var n2; + var n3; + var p0; + var p1; + var p2; + var p3; + var x0; + var x1; + var x2; + var y0; + var y1; + var y2; + var z0; + var z1; + var z2; + var w0; + var w1; + var w2; + var u0; + var u1; + var u2; + var v0; + var v1; + var v2; + var sh; + var st; + var o; + var x; + var y; + var z; + var w; + var u; + var v; + + sh = shapes[ 5 ]; + S0 = sh[ 3 ]; + S1 = sh[ 2 ]; + S2 = sh[ 1 ]; + S3 = sh[ 0 ]; + if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 ) { + return; + } + o = broadcastArray( arrays[ 0 ], shapes[ 0 ], sh ); + x = o.data; + st = o.strides; + dx0 = st[ 3 ]; + dx1 = st[ 2 ]; + dx2 = st[ 1 ]; + dx3 = st[ 0 ]; + + o = broadcastArray( arrays[ 1 ], shapes[ 1 ], sh ); + y = o.data; + st = o.strides; + dy0 = st[ 3 ]; + dy1 = st[ 2 ]; + dy2 = st[ 1 ]; + dy3 = st[ 0 ]; + + o = broadcastArray( arrays[ 2 ], shapes[ 2 ], sh ); + z = o.data; + st = o.strides; + dz0 = st[ 3 ]; + dz1 = st[ 2 ]; + dz2 = st[ 1 ]; + dz3 = st[ 0 ]; + + o = broadcastArray( arrays[ 3 ], shapes[ 3 ], sh ); + w = o.data; + st = o.strides; + dw0 = st[ 3 ]; + dw1 = st[ 2 ]; + dw2 = st[ 1 ]; + dw3 = st[ 0 ]; + + o = broadcastArray( arrays[ 4 ], shapes[ 4 ], sh ); + u = o.data; + st = o.strides; + du0 = st[ 3 ]; + du1 = st[ 2 ]; + du2 = st[ 1 ]; + du3 = st[ 0 ]; + + v = arrays[ 5 ]; + + j3 = 0; + k3 = 0; + m3 = 0; + n3 = 0; + p3 = 0; + for ( i3 = 0; i3 < S3; i3++ ) { + j2 = 0; + k2 = 0; + m2 = 0; + n2 = 0; + p2 = 0; + x2 = x[ j3 ]; + y2 = y[ k3 ]; + z2 = z[ m3 ]; + w2 = w[ n3 ]; + u2 = u[ p3 ]; + v2 = v[ i3 ]; + for ( i2 = 0; i2 < S2; i2++ ) { + j1 = 0; + k1 = 0; + m1 = 0; + n1 = 0; + p1 = 0; + x1 = x2[ j2 ]; + y1 = y2[ k2 ]; + z1 = z2[ m2 ]; + w1 = w2[ n2 ]; + u1 = u2[ p2 ]; + v1 = v2[ i2 ]; + for ( i1 = 0; i1 < S1; i1++ ) { + j0 = 0; + k0 = 0; + m0 = 0; + n0 = 0; + p0 = 0; + x0 = x1[ j1 ]; + y0 = y1[ k1 ]; + z0 = z1[ m1 ]; + w0 = w1[ n1 ]; + u0 = u1[ p1 ]; + v0 = v1[ i1 ]; + for ( i0 = 0; i0 < S0; i0++ ) { + v0[ i0 ] = fcn( x0[ j0 ], y0[ k0 ], z0[ m0 ], w0[ n0 ], u0[ p0 ] ); // eslint-disable-line max-len + j0 += dx0; + k0 += dy0; + m0 += dz0; + n0 += dw0; + p0 += du0; + } + j1 += dx1; + k1 += dy1; + m1 += dz1; + n1 += dw1; + p1 += du1; + } + j2 += dx2; + k2 += dy2; + m2 += dz2; + n2 += dw2; + p2 += du2; + } + j3 += dx3; + k3 += dy3; + m3 += dz3; + n3 += dw3; + p3 += du3; + } +} + + +// EXPORTS // + +module.exports = bquinary4d; diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/package.json b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/package.json new file mode 100644 index 000000000000..a56ef32e9d23 --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/package.json @@ -0,0 +1,68 @@ +{ + "name": "@stdlib/array/base/broadcasted-quinary4d", + "version": "0.0.0", + "description": "Apply a quinary callback to elements in five broadcasted input arrays and assign results to elements in a four-dimensional nested output array.", + "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", + "array", + "multidimensional", + "ndarray", + "matrix", + "4d", + "quinary", + "apply", + "foreach", + "map", + "transform", + "broadcast" + ], + "__stdlib__": {} + } + \ No newline at end of file diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/test/test.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/test/test.js new file mode 100644 index 000000000000..3587a4beb0c9 --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/test/test.js @@ -0,0 +1,556 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 zeros4d = require( '@stdlib/array/base/zeros4d' ); +var bquinary4d = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Returns the sum. +* +* @private +* @param {number} x - first value +* @param {number} y - second value +* @param {number} z - third value +* @param {number} w - fourth value +* @param {number} v - fifth value +* @returns {number} sum +*/ +function add( x, y, z, w, v ) { + return x + y + z + w + v; +} + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof bquinary4d, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function applies a provided callback to broadcasted input arrays and assigns results to a nested output array', function test( t ) { + var expected; + var shapes; + var out; + var x; + var y; + var z; + var w; + var u; + + shapes = [ + [ 1, 1, 1, 2 ], + [ 1, 1, 2, 1 ], + [ 1, 1, 2, 2 ], + [ 1, 2, 1, 1 ], + [ 2, 2, 2, 2 ], + [ 2, 2, 2, 2 ] + ]; + x = [ + [ + [ + [ 1.0, 2.0 ] + ] + ] + ]; + y = [ + [ + [ + [ 3.0 ], + [ 4.0 ] + ] + ] + ]; + z = [ + [ + [ + [ 5.0, 6.0 ], + [ 7.0, 8.0 ] + ] + ] + ]; + w = [ + [ + [ [ 9.0 ] ], + [ [ 10.0 ] ] + ] + ]; + u = [ + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] + ]; + out = zeros4d( shapes[ 5 ] ); + + expected = [ + [ + [ + [ 19, 22 ], + [ 24, 27 ] + ], + [ + [ 20, 23 ], + [ 25, 28 ] + ] + ], + [ + [ + [ 19, 22 ], + [ 24, 27 ] + ], + [ + [ 20, 23 ], + [ 25, 28 ] + ] + ] + ]; + bquinary4d( [ x, y, z, w, u, out ], shapes, add ); + t.deepEqual( out, expected, 'returns expected value' ); + + shapes = [ + [ 2, 2, 2, 2 ], + [ 2, 2, 2, 2 ], + [ 2, 2, 2, 2 ], + [ 2, 2, 2, 2 ], + [ 2, 2, 2, 2 ], + [ 2, 2, 2 ,2 ] + ]; + x = [ + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] + ]; + y = [ + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] + ]; + z = [ + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] + ]; + w = [ + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] + ]; + u = [ + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] + ]; + out = zeros4d( shapes[ 5 ] ); + + expected = [ + [ + [ + [ 5.0, 10.0 ], + [ 15.0, 20.0 ] + ], + [ + [ 5.0, 10.0 ], + [ 15.0, 20.0 ] + ] + ], + [ + [ + [ 5.0, 10.0 ], + [ 15.0, 20.0 ] + ], + [ + [ 5.0, 10.0 ], + [ 15.0, 20.0 ] + ] + ] + ]; + bquinary4d( [ x, y, z, w, u, out ], shapes, add ); + t.deepEqual( out, expected, 'returns expected value' ); + + // Same shapes: + shapes = [ + [ 2, 2, 2, 2 ], + [ 2, 2, 2, 2 ], + [ 2, 2, 2, 2 ], + [ 2, 2, 2, 2 ], + [ 2, 2, 2, 2 ], + [ 2, 2, 2 ,2 ] + ]; + x = [ + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] + ]; + y = [ + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] + ]; + z = [ + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] + ]; + w = [ + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] + ]; + u = [ + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] + ]; + out = zeros4d( shapes[ 5 ] ); + + expected = [ + [ + [ + [ 5.0, 10.0 ], + [ 15.0, 20.0 ] + ], + [ + [ 5.0, 10.0 ], + [ 15.0, 20.0 ] + ] + ], + [ + [ + [ 5.0, 10.0 ], + [ 15.0, 20.0 ] + ], + [ + [ 5.0, 10.0 ], + [ 15.0, 20.0 ] + ] + ] + ]; + bquinary4d( [ x, y, z, w, u, out ], shapes, add ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function does not invoke a provided callback if provided an output shape having a first element equal to zero', function test( t ) { + var expected; + var shapes; + var out; + var x; + var y; + var z; + var w; + var u; + + shapes = [ + [ 2, 2, 2, 2 ], + [ 2, 2, 2, 2 ], + [ 2, 2, 2, 2 ], + [ 2, 2, 2, 2 ], + [ 2, 2, 2, 2 ], + [ 0, 2, 2 ,2 ] + ]; + x = [ + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] + ]; + y = x; + z = x; + w = x; + u = x; + out = zeros4d( [ 2, 2, 2, 2 ] ); + + expected = zeros4d( [ 2, 2, 2, 2 ] ); + bquinary4d( [ x, y, z, w, u, out ], shapes, clbk ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); + + function clbk() { + t.ok( false, 'should not invoke callback' ); + } +}); + +tape( 'the function does not invoke a provided callback if provided an output shape having a second element equal to zero', function test( t ) { + var expected; + var shapes; + var out; + var x; + var y; + var z; + var w; + var u; + + shapes = [ + [ 2, 2, 2 ], + [ 2, 2, 2 ], + [ 2, 2, 2 ], + [ 2, 2, 2 ], + [ 2, 2, 2 ], + [ 2, 0, 2 ] + ]; + x = [ + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] + ]; + y = x; + z = x; + w = x; + u = x; + out = zeros4d( [ 2, 2, 2, 2 ] ); + + expected = zeros4d( [ 2, 2, 2, 2 ] ); + bquinary4d( [ x, y, z, w, u, out ], shapes, clbk ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); + + function clbk() { + t.ok( false, 'should not invoke callback' ); + } +}); From 3e1318ee53d7a746c03c5dcee0f2ba3624c7b074 Mon Sep 17 00:00:00 2001 From: Neerajpathak07 Date: Tue, 26 Nov 2024 20:34:24 +0530 Subject: [PATCH 02/14] fix: changing shape --- .../@stdlib/array/base/broadcasted-quinary4d/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/README.md b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/README.md index 43b8fe630fc5..ce2aeb1c881d 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/README.md +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/README.md @@ -104,10 +104,10 @@ function add( x, y, z, w, v ) { } var shapes = [ - [ 1, 3, 3, 3 ], - [ 3, 1, 1, 3 ], - [ 3, 3, 1, 3 ], - [ 3, 3, 3, 1 ], + [ 1, 1, 1, 3 ], + [ 1, 1, 3, 1 ], + [ 1, 1, 3, 3 ], + [ 1, 3, 1, 1 ], [ 3, 3, 3, 3 ], [ 3, 3, 3, 3 ] ]; From b3f8aef03976cf2f955bae5c7f3916e553c370cf Mon Sep 17 00:00:00 2001 From: Neerajpathak07 Date: Tue, 26 Nov 2024 20:40:17 +0530 Subject: [PATCH 03/14] fix: examples --- .../@stdlib/array/base/broadcasted-quinary4d/lib/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/index.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/index.js index 979c0690bbbe..a0c9a34199c7 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/index.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/index.js @@ -60,3 +60,5 @@ var main = require( './main.js' ); // EXPORTS // + +module.exports = main; From c88ebcbd2e60268e285559f719dc1e6b893ba041 Mon Sep 17 00:00:00 2001 From: Neerajpathak07 Date: Tue, 26 Nov 2024 20:53:31 +0530 Subject: [PATCH 04/14] fix: lib --- .../@stdlib/array/base/broadcasted-quinary4d/lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/index.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/index.js index a0c9a34199c7..79028d617840 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/index.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/index.js @@ -21,7 +21,7 @@ /** * Apply a quinary callback to elements in four broadcasted input arrays and assign results to elements in a four-dimensional nested output array. * -* @module @stdlib/array/base/broadcasted-quinary3d +* @module @stdlib/array/base/broadcasted-quinary4d * * @example * var ones4d = require( '@stdlib/array/base/ones4d' ); From 125a91dfad3f9821298992cd9ecb0bd3c5e0b948 Mon Sep 17 00:00:00 2001 From: Neerajpathak07 Date: Sun, 1 Dec 2024 16:18:13 +0530 Subject: [PATCH 05/14] fix: lib lint errors --- .../base/broadcasted-quinary4d/lib/main.js | 250 +++++++++--------- 1 file changed, 125 insertions(+), 125 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/main.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/main.js index 11db45cf10cd..1dae97475dca 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/main.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/main.js @@ -64,72 +64,72 @@ var broadcastArray = require( '@stdlib/array/base/broadcast-array' ); */ function bquinary4d( arrays, shapes, fcn ) { // eslint-disable-line max-statements var dx0; - var dx1; + var dx1; var dx2; - var dx3; - var dy0; + var dx3; + var dy0; var dy1; var dy2; - var dy3; - var dz0; + var dy3; + var dz0; var dz1; var dz2; - var dz3; - var dw0; + var dz3; + var dw0; var dw1; var dw2; - var dw3; - var du0; + var dw3; + var du0; var du1; var du2; - var du3; - var S0; + var du3; + var S0; var S1; var S2; - var S3; - var i0; + var S3; + var i0; var i1; var i2; - var i3; - var j0; + var i3; + var j0; var j1; var j2; - var j3; - var k0; + var j3; + var k0; var k1; var k2; - var k3; - var m0; + var k3; + var m0; var m1; var m2; - var m3; - var n0; + var m3; + var n0; var n1; var n2; - var n3; - var p0; + var n3; + var p0; var p1; var p2; - var p3; - var x0; + var p3; + var x0; var x1; - var x2; - var y0; + var x2; + var y0; var y1; - var y2; - var z0; + var y2; + var z0; var z1; - var z2; - var w0; + var z2; + var w0; var w1; - var w2; - var u0; + var w2; + var u0; var u1; - var u2; - var v0; + var u2; + var v0; var v1; - var v2; - var sh; + var v2; + var sh; var st; var o; var x; @@ -143,8 +143,8 @@ function bquinary4d( arrays, shapes, fcn ) { // eslint-disable-line max-statemen S0 = sh[ 3 ]; S1 = sh[ 2 ]; S2 = sh[ 1 ]; - S3 = sh[ 0 ]; - if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 ) { + S3 = sh[ 0 ]; + if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 ) { return; } o = broadcastArray( arrays[ 0 ], shapes[ 0 ], sh ); @@ -152,110 +152,110 @@ function bquinary4d( arrays, shapes, fcn ) { // eslint-disable-line max-statemen st = o.strides; dx0 = st[ 3 ]; dx1 = st[ 2 ]; - dx2 = st[ 1 ]; - dx3 = st[ 0 ]; - + dx2 = st[ 1 ]; + dx3 = st[ 0 ]; + o = broadcastArray( arrays[ 1 ], shapes[ 1 ], sh ); y = o.data; st = o.strides; dy0 = st[ 3 ]; dy1 = st[ 2 ]; - dy2 = st[ 1 ]; - dy3 = st[ 0 ]; - - o = broadcastArray( arrays[ 2 ], shapes[ 2 ], sh ); + dy2 = st[ 1 ]; + dy3 = st[ 0 ]; + + o = broadcastArray( arrays[ 2 ], shapes[ 2 ], sh ); z = o.data; st = o.strides; dz0 = st[ 3 ]; dz1 = st[ 2 ]; - dz2 = st[ 1 ]; - dz3 = st[ 0 ]; - - o = broadcastArray( arrays[ 3 ], shapes[ 3 ], sh ); + dz2 = st[ 1 ]; + dz3 = st[ 0 ]; + + o = broadcastArray( arrays[ 3 ], shapes[ 3 ], sh ); w = o.data; st = o.strides; dw0 = st[ 3 ]; dw1 = st[ 2 ]; - dw2 = st[ 1 ]; - dw3 = st[ 0 ]; - - o = broadcastArray( arrays[ 4 ], shapes[ 4 ], sh ); + dw2 = st[ 1 ]; + dw3 = st[ 0 ]; + + o = broadcastArray( arrays[ 4 ], shapes[ 4 ], sh ); u = o.data; st = o.strides; du0 = st[ 3 ]; du1 = st[ 2 ]; - du2 = st[ 1 ]; - du3 = st[ 0 ]; - - v = arrays[ 5 ]; + du2 = st[ 1 ]; + du3 = st[ 0 ]; + + v = arrays[ 5 ]; - j3 = 0; - k3 = 0; - m3 = 0; - n3 = 0; - p3 = 0; - for ( i3 = 0; i3 < S3; i3++ ) { - j2 = 0; - k2 = 0; - m2 = 0; - n2 = 0; - p2 = 0; - x2 = x[ j3 ]; - y2 = y[ k3 ]; - z2 = z[ m3 ]; - w2 = w[ n3 ]; - u2 = u[ p3 ]; - v2 = v[ i3 ]; - for ( i2 = 0; i2 < S2; i2++ ) { - j1 = 0; - k1 = 0; - m1 = 0; - n1 = 0; - p1 = 0; - x1 = x2[ j2 ]; - y1 = y2[ k2 ]; - z1 = z2[ m2 ]; - w1 = w2[ n2 ]; - u1 = u2[ p2 ]; - v1 = v2[ i2 ]; - for ( i1 = 0; i1 < S1; i1++ ) { - j0 = 0; - k0 = 0; - m0 = 0; - n0 = 0; - p0 = 0; - x0 = x1[ j1 ]; - y0 = y1[ k1 ]; - z0 = z1[ m1 ]; - w0 = w1[ n1 ]; - u0 = u1[ p1 ]; - v0 = v1[ i1 ]; - for ( i0 = 0; i0 < S0; i0++ ) { - v0[ i0 ] = fcn( x0[ j0 ], y0[ k0 ], z0[ m0 ], w0[ n0 ], u0[ p0 ] ); // eslint-disable-line max-len - j0 += dx0; - k0 += dy0; - m0 += dz0; - n0 += dw0; - p0 += du0; - } - j1 += dx1; - k1 += dy1; - m1 += dz1; - n1 += dw1; - p1 += du1; - } - j2 += dx2; - k2 += dy2; - m2 += dz2; - n2 += dw2; - p2 += du2; - } - j3 += dx3; - k3 += dy3; - m3 += dz3; - n3 += dw3; - p3 += du3; - } + j3 = 0; + k3 = 0; + m3 = 0; + n3 = 0; + p3 = 0; + for ( i3 = 0; i3 < S3; i3++ ) { + j2 = 0; + k2 = 0; + m2 = 0; + n2 = 0; + p2 = 0; + x2 = x[ j3 ]; + y2 = y[ k3 ]; + z2 = z[ m3 ]; + w2 = w[ n3 ]; + u2 = u[ p3 ]; + v2 = v[ i3 ]; + for ( i2 = 0; i2 < S2; i2++ ) { + j1 = 0; + k1 = 0; + m1 = 0; + n1 = 0; + p1 = 0; + x1 = x2[ j2 ]; + y1 = y2[ k2 ]; + z1 = z2[ m2 ]; + w1 = w2[ n2 ]; + u1 = u2[ p2 ]; + v1 = v2[ i2 ]; + for ( i1 = 0; i1 < S1; i1++ ) { + j0 = 0; + k0 = 0; + m0 = 0; + n0 = 0; + p0 = 0; + x0 = x1[ j1 ]; + y0 = y1[ k1 ]; + z0 = z1[ m1 ]; + w0 = w1[ n1 ]; + u0 = u1[ p1 ]; + v0 = v1[ i1 ]; + for ( i0 = 0; i0 < S0; i0++ ) { + v0[ i0 ] = fcn( x0[ j0 ], y0[ k0 ], z0[ m0 ], w0[ n0 ], u0[ p0 ] ); // eslint-disable-line max-len + j0 += dx0; + k0 += dy0; + m0 += dz0; + n0 += dw0; + p0 += du0; + } + j1 += dx1; + k1 += dy1; + m1 += dz1; + n1 += dw1; + p1 += du1; + } + j2 += dx2; + k2 += dy2; + m2 += dz2; + n2 += dw2; + p2 += du2; + } + j3 += dx3; + k3 += dy3; + m3 += dz3; + n3 += dw3; + p3 += du3; + } } From e9042aa598231da02cdd91e347c3b5f9b6118e14 Mon Sep 17 00:00:00 2001 From: Neerajpathak07 Date: Sun, 1 Dec 2024 22:23:17 +0530 Subject: [PATCH 06/14] fix: test lint errors --- .../base/broadcasted-quinary4d/test/test.js | 630 +++++++++--------- 1 file changed, 315 insertions(+), 315 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/test/test.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/test/test.js index 3587a4beb0c9..d4521ca8f7e5 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/test/test.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/test/test.js @@ -62,17 +62,17 @@ tape( 'the function applies a provided callback to broadcasted input arrays and var u; shapes = [ - [ 1, 1, 1, 2 ], + [ 1, 1, 1, 2 ], [ 1, 1, 2, 1 ], [ 1, 1, 2, 2 ], [ 1, 2, 1, 1 ], - [ 2, 2, 2, 2 ], + [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ] ]; - x = [ + x = [ [ [ - [ 1.0, 2.0 ] + [ 1.0, 2.0 ] ] ] ]; @@ -84,7 +84,7 @@ tape( 'the function applies a provided callback to broadcasted input arrays and ] ] ]; - z = [ + z = [ [ [ [ 5.0, 6.0 ], @@ -92,7 +92,7 @@ tape( 'the function applies a provided callback to broadcasted input arrays and ] ] ]; - w = [ + w = [ [ [ [ 9.0 ] ], [ [ 10.0 ] ] @@ -100,193 +100,193 @@ tape( 'the function applies a provided callback to broadcasted input arrays and ]; u = [ [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ], - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] ]; out = zeros4d( shapes[ 5 ] ); expected = [ - [ - [ - [ 19, 22 ], - [ 24, 27 ] - ], - [ - [ 20, 23 ], - [ 25, 28 ] - ] - ], - [ - [ - [ 19, 22 ], - [ 24, 27 ] - ], - [ - [ 20, 23 ], - [ 25, 28 ] - ] - ] + [ + [ + [ 19, 22 ], + [ 24, 27 ] + ], + [ + [ 20, 23 ], + [ 25, 28 ] + ] + ], + [ + [ + [ 19, 22 ], + [ 24, 27 ] + ], + [ + [ 20, 23 ], + [ 25, 28 ] + ] + ] ]; bquinary4d( [ x, y, z, w, u, out ], shapes, add ); t.deepEqual( out, expected, 'returns expected value' ); - shapes = [ + shapes = [ [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], - [ 2, 2, 2 ,2 ] + [ 2, 2, 2, 2 ] ]; x = [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ], - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] ]; y = [ [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ], - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] ]; z = [ [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ], - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] ]; w = [ [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ], - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] ]; u = [ [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ], - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] ]; out = zeros4d( shapes[ 5 ] ); expected = [ [ - [ - [ 5.0, 10.0 ], - [ 15.0, 20.0 ] - ], - [ - [ 5.0, 10.0 ], - [ 15.0, 20.0 ] - ] + [ + [ 5.0, 10.0 ], + [ 15.0, 20.0 ] + ], + [ + [ 5.0, 10.0 ], + [ 15.0, 20.0 ] + ] ], [ - [ - [ 5.0, 10.0 ], - [ 15.0, 20.0 ] - ], - [ - [ 5.0, 10.0 ], - [ 15.0, 20.0 ] - ] + [ + [ 5.0, 10.0 ], + [ 15.0, 20.0 ] + ], + [ + [ 5.0, 10.0 ], + [ 15.0, 20.0 ] + ] ] ]; bquinary4d( [ x, y, z, w, u, out ], shapes, add ); @@ -299,141 +299,141 @@ tape( 'the function applies a provided callback to broadcasted input arrays and [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], - [ 2, 2, 2 ,2 ] + [ 2, 2, 2, 2 ] ]; x = [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ], - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] ]; y = [ [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ], - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] ]; z = [ [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ], - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] ]; w = [ [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ], - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] ]; u = [ [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ], - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] ]; out = zeros4d( shapes[ 5 ] ); expected = [ - [ - [ - [ 5.0, 10.0 ], - [ 15.0, 20.0 ] - ], - [ - [ 5.0, 10.0 ], - [ 15.0, 20.0 ] - ] - ], - [ - [ - [ 5.0, 10.0 ], - [ 15.0, 20.0 ] - ], - [ - [ 5.0, 10.0 ], - [ 15.0, 20.0 ] - ] - ] + [ + [ + [ 5.0, 10.0 ], + [ 15.0, 20.0 ] + ], + [ + [ 5.0, 10.0 ], + [ 15.0, 20.0 ] + ] + ], + [ + [ + [ 5.0, 10.0 ], + [ 15.0, 20.0 ] + ], + [ + [ 5.0, 10.0 ], + [ 15.0, 20.0 ] + ] + ] ]; bquinary4d( [ x, y, z, w, u, out ], shapes, add ); t.deepEqual( out, expected, 'returns expected value' ); @@ -457,29 +457,29 @@ tape( 'the function does not invoke a provided callback if provided an output sh [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], - [ 0, 2, 2 ,2 ] + [ 0, 2, 2, 2 ] ]; x = [ [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ], - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] ]; y = x; z = x; @@ -518,25 +518,25 @@ tape( 'the function does not invoke a provided callback if provided an output sh ]; x = [ [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ], - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ], + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] ]; y = x; z = x; From c0a893b3db0408fa0b19a89f5f4dac738f912822 Mon Sep 17 00:00:00 2001 From: Neerajpathak07 Date: Sun, 1 Dec 2024 23:19:05 +0530 Subject: [PATCH 07/14] fix: benchmark lint errors --- .../broadcasted-quinary4d/benchmark/benchmark.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/benchmark/benchmark.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/benchmark/benchmark.js index 2e26aadc0d04..56977147b73d 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/benchmark/benchmark.js @@ -94,15 +94,15 @@ function createBenchmark( shape ) { function benchmark( b ) { var i0; var i1; - var i2; - var i3; + var i2; + var i3; var i; b.tic(); for ( i = 0; i < b.iterations; i++ ) { bquinary4d( arrays, shapes, add ); - i3 = i % shapes[ 1 ][ 0 ]; - i2 = i % shapes[ 1 ][ 1 ]; + i3 = i % shapes[ 1 ][ 0 ]; + i2 = i % shapes[ 1 ][ 1 ]; i1 = i % shapes[ 1 ][ 2 ]; i0 = i % shapes[ 1 ][ 3 ]; if ( isnan( arrays[ 5 ][ i0 ][ i1 ][ i2 ][ i3 ] ) ) { @@ -111,10 +111,10 @@ function createBenchmark( shape ) { } b.toc(); - i3 = i % shapes[ 1 ][ 0 ]; - i2 = i % shapes[ 1 ][ 1 ]; - i1 = i % shapes[ 1 ][ 2 ]; - i0 = i % shapes[ 1 ][ 3 ]; + i3 = i % shapes[ 1 ][ 0 ]; + i2 = i % shapes[ 1 ][ 1 ]; + i1 = i % shapes[ 1 ][ 2 ]; + i0 = i % shapes[ 1 ][ 3 ]; if ( isnan( arrays[ 5 ][ i0 ][ i1 ][ i2 ][ i3 ] ) ) { b.fail( 'should not return NaN' ); } From ab60e8a386193f8ce37166c27595317ea6a4f905 Mon Sep 17 00:00:00 2001 From: Neerajpathak07 Date: Wed, 4 Dec 2024 20:10:08 +0530 Subject: [PATCH 08/14] fix: markdown error --- .../@stdlib/array/base/broadcasted-quinary4d/README.md | 2 +- .../@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/README.md b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/README.md index ce2aeb1c881d..23ce917ea056 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/README.md +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/README.md @@ -52,7 +52,7 @@ var y = [ [ [ [ 3.0 ], [ 4.0 ] ] ] ]; var z = [ [ [ [ 5.0 ] ] ] ]; var w = [ [ [ [ 2.0 ] ] ] ]; var v = [ [ [ [ 1.0 ] ] ] ]; -var out = zeros4d( [ 2, 2 ] ); +var out = zeros4d( [ 2, 2, 2, 2 ] ); var shapes = [ [ 1, 1, 1, 2 ], diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt index 125fb395561f..cd2e0e809fca 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt @@ -24,7 +24,7 @@ > var w = [ 2.0 ]; > var v = [ 1.0 ]; > var out = [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ]; - > var shapes = [ [ [ [ 2 ], [ 2, 1 ], [ 1, 1 ], [ 1 ], [ 1 ], [ 2, 2 ] ] ] ]; + > var shapes = [ [ 2 ], [ 2, 1 ], [ 1, 1 ], [ 1 ], [ 1 ], [ 2, 2 ] ]; > {{alias}}( [ x, y, z, w, v, out ], shapes, fcn ); > out [ [ [ [ 8.0, 9.0 ], [ 9.0, 10.0 ] ] ] ] From e59478e4c9a39899bbe9bd6daa21310ef6138931 Mon Sep 17 00:00:00 2001 From: Neerajpathak07 Date: Thu, 12 Dec 2024 23:34:26 +0530 Subject: [PATCH 09/14] fix: lint errors --- .../@stdlib/array/base/broadcasted-quinary4d/README.md | 6 +++--- .../@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/README.md b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/README.md index 23ce917ea056..682612372c57 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/README.md +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/README.md @@ -57,9 +57,9 @@ var out = zeros4d( [ 2, 2, 2, 2 ] ); var shapes = [ [ 1, 1, 1, 2 ], [ 1, 1, 2, 1 ], - [ 1, 1, 2, 2 ], - [ 1, 2, 1, 1 ], - [ 2, 2, 2, 2 ], + [ 1, 1, 1, 1 ], + [ 1, 1, 1, 1 ], + [ 1, 1, 1, 1 ], [ 2, 2, 2, 2 ] ]; diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt index cd2e0e809fca..7cfe345a7587 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt @@ -21,10 +21,10 @@ > var x = [ 1.0, 2.0 ]; > var y = [ [ [ [ 3.0 ], [ 4.0 ] ] ] ]; > var z = [ [ [ [ 1.0 ] ] ] ]; - > var w = [ 2.0 ]; - > var v = [ 1.0 ]; + > var w = [ [ [ [ 2.0 ] ] ] ]; + > var v = [ [ [ [ 1.0 ] ] ] ]; > var out = [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ]; - > var shapes = [ [ 2 ], [ 2, 1 ], [ 1, 1 ], [ 1 ], [ 1 ], [ 2, 2 ] ]; + > var shapes = [ [ 2 ], [ 2, 1 ], [ 1, 1, 1, 1 ], [ 1, 1, 1, 1 ], [ 1, 1, 1, 1 ], [ 2, 2, 2, 2 ] ]; > {{alias}}( [ x, y, z, w, v, out ], shapes, fcn ); > out [ [ [ [ 8.0, 9.0 ], [ 9.0, 10.0 ] ] ] ] From 6a193d78cbd0295c04ebad32ad7db9ac12dacf7d Mon Sep 17 00:00:00 2001 From: Neerajpathak07 Date: Thu, 12 Dec 2024 23:52:56 +0530 Subject: [PATCH 10/14] fix: package.json lint errors --- .../@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt | 7 ++++--- .../@stdlib/array/base/broadcasted-quinary4d/package.json | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt index 7cfe345a7587..c7a82fdf5651 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt @@ -21,13 +21,14 @@ > var x = [ 1.0, 2.0 ]; > var y = [ [ [ [ 3.0 ], [ 4.0 ] ] ] ]; > var z = [ [ [ [ 1.0 ] ] ] ]; - > var w = [ [ [ [ 2.0 ] ] ] ]; - > var v = [ [ [ [ 1.0 ] ] ] ]; + > var w = [ 2.0 ]; + > var v = [ 1.0 ]; > var out = [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ]; - > var shapes = [ [ 2 ], [ 2, 1 ], [ 1, 1, 1, 1 ], [ 1, 1, 1, 1 ], [ 1, 1, 1, 1 ], [ 2, 2, 2, 2 ] ]; + > var shapes = [ [ 2 ], [ 1, 1, 2, 1 ], [ 1, 1, 1, 1 ], [ 1 ], [ 1 ], [ 2, 2, 2, 2 ] ]; > {{alias}}( [ x, y, z, w, v, out ], shapes, fcn ); > out [ [ [ [ 8.0, 9.0 ], [ 9.0, 10.0 ] ] ] ] See Also -------- + diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/package.json b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/package.json index a56ef32e9d23..78eeb84fd1ee 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/package.json +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/package.json @@ -64,5 +64,4 @@ "broadcast" ], "__stdlib__": {} - } - \ No newline at end of file + } \ No newline at end of file From b07e62570b733161d34f3707a3bac36acca1a1ea Mon Sep 17 00:00:00 2001 From: Neerajpathak07 Date: Fri, 13 Dec 2024 00:13:48 +0530 Subject: [PATCH 11/14] fix: repl lint errors --- .../array/base/broadcasted-quinary4d/docs/repl.txt | 8 ++++---- .../@stdlib/array/base/broadcasted-quinary4d/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt index c7a82fdf5651..3f8a9157a30f 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt @@ -18,13 +18,13 @@ Examples -------- > function fcn( x, y, z, w, v ) { return x + y + z + w + v; }; - > var x = [ 1.0, 2.0 ]; + > var x = [ [ [ [ 1.0, 2.0 ] ] ] ]; > var y = [ [ [ [ 3.0 ], [ 4.0 ] ] ] ]; > var z = [ [ [ [ 1.0 ] ] ] ]; - > var w = [ 2.0 ]; - > var v = [ 1.0 ]; + > var w = [ [ [ [ 2.0 ] ] ] ]; + > var v = [ [ [ [ 1.0 ] ] ] ]; > var out = [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ]; - > var shapes = [ [ 2 ], [ 1, 1, 2, 1 ], [ 1, 1, 1, 1 ], [ 1 ], [ 1 ], [ 2, 2, 2, 2 ] ]; + > var shapes = [ [ 1, 1, 1, 2 ], [ 1, 1, 2, 1 ], [ 1, 1, 1, 1 ], [ 1, 1, 1, 1 ], [ 1, 1, 1, 1 ], [ 2, 2, 2, 2 ] ]; > {{alias}}( [ x, y, z, w, v, out ], shapes, fcn ); > out [ [ [ [ 8.0, 9.0 ], [ 9.0, 10.0 ] ] ] ] diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/package.json b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/package.json index 78eeb84fd1ee..b8dc830362d2 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/package.json +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/package.json @@ -64,4 +64,4 @@ "broadcast" ], "__stdlib__": {} - } \ No newline at end of file + } From fed120e01a4c95c0006266719b1e1bcc40ce9456 Mon Sep 17 00:00:00 2001 From: Neerajpathak07 Date: Fri, 13 Dec 2024 10:52:09 +0530 Subject: [PATCH 12/14] fix: CI errors --- .../base/broadcasted-quinary4d/docs/repl.txt | 3 +- .../base/broadcasted-quinary4d/package.json | 128 +++++++++--------- 2 files changed, 65 insertions(+), 66 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt index 3f8a9157a30f..61698e201223 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt @@ -24,11 +24,10 @@ > var w = [ [ [ [ 2.0 ] ] ] ]; > var v = [ [ [ [ 1.0 ] ] ] ]; > var out = [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ]; - > var shapes = [ [ 1, 1, 1, 2 ], [ 1, 1, 2, 1 ], [ 1, 1, 1, 1 ], [ 1, 1, 1, 1 ], [ 1, 1, 1, 1 ], [ 2, 2, 2, 2 ] ]; + > var shapes = [ [ 1, 1, 1, 2 ], [ 1, 1, 2, 1 ], [ 1, 1, 1, 1 ], [ 1, 1, 1, 1 ], [ 1, 1, 1, 1 ], [ 1, 1, 2, 2 ] ]; > {{alias}}( [ x, y, z, w, v, out ], shapes, fcn ); > out [ [ [ [ 8.0, 9.0 ], [ 9.0, 10.0 ] ] ] ] See Also -------- - diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/package.json b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/package.json index b8dc830362d2..b3a3f025e018 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/package.json +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/package.json @@ -1,67 +1,67 @@ { - "name": "@stdlib/array/base/broadcasted-quinary4d", - "version": "0.0.0", - "description": "Apply a quinary callback to elements in five broadcasted input arrays and assign results to elements in a four-dimensional nested output array.", - "license": "Apache-2.0", - "author": { + "name": "@stdlib/array/base/broadcasted-quinary4d", + "version": "0.0.0", + "description": "Apply a quinary callback to elements in five broadcasted input arrays and assign results to elements in a four-dimensional nested output array.", + "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" - }, - "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", - "array", - "multidimensional", - "ndarray", - "matrix", - "4d", - "quinary", - "apply", - "foreach", - "map", - "transform", - "broadcast" - ], - "__stdlib__": {} - } + } + ], + "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", + "array", + "multidimensional", + "ndarray", + "matrix", + "4d", + "quinary", + "apply", + "foreach", + "map", + "transform", + "broadcast" + ], + "__stdlib__": {} +} From 234b710cab251053e6bfc99db5b13955b10f9211 Mon Sep 17 00:00:00 2001 From: Neerajpathak07 Date: Fri, 13 Dec 2024 11:37:41 +0530 Subject: [PATCH 13/14] fix: CI errors --- .../array/base/broadcasted-quinary4d/docs/repl.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt index 61698e201223..7e01c3220270 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt @@ -18,16 +18,17 @@ Examples -------- > function fcn( x, y, z, w, v ) { return x + y + z + w + v; }; - > var x = [ [ [ [ 1.0, 2.0 ] ] ] ]; - > var y = [ [ [ [ 3.0 ], [ 4.0 ] ] ] ]; - > var z = [ [ [ [ 1.0 ] ] ] ]; - > var w = [ [ [ [ 2.0 ] ] ] ]; - > var v = [ [ [ [ 1.0 ] ] ] ]; + > var x = [ 1.0, 2.0 ]; + > var y = [ [ 3.0 ], [ 4.0 ] ]; + > var z = [ 1.0 ]; + > var w = [ 2.0 ]; + > var v = [ 1.0 ]; > var out = [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ]; - > var shapes = [ [ 1, 1, 1, 2 ], [ 1, 1, 2, 1 ], [ 1, 1, 1, 1 ], [ 1, 1, 1, 1 ], [ 1, 1, 1, 1 ], [ 1, 1, 2, 2 ] ]; + > var shapes = [ [ 2 ], [ 2, 1 ], [ 1 ], [ 1 ], [ 1 ], [ 1, 1, 2, 2 ] ]; > {{alias}}( [ x, y, z, w, v, out ], shapes, fcn ); > out [ [ [ [ 8.0, 9.0 ], [ 9.0, 10.0 ] ] ] ] See Also -------- + From f4bae86c421b715ac1e4571053f7a0855b955e7e Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Fri, 13 Dec 2024 01:13:23 -0800 Subject: [PATCH 14/14] chore: clean-up --- .../base/broadcasted-quinary4d/README.md | 6 +- .../benchmark/benchmark.js | 6 +- .../base/broadcasted-quinary4d/docs/repl.txt | 4 +- .../docs/types/index.d.ts | 4 +- .../base/broadcasted-quinary4d/lib/index.js | 4 +- .../base/broadcasted-quinary4d/lib/main.js | 6 +- .../base/broadcasted-quinary4d/test/test.js | 171 +++++++----------- 7 files changed, 85 insertions(+), 116 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/README.md b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/README.md index 682612372c57..ea79548b9f12 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/README.md +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/README.md @@ -20,7 +20,7 @@ limitations under the License. # bquinary4d -> Apply a quinary callback to elements in four [broadcasted][@stdlib/array/base/broadcast-array] nested input arrays and assign results to elements in a four-dimensional nested output array. +> Apply a quinary callback to elements in five [broadcasted][@stdlib/array/base/broadcast-array] input arrays and assign results to elements in a four-dimensional nested output array.
@@ -38,7 +38,7 @@ var bquinary4d = require( '@stdlib/array/base/broadcasted-quinary4d' ); #### bquinary4d( arrays, shapes, fcn ) -Applies a quinary callback to elements in four [broadcasted][@stdlib/array/base/broadcast-array] nested input arrays and assigns results to elements in a four-dimensional nested output array. +Applies a quinary callback to elements in five [broadcasted][@stdlib/array/base/broadcast-array] input arrays and assigns results to elements in a four-dimensional nested output array. ```javascript var zeros4d = require( '@stdlib/array/base/zeros4d' ); @@ -64,7 +64,7 @@ var shapes = [ ]; bquinary4d( [ x, y, z, w, v, out ], shapes, add ); -// out => [ [ [ [ 12.0, 13.0 ], [ 13.0, 14.0 ] ] ] ] +// out => [ [ [ [ 12.0, 13.0 ], [ 13.0, 14.0 ] ], [ [ 12.0, 13.0 ], [ 13.0, 14.0 ] ] ], [ [ [ 12.0, 13.0 ], [ 13.0, 14.0 ] ], [ [ 12.0, 13.0 ], [ 13.0, 14.0 ] ] ] ] ``` The function accepts the following arguments: diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/benchmark/benchmark.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/benchmark/benchmark.js index 56977147b73d..5ced21482c37 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/benchmark/benchmark.js @@ -105,7 +105,7 @@ function createBenchmark( shape ) { i2 = i % shapes[ 1 ][ 1 ]; i1 = i % shapes[ 1 ][ 2 ]; i0 = i % shapes[ 1 ][ 3 ]; - if ( isnan( arrays[ 5 ][ i0 ][ i1 ][ i2 ][ i3 ] ) ) { + if ( isnan( arrays[ 5 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { b.fail( 'should not return NaN' ); } } @@ -115,7 +115,7 @@ function createBenchmark( shape ) { i2 = i % shapes[ 1 ][ 1 ]; i1 = i % shapes[ 1 ][ 2 ]; i0 = i % shapes[ 1 ][ 3 ]; - if ( isnan( arrays[ 5 ][ i0 ][ i1 ][ i2 ][ i3 ] ) ) { + if ( isnan( arrays[ 5 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { b.fail( 'should not return NaN' ); } b.pass( 'benchmark finished' ); @@ -146,7 +146,7 @@ function main() { N = floor( pow( pow( 10, i ), 1.0/4.0 ) ); sh = [ N, N, N, N ]; f = createBenchmark( sh ); - bench( pkg+'::square_matrix:size='+numel( sh ), f ); + bench( pkg+'::equidimensional:size='+numel( sh ), f ); } } diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt index 7e01c3220270..29e1145c5e0c 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/repl.txt @@ -1,7 +1,7 @@ {{alias}}( arrays, shapes, fcn ) - Applies a quinary callback to elements in four broadcasted input arrays - and assigns results to elements in a four-dimensional nested output array. + Applies a quinary callback to elements in five broadcasted input arrays and + assigns results to elements in a four-dimensional nested output array. Parameters ---------- diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/types/index.d.ts b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/types/index.d.ts index 208913daf746..a6fe5246be5d 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/docs/types/index.d.ts @@ -80,7 +80,7 @@ type InOutShapes = [ ]; /** -* Applies a quinary callback to elements in four broadcasted input arrays and assigns results to elements in a four-dimensional nested output array. +* Applies a quinary callback to elements in five broadcasted input arrays and assigns results to elements in a four-dimensional nested output array. * * ## Notes * @@ -117,7 +117,7 @@ type InOutShapes = [ * bquinary4d( [ x, y, z, w, v, out ], shapes, add ); * * console.log( out ); -* // => [ [ [ [ 5.0, 5.0 ], [ 5.0, 5.0 ] ] ] ] +* // => [ [ [ [ 5.0, 5.0 ], [ 5.0, 5.0 ] ], [ [ 5.0, 5.0 ], [ 5.0, 5.0 ] ] ], [ [ [ 5.0, 5.0 ], [ 5.0, 5.0 ] ], [ [ 5.0, 5.0 ], [ 5.0, 5.0 ] ] ] ] */ declare function bquinary4d( arrays: InOutArrays, shapes: InOutShapes, fcn: Quinary ): void; diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/index.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/index.js index 79028d617840..0a2001b27884 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/index.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/index.js @@ -19,7 +19,7 @@ 'use strict'; /** -* Apply a quinary callback to elements in four broadcasted input arrays and assign results to elements in a four-dimensional nested output array. +* Apply a quinary callback to elements in five broadcasted input arrays and assign results to elements in a four-dimensional nested output array. * * @module @stdlib/array/base/broadcasted-quinary4d * @@ -51,7 +51,7 @@ * bquinary4d( [ x, y, z, w, v, out ], shapes, add ); * * console.log( out ); -* // => [ [ [ [ 5.0, 5.0 ], [ 5.0, 5.0 ] ] ] ] +* // => [ [ [ [ 5.0, 5.0 ], [ 5.0, 5.0 ] ], [ [ 5.0, 5.0 ], [ 5.0, 5.0 ] ] ], [ [ [ 5.0, 5.0 ], [ 5.0, 5.0 ] ], [ [ 5.0, 5.0 ], [ 5.0, 5.0 ] ] ] ] */ // MODULES // diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/main.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/main.js index 1dae97475dca..ef8bd48a1175 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/main.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/lib/main.js @@ -26,9 +26,9 @@ var broadcastArray = require( '@stdlib/array/base/broadcast-array' ); // MAIN // /** -* Applies a quinary callback to elements in four broadcasted input arrays and assigns results to elements in a fou4-dimensional nested output array. +* Applies a quinary callback to elements in five broadcasted input arrays and assigns results to elements in a four-dimensional nested output array. * -* @param {ArrayLikeObject>} arrays - array-like object containing five input nested arrays and one output nested array +* @param {ArrayLikeObject} arrays - array-like object containing five input nested arrays and one output nested array * @param {ArrayLikeObject} shapes - array shapes * @param {Callback} fcn - quinary callback * @returns {void} @@ -60,7 +60,7 @@ var broadcastArray = require( '@stdlib/array/base/broadcast-array' ); * bquinary4d( [ x, y, z, w, v, out ], shapes, add ); * * console.log( out ); -* // => [ [ [ [ 5.0, 5.0 ], [ 5.0, 5.0 ] ] ] ] +* // => [ [ [ [ 5.0, 5.0 ], [ 5.0, 5.0 ] ], [ [ 5.0, 5.0 ], [ 5.0, 5.0 ] ] ], [ [ [ 5.0, 5.0 ], [ 5.0, 5.0 ] ], [ [ 5.0, 5.0 ], [ 5.0, 5.0 ] ] ] ] */ function bquinary4d( arrays, shapes, fcn ) { // eslint-disable-line max-statements var dx0; diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/test/test.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/test/test.js index d4521ca8f7e5..11f4b65a13b8 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/test/test.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary4d/test/test.js @@ -147,6 +147,7 @@ tape( 'the function applies a provided callback to broadcasted input arrays and bquinary4d( [ x, y, z, w, u, out ], shapes, add ); t.deepEqual( out, expected, 'returns expected value' ); + // Same shapes: shapes = [ [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], @@ -292,14 +293,26 @@ tape( 'the function applies a provided callback to broadcasted input arrays and bquinary4d( [ x, y, z, w, u, out ], shapes, add ); t.deepEqual( out, expected, 'returns expected value' ); - // Same shapes: + t.end(); +}); + +tape( 'the function does not invoke a provided callback if provided an output shape having a first element equal to zero', function test( t ) { + var expected; + var shapes; + var out; + var x; + var y; + var z; + var w; + var u; + shapes = [ [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], - [ 2, 2, 2, 2 ] + [ 0, 2, 2, 2 ] ]; x = [ [ @@ -323,73 +336,42 @@ tape( 'the function applies a provided callback to broadcasted input arrays and ] ] ]; - y = [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ], - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ]; - z = [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ], - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ]; - w = [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ], - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ], - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] + y = x; + z = x; + w = x; + u = x; + out = zeros4d( [ 2, 2, 2, 2 ] ); + + expected = zeros4d( [ 2, 2, 2, 2 ] ); + bquinary4d( [ x, y, z, w, u, out ], shapes, clbk ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); + + function clbk() { + t.ok( false, 'should not invoke callback' ); + } +}); + +tape( 'the function does not invoke a provided callback if provided an output shape having a second element equal to zero', function test( t ) { + var expected; + var shapes; + var out; + var x; + var y; + var z; + var w; + var u; + + shapes = [ + [ 2, 2, 2, 2 ], + [ 2, 2, 2, 2 ], + [ 2, 2, 2, 2 ], + [ 2, 2, 2, 2 ], + [ 2, 2, 2, 2 ], + [ 2, 0, 2, 2 ] ]; - u = [ + x = [ [ [ [ 1.0, 2.0 ], @@ -411,37 +393,24 @@ tape( 'the function applies a provided callback to broadcasted input arrays and ] ] ]; - out = zeros4d( shapes[ 5 ] ); + y = x; + z = x; + w = x; + u = x; + out = zeros4d( [ 2, 2, 2, 2 ] ); - expected = [ - [ - [ - [ 5.0, 10.0 ], - [ 15.0, 20.0 ] - ], - [ - [ 5.0, 10.0 ], - [ 15.0, 20.0 ] - ] - ], - [ - [ - [ 5.0, 10.0 ], - [ 15.0, 20.0 ] - ], - [ - [ 5.0, 10.0 ], - [ 15.0, 20.0 ] - ] - ] - ]; - bquinary4d( [ x, y, z, w, u, out ], shapes, add ); + expected = zeros4d( [ 2, 2, 2, 2 ] ); + bquinary4d( [ x, y, z, w, u, out ], shapes, clbk ); t.deepEqual( out, expected, 'returns expected value' ); t.end(); + + function clbk() { + t.ok( false, 'should not invoke callback' ); + } }); -tape( 'the function does not invoke a provided callback if provided an output shape having a first element equal to zero', function test( t ) { +tape( 'the function does not invoke a provided callback if provided an output shape having a third element equal to zero', function test( t ) { var expected; var shapes; var out; @@ -457,7 +426,7 @@ tape( 'the function does not invoke a provided callback if provided an output sh [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ], - [ 0, 2, 2, 2 ] + [ 2, 2, 0, 2 ] ]; x = [ [ @@ -498,7 +467,7 @@ tape( 'the function does not invoke a provided callback if provided an output sh } }); -tape( 'the function does not invoke a provided callback if provided an output shape having a second element equal to zero', function test( t ) { +tape( 'the function does not invoke a provided callback if provided an output shape having a fourth element equal to zero', function test( t ) { var expected; var shapes; var out; @@ -509,12 +478,12 @@ tape( 'the function does not invoke a provided callback if provided an output sh var u; shapes = [ - [ 2, 2, 2 ], - [ 2, 2, 2 ], - [ 2, 2, 2 ], - [ 2, 2, 2 ], - [ 2, 2, 2 ], - [ 2, 0, 2 ] + [ 2, 2, 2, 2 ], + [ 2, 2, 2, 2 ], + [ 2, 2, 2, 2 ], + [ 2, 2, 2, 2 ], + [ 2, 2, 2, 2 ], + [ 2, 2, 2, 0 ] ]; x = [ [