From 0815ad7c2f5577de60a2d47dd8fb27df749adf8b Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Sun, 17 Nov 2024 20:08:07 +0600 Subject: [PATCH 01/29] docs: update list of contributors PR-URL: https://github.com/stdlib-js/stdlib/pull/3117 Reviewed-by: Philipp Burckhardt Signed-off-by: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> --- CONTRIBUTORS | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 2024aac10965..b2ba38784ac6 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -59,6 +59,7 @@ Mohammad Kaif <98884589+Kaif987@users.noreply.github.com> Momtchil Momtchev Muhammad Haris Naresh Jagadeesan +Neeraj Pathak NightKnight Nithin Katta <88046362+nithinkatta@users.noreply.github.com> Nourhan Hasan <109472010+TheNourhan@users.noreply.github.com> From defab92676e8ccaf23ab0e2057bc08f901a7dfb6 Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Sat, 23 Nov 2024 20:29:52 +0600 Subject: [PATCH 02/29] "added benchmark.js" --- .../benchmark/benchmark.js | 156 ++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/benchmark/benchmark.js diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/benchmark/benchmark.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/benchmark/benchmark.js new file mode 100644 index 000000000000..8581bf994ecb --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/benchmark/benchmark.js @@ -0,0 +1,156 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 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 filled5dBy = require( '@stdlib/array/base/filled2d-by' ); +var zeros5d = require( '@stdlib/array/base/zeros2d' ); +var numel = require( '@stdlib/ndarray/base/numel' ); +var pkg = require( './../package.json' ).name; +var bquinary5d = 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, shape[ 1 ], shape[ 2 ], shape[ 3 ], shape[ 4 ] ], + [ shape[ 0 ], 1, shape[ 2 ], shape[ 3 ], shape[ 4 ] ], + [ shape[ 0 ], shape[ 1 ], 1, shape[ 3 ], shape[ 4 ] ], + [ shape[ 0 ], shape[ 1 ], shape[ 2 ], 1, shape[ 4 ] ], + [ shape[ 0 ], shape[ 1 ], shape[ 2 ], shape[ 3 ], 1 ], + shape + ]; + x = filled5dBy( shapes[ 0 ], uniform( -100.0, 100.0 ) ); + y = filled5dBy( shapes[ 1 ], uniform( -100.0, 100.0 ) ); + z = filled5dBy( shapes[ 2 ], uniform( -100.0, 100.0 ) ); + w = filled5dBy( shapes[ 3 ], uniform( -100.0, 100.0 ) ); + v = filled5dBy( shapes[ 4 ], uniform( -100.0, 100.0 ) ); + out = zeros5d( 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 i4; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + bquinary5d( arrays, shapes, add ); + i4 = i % shapes[ 5 ][ 4 ]; + i3 = i % shapes[ 5 ][ 3 ]; + i2 = i % shapes[ 5 ][ 2 ]; + i1 = i % shapes[ 5 ][ 1 ]; + i0 = i % shapes[ 5 ][ 0 ]; + if ( isnan( arrays[ 5 ][ i0 ][ i1 ][ i2 ][ i3 ][ i4 ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + + i4 = i % shapes[ 5 ][ 4 ]; + i3 = i % shapes[ 5 ][ 3 ]; + i2 = i % shapes[ 5 ][ 2 ]; + i1 = i % shapes[ 5 ][ 1 ]; + i0 = i % shapes[ 5 ][ 0 ]; + if ( isnan( arrays[ 5 ][ i0 ][ i1 ][ i2 ][ i3 ][ i4 ] ) ) { + 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/5.0 ) ); + sh = [ N, N, N, N, N ]; + f = createBenchmark( sh ); + bench( pkg+'::five_dimentional_array:size='+numel( sh ), f ); + } +} + +main(); From 776f4e48a39bc38d6e3eb461c55cbe05de44b32a Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Sat, 23 Nov 2024 20:44:35 +0600 Subject: [PATCH 03/29] "added index.js" --- .../benchmark/benchmark.js | 2 +- .../base/broadcasted-quinary5D/lib/index.js | 64 +++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/index.js diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/benchmark/benchmark.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/benchmark/benchmark.js index 8581bf994ecb..9800de86032c 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/benchmark/benchmark.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2023 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/index.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/index.js new file mode 100644 index 000000000000..bfd073b7629c --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/index.js @@ -0,0 +1,64 @@ +/** +* @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 five broadcasted input arrays and assign results to elements in a five-dimensional nested output array. +* +* @module @stdlib/array/base/broadcasted-quinary5d +* +* @example +* var ones5d = require( '@stdlib/array/base/ones5d' ); +* var zeros5d = require( '@stdlib/array/base/zeros5d' ); +* var bquinary5d = require( '@stdlib/array/base/broadcasted-quinary5d' ); +* +* function add( x, y, z, w, v ) { +* return x + y + z + w + v; +* } +* +* var shapes = [ +* [ 1, 2, 2, 2, 2 ], +* [ 2, 1, 2, 2, 2 ], +* [ 2, 2, 1, 2, 2 ], +* [ 2, 2, 2, 1, 2 ], +* [ 2, 2, 2, 2, 1 ], +* [ 2, 2, 2, 2, 2 ] +* ]; +* +* var x = ones5d( shapes[ 0 ] ); +* var y = ones5d( shapes[ 1 ] ); +* var z = ones5d( shapes[ 2 ] ); +* var w = ones5d( shapes[ 3 ] ); +* var v = ones5d( shapes[ 4 ] ); +* var out = zeros5d( shapes[ 5 ] ); +* +* bquinary5d( [ x, y, z, w, v, out ], shapes, add ); +* +* console.log( out ); +* // => array of shape [2, 2, 2, 2, 2] filled with the value 5.0 +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; From 4d8936712a61a63892681e8aac8640a5ebd3bd18 Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Sat, 23 Nov 2024 21:27:38 +0600 Subject: [PATCH 04/29] "added main.js" --- .../base/broadcasted-quinary5D/lib/main.js | 288 ++++++++++++++++++ 1 file changed, 288 insertions(+) create mode 100644 lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/main.js diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/main.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/main.js new file mode 100644 index 000000000000..3ec09fdfd230 --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/main.js @@ -0,0 +1,288 @@ +/** +* @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 five broadcasted input arrays and assigns results to elements in a five-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 ones5d = require( '@stdlib/array/base/ones5d' ); +* var zeros5d = require( '@stdlib/array/base/zeros5d' ); +* +* function add( x, y, z, w, v ) { +* return x + y + z + w + v; +* } +* +* var shapes = [ +* [ 1, 2, 2, 2, 2 ], +* [ 2, 1, 2, 2, 2 ], +* [ 2, 2, 1, 2, 2 ], +* [ 2, 2, 2, 1, 2 ], +* [ 2, 2, 2, 2, 1 ], +* [ 2, 2, 2, 2, 2 ] +* ]; +* +* var x = ones5d( shapes[ 0 ] ); +* var y = ones5d( shapes[ 1 ] ); +* var z = ones5d( shapes[ 2 ] ); +* var w = ones5d( shapes[ 3 ] ); +* var v = ones5d( shapes[ 4 ] ); +* var out = zeros5d( shapes[ 5 ] ); +* +* bquinary5d( [ x, y, z, w, v, out ], shapes, add ); +* +* console.log( out ); +* // => array of shape [2, 2, 2, 2, 2] filled with the value 5.0 +*/ +function bquinary5d( arrays, shapes, fcn ) { + var dx0; + var dx1; + var dx2; + var dx3; + var dx4; + var dy0; + var dy1; + var dy2; + var dy3; + var dy4; + var dz0; + var dz1; + var dz2; + var dz3; + var dz4; + var dw0; + var dw1; + var dw2; + var dw3; + var dw4; + var du0; + var du1; + var du2; + var du3; + var du4; + var S0; + var S1; + var S2; + var S3; + var S4; + var i0; + var i1; + var i2; + var i3; + var i4; + var j0; + var j1; + var j2; + var j3; + var j4; + var k0; + var k1; + var k2; + var k3; + var k4; + var m0; + var m1; + var m2; + var m3; + var m4; + var n0; + var n1; + var n2; + var n3; + var n4; + var p0; + var p1; + var p2; + var p3; + var p4; + var x0; + var y0; + var z0; + var w0; + var u0; + var v0; + var sh; + var st; + var o; + var x; + var y; + var z; + var w; + var u; + var v; + + sh = shapes[ 5 ]; + S0 = sh[ 4 ]; + S1 = sh[ 3 ]; + S2 = sh[ 2 ]; + S3 = sh[ 1 ]; + S4 = sh[ 0 ]; + if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) { + return; + } + o = broadcastArray( arrays[ 0 ], shapes[ 0 ], sh ); + x = o.data; + st = o.strides; + dx0 = st[ 4 ]; + dx1 = st[ 3 ]; + dx2 = st[ 2 ]; + dx3 = st[ 1 ]; + dx4 = st[ 0 ]; + + o = broadcastArray( arrays[ 1 ], shapes[ 1 ], sh ); + y = o.data; + st = o.strides; + dy0 = st[ 4 ]; + dy1 = st[ 3 ]; + dy2 = st[ 2 ]; + dy3 = st[ 1 ]; + dy4 = st[ 0 ]; + + o = broadcastArray( arrays[ 2 ], shapes[ 2 ], sh ); + z = o.data; + st = o.strides; + dz0 = st[ 4 ]; + dz1 = st[ 3 ]; + dz2 = st[ 2 ]; + dz3 = st[ 1 ]; + dz4 = st[ 0 ]; + + o = broadcastArray( arrays[ 3 ], shapes[ 3 ], sh ); + w = o.data; + st = o.strides; + dw0 = st[ 4 ]; + dw1 = st[ 3 ]; + dw2 = st[ 2 ]; + dw3 = st[ 1 ]; + dw4 = st[ 0 ]; + + o = broadcastArray( arrays[ 4 ], shapes[ 4 ], sh ); + u = o.data; + st = o.strides; + du0 = st[ 4 ]; + du1 = st[ 3 ]; + du2 = st[ 2 ]; + du3 = st[ 1 ]; + du4 = st[ 0 ]; + + v = arrays[ 5 ]; + + j4 = 0; + k4 = 0; + m4 = 0; + n4 = 0; + p4 = 0; + for ( i4 = 0; i4 < S4; i4++ ) { + j3 = 0; + k3 = 0; + m3 = 0; + n3 = 0; + p3 = 0; + x0 = x[ j4 ]; + y0 = y[ k4 ]; + z0 = z[ m4 ]; + w0 = w[ n4 ]; + u0 = u[ p4 ]; + v0 = v[ i4 ]; + for ( i3 = 0; i3 < S3; i3++ ) { + j2 = 0; + k2 = 0; + m2 = 0; + n2 = 0; + p2 = 0; + x0 = x0[ j3 ]; + y0 = y0[ k3 ]; + z0 = z0[ m3 ]; + w0 = w0[ n3 ]; + u0 = u0[ p3 ]; + v0 = v0[ i3 ]; + for ( i2 = 0; i2 < S2; i2++ ) { + j1 = 0; + k1 = 0; + m1 = 0; + n1 = 0; + p1 = 0; + x0 = x0[ j2 ]; + y0 = y0[ k2 ]; + z0 = z0[ m2 ]; + w0 = w0[ n2 ]; + u0 = u0[ p2 ]; + v0 = v0[ i2 ]; + for ( i1 = 0; i1 < S1; i1++ ) { + j0 = 0; + k0 = 0; + m0 = 0; + n0 = 0; + p0 = 0; + x0 = x0[ j1 ]; + y0 = y0[ k1 ]; + z0 = z0[ m1 ]; + w0 = w0[ n1 ]; + u0 = u0[ p1 ]; + v0 = v0[ i1 ]; + for ( i0 = 0; i0 < S0; i0++ ) { + v0[ i0 ] = fcn( x0[ j0 ], y0[ k0 ], z0[ m0 ], w0[ n0 ], u0[ p0 ] ); + 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; + } + j4 += dx4; + k4 += dy4; + m4 += dz4; + n4 += dw4; + p4 += du4; + } +} + + +// EXPORTS // + +module.exports = bquinary5d; From ab174a804f6c7b9d577b36ff10dc3d381df6e004 Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Sat, 23 Nov 2024 21:34:34 +0600 Subject: [PATCH 05/29] "added example" --- .../broadcasted-quinary5D/examples/index.js | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/examples/index.js diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/examples/index.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/examples/index.js new file mode 100644 index 000000000000..ed6702f349ce --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/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 filled5dBy = require( '@stdlib/array/base/filled5d-by' ); +var zeros5d = require( '@stdlib/array/base/zeros5d' ); +var bquinary5d = require( './../lib' ); + +function add( x, y, z, w, v ) { + return x + y + z + w + v; +} + +var shapes = [ + [ 1, 2, 2, 2, 2 ], + [ 2, 1, 2, 2, 2 ], + [ 2, 2, 1, 2, 2 ], + [ 2, 2, 2, 1, 2 ], + [ 2, 2, 2, 2, 1 ], + [ 2, 2, 2, 2, 2 ] +]; + +var x = filled5dBy( shapes[ 0 ], discreteUniform( -100, 100 ) ); +console.log( x ); + +var y = filled5dBy( shapes[ 1 ], discreteUniform( -100, 100 ) ); +console.log( y ); + +var z = filled5dBy( shapes[ 2 ], discreteUniform( -100, 100 ) ); +console.log( z ); + +var w = filled5dBy( shapes[ 3 ], discreteUniform( -100, 100 ) ); +console.log( w ); + +var v = filled5dBy( shapes[ 4 ], discreteUniform( -100, 100 ) ); +console.log( v ); + +var out = zeros5d( shapes[ 5 ] ); +console.log( out ); + +bquinary5d( [ x, y, z, w, v, out ], shapes, add ); +console.log( out ); From 76486e179d7092024c3dcba19c5b37065c762d68 Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Sat, 23 Nov 2024 22:05:01 +0600 Subject: [PATCH 06/29] "added test" --- .../base/broadcasted-quinary5D/test/test.js | 177 ++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js new file mode 100644 index 000000000000..3b37a986205c --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js @@ -0,0 +1,177 @@ +/** +* @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 zeros5d = require( '@stdlib/array/base/zeros5d' ); +var bquinary5d = require( './../lib' ); +const filled5dBy = require('@stdlib/array/base/filled5d-by'); + + +// 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 bquinary5d, '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, 2, 2, 2, 2 ], + [ 2, 1, 2, 2, 2 ], + [ 2, 2, 1, 2, 2 ], + [ 2, 2, 2, 1, 2 ], + [ 2, 2, 2, 2, 1 ], + [ 2, 2, 2, 2, 2 ] + ]; + x = filled5dBy( shapes[ 0 ], discreteUniform( -100, 100 ) ); + y = filled5dBy( shapes[ 1 ], discreteUniform( -100, 100 ) ); + z = filled5dBy( shapes[ 2 ], discreteUniform( -100, 100 ) ); + w = filled5dBy( shapes[ 3 ], discreteUniform( -100, 100 ) ); + u = filled5dBy( shapes[ 4 ], discreteUniform( -100, 100 ) ); + out = zeros5d( shapes[ 5 ] ); + + expected = filled5dBy( shapes[ 5 ], () => 5.0 ); + bquinary5d( [ 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, 2 ], + [ 2, 2, 2, 2, 2 ] + ]; + x = filled5dBy( shapes[ 0 ], discreteUniform( -100, 100 ) ); + y = filled5dBy( shapes[ 1 ], discreteUniform( -100, 100 ) ); + z = filled5dBy( shapes[ 2 ], discreteUniform( -100, 100 ) ); + w = filled5dBy( shapes[ 3 ], discreteUniform( -100, 100 ) ); + u = filled5dBy( shapes[ 4 ], discreteUniform( -100, 100 ) ); + out = zeros5d( shapes[ 5 ] ); + + expected = filled5dBy( shapes[ 5 ], () => 5.0 ); + bquinary5d( [ 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 ], + [ 2, 2, 2, 2, 2 ], + [ 0, 2, 2, 2, 2 ] + ]; + x = filled5dBy( shapes[ 0 ], discreteUniform( -100, 100 ) ); + y = filled5dBy( shapes[ 1 ], discreteUniform( -100, 100 ) ); + z = filled5dBy( shapes[ 2 ], discreteUniform( -100, 100 ) ); + w = filled5dBy( shapes[ 3 ], discreteUniform( -100, 100 ) ); + u = filled5dBy( shapes[ 4 ], discreteUniform( -100, 100 ) ); + out = zeros5d( [ 2, 2, 2, 2, 2 ] ); + + expected = zeros5d( [ 2, 2, 2, 2, 2 ] ); + bquinary5d( [ 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 fifth 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, 2 ], + [ 2, 2, 2, 2, 0 ] + ]; + x = filled5dBy( shapes[ 0 ], discreteUniform( -100, 100 ) ); + y = filled5dBy( shapes[ 1 ], discreteUniform( -100, 100 ) ); + z = filled5dBy( shapes[ 2 ], discreteUniform( -100, 100 ) ); + w = filled5dBy( shapes[ 3 ], discreteUniform( -100, 100 ) ); + u = filled5dBy( shapes[ 4 ], discreteUniform( -100, 100 ) ); + out = zeros5d( [ 2, 2, 2, 2, 2 ] ); + + expected = zeros5d( [ 2, 2, 2, 2, 2 ] ); + bquinary5d( [ 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 1061f1e94a84dadc0b616044acb420637bb9198c Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Sat, 23 Nov 2024 22:10:11 +0600 Subject: [PATCH 07/29] "added package.json" --- .../base/broadcasted-quinary5D/package.json | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/package.json diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/package.json b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/package.json new file mode 100644 index 000000000000..0f6517c1bfdd --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/package.json @@ -0,0 +1,68 @@ +{ + "name": "@stdlib/array/base/broadcasted-quinary5d", + "version": "0.0.0", + "description": "Apply a quinary callback to elements in five broadcasted input arrays and assign results to elements in a five-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", + "5d", + "quinary", + "apply", + "foreach", + "map", + "transform", + "broadcast" + ], + "__stdlib__": {} + } + \ No newline at end of file From e5ebdf3964659c4a4c9649c02a99e528fab90589 Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Sat, 23 Nov 2024 22:38:43 +0600 Subject: [PATCH 08/29] "added README.md" --- .../base/broadcasted-quinary5D/README.md | 162 ++++++++++++++++++ .../base/broadcasted-quinary5D/package.json | 2 +- 2 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/README.md diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/README.md b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/README.md new file mode 100644 index 000000000000..859ab34cc2d7 --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/README.md @@ -0,0 +1,162 @@ + + +# bquinary5d + +> Apply a quinary callback to elements in five [broadcasted][@stdlib/array/base/broadcast-array] nested input arrays and assign results to elements in a five-dimensional nested output array. + +
+ +
+ + + +
+ +## Usage + +```javascript +var bquinary5d = require( '@stdlib/array/base/broadcasted-quinary5d' ); +``` + +#### bquinary5d( arrays, shapes, fcn ) + +Applies a quinary callback to elements in five [broadcasted][@stdlib/array/base/broadcast-array] nested input arrays and assigns results to elements in a five-dimensional nested output array. + +```javascript +var zeros5d = require( '@stdlib/array/base/zeros5d' ); + +function add( x, y, z, w, v ) { + return x + y + z + w + v; +} + + +var x = filled5dBy( shapes[ 0 ], discreteUniform( -100, 100 ) ); +var y = filled5dBy( shapes[ 1 ], discreteUniform( -100, 100 ) ); +var z = filled5dBy( shapes[ 2 ], discreteUniform( -100, 100 ) ); +var w = filled5dBy( shapes[ 3 ], discreteUniform( -100, 100 ) ); +var v = filled5dBy( shapes[ 4 ], discreteUniform( -100, 100 ) ); + +var out = zeros5d( shapes[ 5 ] ); + +var shapes = [ + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 2, 1, 2 ], + [ 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 1 ], + [ 1, 1, 2, 2, 2 ] +]; + +bquinary5d( [ x, y, z, w, v, out ], shapes, add ); +// out => [ [ [ [ [ 12.0, 13.0 ] ], [ [ 13.0, 14.0 ] ] ] ], [ [ [ [ 13.0, 14.0 ] ], [ [ 14.0, 15.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 filled5dBy = require( '@stdlib/array/base/filled5d-by' ); +var zeros5d = require( '@stdlib/array/base/zeros5d' ); +var bquinary5d = require( '@stdlib/array/base/broadcasted-quinary5d' ); + +function add( x, y, z, w, v ) { + return x + y + z + w + v; +} + +var shapes = [ + [ 1, 1, 1, 2, 3 ], + [ 1, 1, 3, 1, 1 ], + [ 1, 1, 1, 1, 1 ], + [ 1, 1, 3, 3, 3 ], + [ 1, 1, 1, 2, 3 ], + [ 1, 1, 3, 2, 3 ] +]; + +var x = filled5dBy( shapes[ 0 ], discreteUniform( -100, 100 ) ); +console.log( x ); + +var y = filled5dBy( shapes[ 1 ], discreteUniform( -100, 100 ) ); +console.log( y ); + +var z = filled5dBy( shapes[ 2 ], discreteUniform( -100, 100 ) ); +console.log( z ); + +var w = filled5dBy( shapes[ 3 ], discreteUniform( -100, 100 ) ); +console.log( w ); + +var v = filled5dBy( shapes[ 4 ], discreteUniform( -100, 100 ) ); +console.log( v ); + +var out = zeros5d( shapes[ 5 ] ); +console.log( out ); + +bquinary5d( [ x, y, z, w, v, out ], shapes, add ); +console.log( out ); +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/package.json b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/package.json index 0f6517c1bfdd..2c8dbbe60578 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/package.json +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/package.json @@ -52,7 +52,7 @@ "stdlib", "base", "array", - "multidimensional", + "five-dimensional", "ndarray", "matrix", "5d", From fefb4e0f322883640307c419c4f882acb4c9368f Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Sat, 23 Nov 2024 22:48:25 +0600 Subject: [PATCH 09/29] "added repl.text" --- .../base/broadcasted-quinary5D/docs/repl.text | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/repl.text diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/repl.text b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/repl.text new file mode 100644 index 000000000000..e4821e190865 --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/repl.text @@ -0,0 +1,39 @@ + +{{alias}}( arrays, shapes, fcn ) + Applies a quinary callback to elements in five broadcasted input arrays + and assigns results to elements in a five-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 = filled5dBy( shapes[ 0 ], discreteUniform( -100, 100 ) ); + > var y = filled5dBy( shapes[ 1 ], discreteUniform( -100, 100 ) ); + > var z = filled5dBy( shapes[ 2 ], discreteUniform( -100, 100 ) ); + > var w = filled5dBy( shapes[ 3 ], discreteUniform( -100, 100 ) ); + > var v = filled5dBy( shapes[ 4 ], discreteUniform( -100, 100 ) ); + > var out = zeros5d( shapes[ 5 ] ); + > var shapes = [ 1, 2, 2, 2, 2 ], + [ 2, 1, 2, 2, 2 ], + [ 2, 2, 1, 2, 2 ], + [ 2, 2, 2, 1, 2 ], + [ 2, 2, 2, 2, 1 ], + [ 2, 2, 2, 2, 2 ] + > {{alias}}( [ x, y, z, w, v, out ], shapes, fcn ); + > out + [ [ [ [ [ 12.0, 13.0 ] ], [ [ 13.0, 14.0 ] ] ] ], [ [ [ [ 13.0, 14.0 ] ], [ [ 14.0, 15.0 ] ] ] ] ] + + See Also + -------- + From 11d08f2c9c30d6174959f6f9d1b09ed99d616e0f Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Sat, 23 Nov 2024 23:01:26 +0600 Subject: [PATCH 10/29] "added index.d.ts" --- .../docs/types/index.d.ts | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/index.d.ts diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/index.d.ts b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/index.d.ts new file mode 100644 index 000000000000..5796c341a807 --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/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,Array5D } from '@stdlib/types/array'; +import { Shape1D, Shape2D, Shape3D, Shape4D, Shape5D } 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 = Array5D; + +/** +* Input array shape. +*/ +type InputArrayShape = Shape5D; + +/** +* Output array. +*/ +type OutputArray = Array5D; + +/** +* Output array shape. +*/ +type OutputArrayShape = Shape5D; + +/** +* 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 five broadcasted input arrays and assigns results to elements in a five-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 ones5d = require( '@stdlib/array/base/ones5d' ); +* var zeros5d = require( '@stdlib/array/base/zeros5d' ); +* +* function add( x, y, z, w, v ) { +* return x + y + z + w + v; +* } +* +* var shapes = [ +* [ 1, 1, 1, 2, 2 ], +* [ 1, 1, 2, 1, 2 ], +* [ 1, 1, 1, 1, 1 ], +* [ 1, 1, 1, 1, 1 ], +* [ 1, 1, 1, 1, 1 ], +* [ 1, 1, 2, 2, 2 ] +* ]; +* +* var x = ones5d( shapes[ 0 ] ); +* var y = ones5d( shapes[ 1 ] ); +* var z = ones5d( shapes[ 2 ] ); +* var w = ones5d( shapes[ 3 ] ); +* var v = ones5d( shapes[ 4 ] ); +* var out = zeros5d( shapes[ 5 ] ); +* +* bquinary5d( [ 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 ] ] ] ] ] +*/ +declare function bquinary5d( arrays: InOutArrays, shapes: InOutShapes, fcn: Quinary ): void; + + +// EXPORTS // + +export = bquinary5d; From d6f28a02e3f25825df9df98a2a6fa081fd31df2a Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Sat, 23 Nov 2024 23:15:59 +0600 Subject: [PATCH 11/29] "added test.ts" --- .../broadcasted-quinary5D/docs/types/test.ts | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/test.ts diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/test.ts b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/test.ts new file mode 100644 index 000000000000..850b7ef37e26 --- /dev/null +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/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 bquinary5d = 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 ]]]]]; + const y = [[[[[ 1.0, 2.0 ]]]]]; + const z = [[[[[ 1.0, 2.0 ]]]]]; + const w = [[[[[ 1.0, 2.0 ]]]]]; + const v = [[[[[ 1.0, 2.0 ]]]]]; + const out = [[[[[ 0.0, 0.0 ]]]]]; + + const shapes: InOutShapes = [ [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ] ]; + + bquinary5d( [ x, y, z, w, v, out ], shapes, fcn ); // $ExpectType void + bquinary5d( [ x[ 0 ], y, z, w, v, out ], [ [ shapes[ 0 ][ 4 ] ], 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 = [ [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ] ]; + + bquinary5d( 'abc', shapes, fcn ); // $ExpectError + bquinary5d( 3.14, shapes, fcn ); // $ExpectError + bquinary5d( true, shapes, fcn ); // $ExpectError + bquinary5d( false, shapes, fcn ); // $ExpectError + bquinary5d( null, shapes, fcn ); // $ExpectError + bquinary5d( [ '1' ], shapes, fcn ); // $ExpectError + bquinary5d( {}, shapes, fcn ); // $ExpectError + bquinary5d( ( 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 ]]]]]; + const y = [[[[[ 1.0, 2.0 ]]]]]; + const z = [[[[[ 1.0, 2.0 ]]]]]; + const w = [[[[[ 1.0, 2.0 ]]]]]; + const v = [[[[[ 1.0, 2.0 ]]]]]; + const out = [[[[[ 0.0, 0.0 ]]]]]; + + bquinary5d( [ x, y, z, w, v, out ], 'abc', fcn ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], 3.14, fcn ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], true, fcn ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], false, fcn ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], null, fcn ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], [ '1' ], fcn ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], {}, fcn ); // $ExpectError + bquinary5d( [ 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 ]]]]]; + const y = [[[[[ 1.0, 2.0 ]]]]]; + const z = [[[[[ 1.0, 2.0 ]]]]]; + const w = [[[[[ 1.0, 2.0 ]]]]]; + const v = [[[[[ 1.0, 2.0 ]]]]]; + const out = [[[[[ 0.0, 0.0 ]]]]]; + + const shapes: InOutShapes = [ [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ] ]; + + bquinary5d( [ x, y, z, w, v, out ], shapes, 'abc' ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], shapes, 3.14 ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], shapes, true ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], shapes, false ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], shapes, null ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], shapes, [ '1' ] ); // $ExpectError + bquinary5d( [ 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 ]]]]]; + const y = [[[[[ 1.0, 2.0 ]]]]]; + const z = [[[[[ 1.0, 2.0 ]]]]]; + const w = [[[[[ 1.0, 2.0 ]]]]]; + const v = [[[[[ 1.0, 2.0 ]]]]]; + const out = [[[[[ 0.0, 0.0 ]]]]]; + + const shapes: InOutShapes = [ [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ] ]; + + bquinary5d(); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ] ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], shapes, fcn, {} ); // $ExpectError +} From e4148026aed97c0439f6381663a3caa6a118a959 Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Sat, 23 Nov 2024 23:23:02 +0600 Subject: [PATCH 12/29] "fixed README" --- .../base/broadcasted-quinary5D/README.md | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/README.md b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/README.md index 859ab34cc2d7..7df9b3b5eb17 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/README.md +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/README.md @@ -47,22 +47,20 @@ function add( x, y, z, w, v ) { return x + y + z + w + v; } - -var x = filled5dBy( shapes[ 0 ], discreteUniform( -100, 100 ) ); -var y = filled5dBy( shapes[ 1 ], discreteUniform( -100, 100 ) ); -var z = filled5dBy( shapes[ 2 ], discreteUniform( -100, 100 ) ); -var w = filled5dBy( shapes[ 3 ], discreteUniform( -100, 100 ) ); -var v = filled5dBy( shapes[ 4 ], discreteUniform( -100, 100 ) ); - -var out = zeros5d( shapes[ 5 ] ); +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 = zeros5d( [ 2, 2, 2, 2, 2 ] ); var shapes = [ [ 1, 1, 1, 2, 2 ], - [ 1, 1, 2, 1, 2 ], + [ 2, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1 ], - [ 1, 1, 2, 2, 2 ] + [ 2, 2, 2, 2, 2 ] ]; bquinary5d( [ x, y, z, w, v, out ], shapes, add ); @@ -107,12 +105,12 @@ function add( x, y, z, w, v ) { } var shapes = [ - [ 1, 1, 1, 2, 3 ], - [ 1, 1, 3, 1, 1 ], + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 2, 1, 2 ], + [ 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1 ], - [ 1, 1, 3, 3, 3 ], - [ 1, 1, 1, 2, 3 ], - [ 1, 1, 3, 2, 3 ] + [ 1, 1, 1, 1, 1 ], + [ 1, 1, 2, 2, 2 ] ]; var x = filled5dBy( shapes[ 0 ], discreteUniform( -100, 100 ) ); From 8fcc70bcde3ce9a25e0ca0661d0cb5326302f179 Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Sat, 23 Nov 2024 23:29:32 +0600 Subject: [PATCH 13/29] "fixed repl.text" --- .../base/broadcasted-quinary5D/docs/repl.text | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/repl.text b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/repl.text index e4821e190865..9da72ddb9b3b 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/repl.text +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/repl.text @@ -18,17 +18,17 @@ Examples -------- > function fcn( x, y, z, w, v ) { return x + y + z + w + v; }; - > var x = filled5dBy( shapes[ 0 ], discreteUniform( -100, 100 ) ); - > var y = filled5dBy( shapes[ 1 ], discreteUniform( -100, 100 ) ); - > var z = filled5dBy( shapes[ 2 ], discreteUniform( -100, 100 ) ); - > var w = filled5dBy( shapes[ 3 ], discreteUniform( -100, 100 ) ); - > var v = filled5dBy( shapes[ 4 ], discreteUniform( -100, 100 ) ); - > var out = zeros5d( shapes[ 5 ] ); - > var shapes = [ 1, 2, 2, 2, 2 ], - [ 2, 1, 2, 2, 2 ], - [ 2, 2, 1, 2, 2 ], - [ 2, 2, 2, 1, 2 ], - [ 2, 2, 2, 2, 1 ], + > 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 = zeros5d( [ 2, 2, 2, 2, 2 ] ); + > var shapes = [ 1, 1, 1, 2, 2 ], + [ 2, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 1 ], [ 2, 2, 2, 2, 2 ] > {{alias}}( [ x, y, z, w, v, out ], shapes, fcn ); > out From a8a781ae3d531664e6e485cf2274b2bace68aeed Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Mon, 25 Nov 2024 19:45:57 +0600 Subject: [PATCH 14/29] "edited test.js" --- .../base/broadcasted-quinary5D/test/test.js | 117 ++++++++++++------ 1 file changed, 77 insertions(+), 40 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js index 3b37a986205c..644ed2588b15 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js @@ -23,7 +23,6 @@ var tape = require( 'tape' ); var zeros5d = require( '@stdlib/array/base/zeros5d' ); var bquinary5d = require( './../lib' ); -const filled5dBy = require('@stdlib/array/base/filled5d-by'); // FUNCTIONS // @@ -63,45 +62,83 @@ tape( 'the function applies a provided callback to broadcasted input arrays and var u; shapes = [ - [ 1, 2, 2, 2, 2 ], - [ 2, 1, 2, 2, 2 ], - [ 2, 2, 1, 2, 2 ], - [ 2, 2, 2, 1, 2 ], - [ 2, 2, 2, 2, 1 ], - [ 2, 2, 2, 2, 2 ] - ]; - x = filled5dBy( shapes[ 0 ], discreteUniform( -100, 100 ) ); - y = filled5dBy( shapes[ 1 ], discreteUniform( -100, 100 ) ); - z = filled5dBy( shapes[ 2 ], discreteUniform( -100, 100 ) ); - w = filled5dBy( shapes[ 3 ], discreteUniform( -100, 100 ) ); - u = filled5dBy( shapes[ 4 ], discreteUniform( -100, 100 ) ); + [ 1, 1, 1, 2, 1 ], + [ 1, 1, 1, 2, 1 ], + [ 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 2 ], + [ 1, 1, 1, 2, 2 ] + ]; + x = [ [ [ [ [ 1.0, 2.0 ] ] ] ] ] ; + y = [ [ [ [ [ 3.0 ] ] ], [ [ [ 4.0 ] ] ] ] ]; + z = [ [ [ [ [ 5.0 ] ] ] ] ]; + w = [ [ [ [ [ 1.0 ] ] ] ] ]; + u = [ [ [ [ [ 1.0, 2.0 ] ] ] ] ]; out = zeros5d( shapes[ 5 ] ); - expected = filled5dBy( shapes[ 5 ], () => 5.0 ); - bquinary5d( [ x, y, z, w, u, out ], shapes, add ); + expected = [ [ [ [ [ 11.0, 13.0] ] ], [ [ [ 12.0, 14.0] ] ] ] ]; + bquinary5d( [ 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, 2 ], - [ 2, 2, 2, 2, 2 ] + [ 1, 1, 1, 1, 2 ], + [ 1, 1, 1, 2, 1 ], + [ 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 1 ], + [ 1, 1, 1, 2, 2 ] ]; - x = filled5dBy( shapes[ 0 ], discreteUniform( -100, 100 ) ); - y = filled5dBy( shapes[ 1 ], discreteUniform( -100, 100 ) ); - z = filled5dBy( shapes[ 2 ], discreteUniform( -100, 100 ) ); - w = filled5dBy( shapes[ 3 ], discreteUniform( -100, 100 ) ); - u = filled5dBy( shapes[ 4 ], discreteUniform( -100, 100 ) ); + x = [ [ [ [ [ 1.0, 2.0 ] ] ] ] ]; + y = [ [ [ [ [ 3.0, 4.0 ] ] ] ] ]; + z = [ [ [ [ [ 5.0 ] ] ] ] ]; + w = [ [ [ [ [ 2.0, 3.0 ] ], [ [ 4.0, 5.0 ] ] ] ] ]; + u = [ [ [ [ [ 1.0 ] ], [ [ 2.0 ] ] ] ] ]; out = zeros5d( shapes[ 5 ] ); - expected = filled5dBy( shapes[ 5 ], () => 5.0 ); - bquinary5d( [ x, y, z, w, u, out ], shapes, add ); + expected = [ [ [ [ [ 12.0, 15.0 ], [ 15.0, 18.0 ] ] ] ] ]; + bquinary5d( [ x, y, z, w, u, out ], shapes, add ); t.deepEqual( out, expected, 'returns expected value' ); - t.end(); - }); + //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, 2 ], + [ 2, 2, 2, 2, 2 ] + ]; + x = [ [ + [ [ [ 1.0, 2.0 ] ] ], + [ [ [ 3.0, 4.0 ] ] ] + ] ]; + y = [ [ + [ [ [ 1.0, 2.0 ] ] ], + [ [ [ 3.0, 4.0 ] ] ] + ] ]; + z = [ [ + [ [ [ 1.0, 2.0 ] ] ], + [ [ [ 3.0, 4.0 ] ] ] + ] ]; + w = [ [ + [ [ [ 1.0, 2.0 ] ] ], + [ [ [ 3.0, 4.0 ] ] ] + ] ]; + u = [ [ + [ [ [ 1.0, 2.0 ] ] ], + [ [ [ 3.0, 4.0 ] ] ] + ] ]; + out = zeros5d( shapes[ 5 ] ); + + expected = [ [ + [ [ [ 5.0, 10.0 ] ] ], + [ [ [ 15.0, 20.0 ] ] ] + ] ]; + bquinary5d( [ 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 ) { @@ -122,11 +159,11 @@ tape( 'the function does not invoke a provided callback if provided an output sh [ 2, 2, 2, 2, 2 ], [ 0, 2, 2, 2, 2 ] ]; - x = filled5dBy( shapes[ 0 ], discreteUniform( -100, 100 ) ); - y = filled5dBy( shapes[ 1 ], discreteUniform( -100, 100 ) ); - z = filled5dBy( shapes[ 2 ], discreteUniform( -100, 100 ) ); - w = filled5dBy( shapes[ 3 ], discreteUniform( -100, 100 ) ); - u = filled5dBy( shapes[ 4 ], discreteUniform( -100, 100 ) ); + x = [ [ [ [ [ 1.0, 2.0 ] ], [ [ 3.0, 4.0 ] ] ] ] ]; + y = x; + z = x; + w = x; + u = x; out = zeros5d( [ 2, 2, 2, 2, 2 ] ); expected = zeros5d( [ 2, 2, 2, 2, 2 ] ); @@ -158,11 +195,11 @@ tape( 'the function does not invoke a provided callback if provided an output sh [ 2, 2, 2, 2, 2 ], [ 2, 2, 2, 2, 0 ] ]; - x = filled5dBy( shapes[ 0 ], discreteUniform( -100, 100 ) ); - y = filled5dBy( shapes[ 1 ], discreteUniform( -100, 100 ) ); - z = filled5dBy( shapes[ 2 ], discreteUniform( -100, 100 ) ); - w = filled5dBy( shapes[ 3 ], discreteUniform( -100, 100 ) ); - u = filled5dBy( shapes[ 4 ], discreteUniform( -100, 100 ) ); + x = [ [ [ [ [ 1.0, 2.0 ] ], [ [ 3.0, 4.0 ] ] ] ] ]; + y= x; + z = x; + w = x; + u = x; out = zeros5d( [ 2, 2, 2, 2, 2 ] ); expected = zeros5d( [ 2, 2, 2, 2, 2 ] ); From e043544454422f2cbe59271793d926bee90d579a Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Mon, 25 Nov 2024 22:08:35 +0600 Subject: [PATCH 15/29] "added change" --- .../base/broadcasted-quinary5D/README.md | 37 +- .../benchmark/benchmark.js | 16 +- .../docs/{repl.text => repl.txt} | 21 +- .../docs/types/index.d.ts | 9 +- .../broadcasted-quinary5D/docs/types/test.ts | 53 +- .../broadcasted-quinary5D/examples/index.js | 17 +- .../base/broadcasted-quinary5D/lib/index.js | 5 +- .../base/broadcasted-quinary5D/lib/main.js | 15 +- .../base/broadcasted-quinary5D/package.json | 2 +- .../base/broadcasted-quinary5D/test/test.js | 575 +++++++++++++++--- 10 files changed, 567 insertions(+), 183 deletions(-) rename lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/{repl.text => repl.txt} (56%) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/README.md b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/README.md index 7df9b3b5eb17..5445bd71b183 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/README.md +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/README.md @@ -42,29 +42,26 @@ Applies a quinary callback to elements in five [broadcasted][@stdlib/array/base/ ```javascript var zeros5d = require( '@stdlib/array/base/zeros5d' ); +var add = require( '@stdlib/math/base/add5' ); -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 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 = zeros5d( [ 2, 2, 2, 2, 2 ] ); var shapes = [ - [ 1, 1, 1, 2, 2 ], - [ 2, 1, 1, 1, 1 ], - [ 1, 1, 1, 1, 1 ], - [ 1, 1, 1, 1, 1 ], - [ 1, 1, 1, 1, 1 ], + [ 1, 2 ], + [ 2, 1 ], + [ 1, 1 ], + [ 1, 1 ], + [ 1, 1 ], [ 2, 2, 2, 2, 2 ] ]; bquinary5d( [ x, y, z, w, v, out ], shapes, add ); -// out => [ [ [ [ [ 12.0, 13.0 ] ], [ [ 13.0, 14.0 ] ] ] ], [ [ [ [ 13.0, 14.0 ] ], [ [ 14.0, 15.0 ] ] ] ] ] +// out => [ [ [ [ [ 12.0, 13.0 ] , [ 13.0, 14.0 ] ] , [ [ 12.0, 13.0 ] , [ 13.0, 14.0 ] ] ] ] ] ``` @@ -105,12 +102,12 @@ function add( x, y, z, w, v ) { } var shapes = [ - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 2, 1, 2 ], - [ 1, 1, 1, 1, 1 ], - [ 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 3 ], + [ 1, 1, 1, 3, 1 ], [ 1, 1, 1, 1, 1 ], - [ 1, 1, 2, 2, 2 ] + [ 1, 1, 1, 3, 3 ], + [ 1, 1, 1, 1, 3 ], + [ 1, 1, 1, 3, 3 ] ]; var x = filled5dBy( shapes[ 0 ], discreteUniform( -100, 100 ) ); diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/benchmark/benchmark.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/benchmark/benchmark.js index 9800de86032c..e48523aaff9c 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/benchmark/benchmark.js @@ -25,6 +25,7 @@ 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 add = require( '@stdlib/math/base/ops/add5' ) var filled5dBy = require( '@stdlib/array/base/filled2d-by' ); var zeros5d = require( '@stdlib/array/base/zeros2d' ); var numel = require( '@stdlib/ndarray/base/numel' ); @@ -34,21 +35,6 @@ var bquinary5d = 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. * diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/repl.text b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/repl.txt similarity index 56% rename from lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/repl.text rename to lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/repl.txt index 9da72ddb9b3b..dda95424119b 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/repl.text +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/repl.txt @@ -18,21 +18,16 @@ 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 = zeros5d( [ 2, 2, 2, 2, 2 ] ); - > var shapes = [ 1, 1, 1, 2, 2 ], - [ 2, 1, 1, 1, 1 ], - [ 1, 1, 1, 1, 1 ], - [ 1, 1, 1, 1, 1 ], - [ 1, 1, 1, 1, 1 ], - [ 2, 2, 2, 2, 2 ] + > 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 - [ [ [ [ [ 12.0, 13.0 ] ], [ [ 13.0, 14.0 ] ] ] ], [ [ [ [ 13.0, 14.0 ] ], [ [ 14.0, 15.0 ] ] ] ] ] + [ [ [ [ [ 8.0, 9.0 ] ], [ [ 9.0, 10.0 ] ] ] ] ] See Also -------- diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/index.d.ts b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/index.d.ts index 5796c341a807..73dfbf3bd19a 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/index.d.ts @@ -20,7 +20,7 @@ /// -import { Array1D, Array2D, Array3D, Array4D,Array5D } from '@stdlib/types/array'; +import { Array1D, Array2D, Array3D, Array4D, Array5D } from '@stdlib/types/array'; import { Shape1D, Shape2D, Shape3D, Shape4D, Shape5D } from '@stdlib/types/ndarray'; /** @@ -38,12 +38,12 @@ type Quinary = ( v1: T, v2: U, v3: V, v4: W, v5: X ) => Y; /** * Input array. */ -type InputArray = Array5D; +type InputArray = Array1D | Array2D | Array3D | Array4D | Array5D; /** * Input array shape. */ -type InputArrayShape = Shape5D; +type InputArrayShape = Shape1D | Shape2D | Shape3D | Shape4D | Shape5D; /** * Output array. @@ -93,6 +93,7 @@ type InOutShapes = [ * @example * var ones5d = require( '@stdlib/array/base/ones5d' ); * var zeros5d = require( '@stdlib/array/base/zeros5d' ); +* var add = require( '@stdlib/math/base/ops/add5); * * function add( x, y, z, w, v ) { * return x + y + z + w + v; @@ -117,7 +118,7 @@ type InOutShapes = [ * bquinary5d( [ 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 ] ] ] ] ] +* // => [ [ [ [ [ 2.0, 2.0 ] ], [ [ 2.0, 2.0 ] ] ] ], [ [ [ [ 2.0, 2.0 ] ], [ [ 2.0, 2.0 ] ] ] ] ] */ declare function bquinary5d( arrays: InOutArrays, shapes: InOutShapes, fcn: Quinary ): void; diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/test.ts b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/test.ts index 850b7ef37e26..79d8f442013b 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/test.ts +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/test.ts @@ -42,17 +42,17 @@ type InOutShapes = [ Array, Array, Array, Array, // The function returns undefined... { - const x = [[[[[ 1.0, 2.0 ]]]]]; - const y = [[[[[ 1.0, 2.0 ]]]]]; - const z = [[[[[ 1.0, 2.0 ]]]]]; - const w = [[[[[ 1.0, 2.0 ]]]]]; - const v = [[[[[ 1.0, 2.0 ]]]]]; - const out = [[[[[ 0.0, 0.0 ]]]]]; + 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 = [ [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ] ]; bquinary5d( [ x, y, z, w, v, out ], shapes, fcn ); // $ExpectType void - bquinary5d( [ x[ 0 ], y, z, w, v, out ], [ [ shapes[ 0 ][ 4 ] ], shapes[ 1 ], shapes[ 2 ], shapes[ 3 ], shapes[ 4 ], shapes[ 5 ] ], fcn ); // $ExpectType void + bquinary5d( [ x, y, z, w, v, out ], [ [ shapes[ 0 ][ 4 ] ], 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... @@ -71,13 +71,12 @@ type InOutShapes = [ Array, Array, Array, Array, // 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 ]]]]]; - const y = [[[[[ 1.0, 2.0 ]]]]]; - const z = [[[[[ 1.0, 2.0 ]]]]]; - const w = [[[[[ 1.0, 2.0 ]]]]]; - const v = [[[[[ 1.0, 2.0 ]]]]]; - const out = [[[[[ 0.0, 0.0 ]]]]]; - + 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 ] ] ] ] ]; bquinary5d( [ x, y, z, w, v, out ], 'abc', fcn ); // $ExpectError bquinary5d( [ x, y, z, w, v, out ], 3.14, fcn ); // $ExpectError bquinary5d( [ x, y, z, w, v, out ], true, fcn ); // $ExpectError @@ -90,13 +89,12 @@ type InOutShapes = [ Array, Array, Array, Array, // 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 ]]]]]; - const y = [[[[[ 1.0, 2.0 ]]]]]; - const z = [[[[[ 1.0, 2.0 ]]]]]; - const w = [[[[[ 1.0, 2.0 ]]]]]; - const v = [[[[[ 1.0, 2.0 ]]]]]; - const out = [[[[[ 0.0, 0.0 ]]]]]; - + 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 = [ [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ] ]; bquinary5d( [ x, y, z, w, v, out ], shapes, 'abc' ); // $ExpectError @@ -110,13 +108,12 @@ type InOutShapes = [ Array, Array, Array, Array, // The compiler throws an error if the function is provided an unsupported number of arguments... { - const x = [[[[[ 1.0, 2.0 ]]]]]; - const y = [[[[[ 1.0, 2.0 ]]]]]; - const z = [[[[[ 1.0, 2.0 ]]]]]; - const w = [[[[[ 1.0, 2.0 ]]]]]; - const v = [[[[[ 1.0, 2.0 ]]]]]; - const out = [[[[[ 0.0, 0.0 ]]]]]; - + 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 = [ [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ] ]; bquinary5d(); // $ExpectError diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/examples/index.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/examples/index.js index ed6702f349ce..09740d8342c7 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/examples/index.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/examples/index.js @@ -22,18 +22,15 @@ var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; var filled5dBy = require( '@stdlib/array/base/filled5d-by' ); var zeros5d = require( '@stdlib/array/base/zeros5d' ); var bquinary5d = require( './../lib' ); - -function add( x, y, z, w, v ) { - return x + y + z + w + v; -} +var add = require( '@stdlib/math/base/ops/add5' ); var shapes = [ - [ 1, 2, 2, 2, 2 ], - [ 2, 1, 2, 2, 2 ], - [ 2, 2, 1, 2, 2 ], - [ 2, 2, 2, 1, 2 ], - [ 2, 2, 2, 2, 1 ], - [ 2, 2, 2, 2, 2 ] + [ 1, 1, 1, 1, 3 ], + [ 1, 1, 3, 1, 1 ], + [ 1, 1, 3, 3, 3 ], + [ 1, 1, 1, 1, 3 ], + [ 3, 3, 3, 3, 3 ], + [ 3, 3, 3, 3, 3 ] ]; var x = filled5dBy( shapes[ 0 ], discreteUniform( -100, 100 ) ); diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/index.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/index.js index bfd073b7629c..f56ddb72df0c 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/index.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/index.js @@ -27,10 +27,7 @@ * var ones5d = require( '@stdlib/array/base/ones5d' ); * var zeros5d = require( '@stdlib/array/base/zeros5d' ); * var bquinary5d = require( '@stdlib/array/base/broadcasted-quinary5d' ); -* -* function add( x, y, z, w, v ) { -* return x + y + z + w + v; -* } +* var add = require( '@stdlib/array/base/broadcasted-quinary5D' ) * * var shapes = [ * [ 1, 2, 2, 2, 2 ], diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/main.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/main.js index 3ec09fdfd230..6247c8adcd89 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/main.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/main.js @@ -36,17 +36,14 @@ var broadcastArray = require( '@stdlib/array/base/broadcast-array' ); * @example * var ones5d = require( '@stdlib/array/base/ones5d' ); * var zeros5d = require( '@stdlib/array/base/zeros5d' ); -* -* function add( x, y, z, w, v ) { -* return x + y + z + w + v; -* } +* var add = require( '@stdlib/math/base/ops/add5' ); * * var shapes = [ -* [ 1, 2, 2, 2, 2 ], -* [ 2, 1, 2, 2, 2 ], -* [ 2, 2, 1, 2, 2 ], +* [ 1, 1, 1, 1, 2 ], +* [ 1, 1, 2, 1, 1 ], +* [ 1, 1, 1, 2, 1 ], * [ 2, 2, 2, 1, 2 ], -* [ 2, 2, 2, 2, 1 ], +* [ 2, 2, 2, 2, 2 ], * [ 2, 2, 2, 2, 2 ] * ]; * @@ -60,7 +57,7 @@ var broadcastArray = require( '@stdlib/array/base/broadcast-array' ); * bquinary5d( [ x, y, z, w, v, out ], shapes, add ); * * console.log( out ); -* // => array of shape [2, 2, 2, 2, 2] filled with the value 5.0 +* // => [ [ [ [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ], [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] ] ] ] */ function bquinary5d( arrays, shapes, fcn ) { var dx0; diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/package.json b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/package.json index 2c8dbbe60578..0f6517c1bfdd 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/package.json +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/package.json @@ -52,7 +52,7 @@ "stdlib", "base", "array", - "five-dimensional", + "multidimensional", "ndarray", "matrix", "5d", diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js index 644ed2588b15..b9933a9bc4a8 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js @@ -21,28 +21,11 @@ // MODULES // var tape = require( 'tape' ); +var add =require( '@stdlib/math/base/ops/add5') var zeros5d = require( '@stdlib/array/base/zeros5d' ); var bquinary5d = 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 ) { @@ -62,40 +45,201 @@ tape( 'the function applies a provided callback to broadcasted input arrays and var u; shapes = [ - [ 1, 1, 1, 2, 1 ], - [ 1, 1, 1, 2, 1 ], - [ 1, 1, 1, 1, 1 ], - [ 1, 1, 1, 1, 1 ], - [ 1, 1, 1, 1, 2 ], - [ 1, 1, 1, 2, 2 ] + [ 2 ], + [ 2, 1 ], + [ 1, 1 ], + [ 1 ], + [ 1, 2 ], + [ 2, 2, 2, 2, 2 ] ]; - x = [ [ [ [ [ 1.0, 2.0 ] ] ] ] ] ; - y = [ [ [ [ [ 3.0 ] ] ], [ [ [ 4.0 ] ] ] ] ]; - z = [ [ [ [ [ 5.0 ] ] ] ] ]; - w = [ [ [ [ [ 1.0 ] ] ] ] ]; - u = [ [ [ [ [ 1.0, 2.0 ] ] ] ] ]; + x = [ 1.0, 2.0 ] ; + y = [ + [ 3.0 ], + [ 4.0 ] + ]; + z = [ [ 5.0 ] ]; + w = [ 1.0 ]; + u = [ [ 1.0, 2.0 ] ] ; out = zeros5d( shapes[ 5 ] ); - expected = [ [ [ [ [ 11.0, 13.0] ] ], [ [ [ 12.0, 14.0] ] ] ] ]; + expected = [ + [ + [ + [ + [ 4.0, 5.0 ], + [ 5.0, 6.0 ] + ], + [ + [ 4.0, 5.0 ], + [ 5.0, 6.0 ] + ] + ], + [ + [ + [ 4.0, 5.0 ], + [ 5.0, 6.0 ] + ], + [ + [ 4.0, 5.0 ], + [ 5.0, 6.0 ] + ] + ] + ], + [ + [ + [ + [ 4.0, 5.0 ], + [ 5.0, 6.0 ] + ], + [ + [ 4.0, 5.0 ], + [ 5.0, 6.0 ] + ] + ], + [ + [ + [ 4.0, 5.0 ], + [ 5.0, 6.0 ] + ], + [ + [ 4.0, 5.0 ], + [ 5.0, 6.0 ] + ] + ] + ] + ]; + bbinary5d( [ x, y, z ], shapes, add ); + t.deepEqual( z, expected, 'returns expected value' ); + + shapes = [ + [ 1, 2 ], + [ 2 ], + [ 2, 2, 2, 2, 2 ] + ]; + x = [ + [ 1.0, 2.0 ] + ]; + y = [ 3.0, 4.0 ]; + z = zeros5d( shapes[ 2 ] ); + + expected = [ + [ + [ + [ + [ 11.0, 13.0 ], + [ 12.0, 14.0 ] + ], + [ + [ 11.0, 13.0 ], + [ 12.0, 14.0 ] + ] + ], + [ + [ + [ 11.0, 13.0 ], + [ 12.0, 14.0 ] + ], + [ + [ 11.0, 13.0 ], + [ 12.0, 14.0 ] + ] + ] + ], + [ + [ + [ + [ 11.0, 13.0 ], + [ 12.0, 14.0 ] + ], + [ + [ 11.0, 13.0 ], + [ 12.0, 14.0 ] + ] + ], + [ + [ + [ 11.0, 13.0 ], + [ 12.0, 14.0 ] + ], + [ + [ 11.0, 13.0 ], + [ 12.0, 14.0 ] + ] + ] + ] + ]; bquinary5d( [ x, y, z, w, u, out ], shapes, add ); t.deepEqual( out, expected, 'returns expected value' ); shapes = [ - [ 1, 1, 1, 1, 2 ], - [ 1, 1, 1, 2, 1 ], - [ 1, 1, 1, 1, 1 ], - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 2, 1 ], - [ 1, 1, 1, 2, 2 ] - ]; - x = [ [ [ [ [ 1.0, 2.0 ] ] ] ] ]; - y = [ [ [ [ [ 3.0, 4.0 ] ] ] ] ]; - z = [ [ [ [ [ 5.0 ] ] ] ] ]; - w = [ [ [ [ [ 2.0, 3.0 ] ], [ [ 4.0, 5.0 ] ] ] ] ]; - u = [ [ [ [ [ 1.0 ] ], [ [ 2.0 ] ] ] ] ]; + [ 1, 2 ], + [ 2 ], + [ 1 ], + [ 2, 2 ], + [ 2, 1 ], + [ 2, 2, 2, 2, 2 ] + ]; + x = [ + [ 1.0, 2.0 ] + ]; + y = [ 3.0, 4.0 ]; + z = [ 5.0 ]; + w = [ + [ 2.0, 3.0 ], + [ 4.0, 5.0 ] + ]; + u = [ + [ 1.0 ] , + [ 2.0 ] + ]; out = zeros5d( shapes[ 5 ] ); - expected = [ [ [ [ [ 12.0, 15.0 ], [ 15.0, 18.0 ] ] ] ] ]; + expected = [ + [ + [ + [ + [ 12.0, 15.0 ], + [ 15.0, 18.0 ] + ], + [ + [ 12.0, 15.0 ], + [ 15.0, 18.0 ] + ] + ], + [ + [ + [ 12.0, 15.0 ], + [ 15.0, 18.0 ] + ], + [ + [ 12.0, 15.0 ], + [ 15.0, 18.0 ] + ] + ] + ], + [ + [ + [ + [ 12.0, 15.0 ], + [ 15.0, 18.0 ] + ], + [ + [ 12.0, 15.0 ], + [ 15.0, 18.0 ] + ] + ], + [ + [ + [ 12.0, 15.0 ], + [ 15.0, 18.0 ] + ], + [ + [ 12.0, 15.0 ], + [ 15.0, 18.0 ] + ] + ] + ] + ]; bquinary5d( [ x, y, z, w, u, out ], shapes, add ); t.deepEqual( out, expected, 'returns expected value' ); @@ -108,32 +252,152 @@ tape( 'the function applies a provided callback to broadcasted input arrays and [ 2, 2, 2, 2, 2 ], [ 2, 2, 2, 2, 2 ] ]; - x = [ [ - [ [ [ 1.0, 2.0 ] ] ], - [ [ [ 3.0, 4.0 ] ] ] - ] ]; - y = [ [ - [ [ [ 1.0, 2.0 ] ] ], - [ [ [ 3.0, 4.0 ] ] ] - ] ]; - z = [ [ - [ [ [ 1.0, 2.0 ] ] ], - [ [ [ 3.0, 4.0 ] ] ] - ] ]; - w = [ [ - [ [ [ 1.0, 2.0 ] ] ], - [ [ [ 3.0, 4.0 ] ] ] - ] ]; - u = [ [ - [ [ [ 1.0, 2.0 ] ] ], - [ [ [ 3.0, 4.0 ] ] ] - ] ]; + 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 = zeros5d( shapes[ 5 ] ); - expected = [ [ - [ [ [ 5.0, 10.0 ] ] ], - [ [ [ 15.0, 20.0 ] ] ] - ] ]; + 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 ] + ] + ] + ] + ]; bquinary5d( [ x, y, z, w, u, out ], shapes, add ); t.deepEqual( out, expected, 'returns expected value' ); @@ -152,14 +416,23 @@ 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, 2, 2, 2, 2 ], - [ 2, 2, 2, 2, 2 ], + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 2 ], [ 0, 2, 2, 2, 2 ] ]; - x = [ [ [ [ [ 1.0, 2.0 ] ], [ [ 3.0, 4.0 ] ] ] ] ]; + x = [ + [ + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] + ] + ]; y = x; z = x; w = x; @@ -177,6 +450,141 @@ 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 ) { + var expected; + var shapes; + var out; + var x; + var y; + var z; + var w; + var u; + + shapes = [ + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 2 ], + [ 2, 0, 2, 2, 2 ] + ]; + x = [ + [ + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] + ] + ]; + y = x; + z = x; + w = x; + u = x; + out = zeros5d( [ 2, 2, 2, 2, 2 ] ); + + expected = zeros5d( [ 2, 2, 2, 2, 2 ] ); + bquinary5d( [ x, y, z, w, u, out ], shapes, clbk ); + t.deepEqual( z, 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 third element equal to zero', function test( t ) { + var expected; + var shapes; + var out; + var x; + var y; + var z; + var w; + var u; + + shapes = [ + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 2 ], + [ 2, 2, 0, 2, 2 ] + ]; + x = [ + [ + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] + ] + ]; + y = x; + z = x; + w = x; + u = x; + out = zeros5d( [ 2, 2, 2, 2, 2 ] ); + + expected = zeros5d( [ 2, 2, 2, 2, 2 ] ); + bquinary5d( [ x, y, z, w, u, out ], shapes, clbk ); + t.deepEqual( z, 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 four element equal to zero', function test( t ) { + var expected; + var shapes; + var out; + var x; + var y; + var z; + var w; + var u; + + shapes = [ + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 2 ], + [ 2, 2, 2, 0, 2 ] + ]; + x = [ + [ + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] + ] + ]; + y = x; + z = x; + w = x; + u = x; + out = zeros5d( [ 2, 2, 2, 2, 2 ] ); + + expected = zeros5d( [ 2, 2, 2, 2, 2 ] ); + bquinary5d( [ x, y, z, w, u, out ], shapes, clbk ); + t.deepEqual( z, 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 fifth element equal to zero', function test( t ) { var expected; var shapes; @@ -188,14 +596,23 @@ 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, 2, 2, 2, 2 ], - [ 2, 2, 2, 2, 2 ], + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 2 ], [ 2, 2, 2, 2, 0 ] ]; - x = [ [ [ [ [ 1.0, 2.0 ] ], [ [ 3.0, 4.0 ] ] ] ] ]; + x = [ + [ + [ + [ + [ 1.0, 2.0 ] , + [ 3.0, 4.0 ] + ] + ] + ] + ]; y= x; z = x; w = x; From b61ed92c277f37fa26db8dc8fbe00188cef20ab2 Mon Sep 17 00:00:00 2001 From: Athan Date: Tue, 10 Dec 2024 21:03:17 -0800 Subject: [PATCH 16/29] chore: revert change Signed-off-by: Athan --- CONTRIBUTORS | 1 - 1 file changed, 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index b2ba38784ac6..2024aac10965 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -59,7 +59,6 @@ Mohammad Kaif <98884589+Kaif987@users.noreply.github.com> Momtchil Momtchev Muhammad Haris Naresh Jagadeesan -Neeraj Pathak NightKnight Nithin Katta <88046362+nithinkatta@users.noreply.github.com> Nourhan Hasan <109472010+TheNourhan@users.noreply.github.com> From ce38e7cf36868b194ea7eacf2f9d3a9bb59d3ea4 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Wed, 11 Dec 2024 05:06:59 +0000 Subject: [PATCH 17/29] fix: resolve lint errors --- .../benchmark/benchmark.js | 18 +-- .../broadcasted-quinary5D/examples/index.js | 12 +- .../base/broadcasted-quinary5D/package.json | 2 +- .../base/broadcasted-quinary5D/test/test.js | 152 +++++++++--------- 4 files changed, 92 insertions(+), 92 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/benchmark/benchmark.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/benchmark/benchmark.js index e48523aaff9c..f79921041bc3 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/benchmark/benchmark.js @@ -25,7 +25,7 @@ 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 add = require( '@stdlib/math/base/ops/add5' ) +var add = require( '@stdlib/math/base/ops/add5' ); var filled5dBy = require( '@stdlib/array/base/filled2d-by' ); var zeros5d = require( '@stdlib/array/base/zeros2d' ); var numel = require( '@stdlib/ndarray/base/numel' ); @@ -80,17 +80,17 @@ function createBenchmark( shape ) { function benchmark( b ) { var i0; var i1; - var i2; - var i3; - var i4; + var i2; + var i3; + var i4; var i; b.tic(); for ( i = 0; i < b.iterations; i++ ) { bquinary5d( arrays, shapes, add ); - i4 = i % shapes[ 5 ][ 4 ]; - i3 = i % shapes[ 5 ][ 3 ]; - i2 = i % shapes[ 5 ][ 2 ]; + i4 = i % shapes[ 5 ][ 4 ]; + i3 = i % shapes[ 5 ][ 3 ]; + i2 = i % shapes[ 5 ][ 2 ]; i1 = i % shapes[ 5 ][ 1 ]; i0 = i % shapes[ 5 ][ 0 ]; if ( isnan( arrays[ 5 ][ i0 ][ i1 ][ i2 ][ i3 ][ i4 ] ) ) { @@ -100,8 +100,8 @@ function createBenchmark( shape ) { b.toc(); i4 = i % shapes[ 5 ][ 4 ]; - i3 = i % shapes[ 5 ][ 3 ]; - i2 = i % shapes[ 5 ][ 2 ]; + i3 = i % shapes[ 5 ][ 3 ]; + i2 = i % shapes[ 5 ][ 2 ]; i1 = i % shapes[ 5 ][ 1 ]; i0 = i % shapes[ 5 ][ 0 ]; if ( isnan( arrays[ 5 ][ i0 ][ i1 ][ i2 ][ i3 ][ i4 ] ) ) { diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/examples/index.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/examples/index.js index 09740d8342c7..dfc48557192f 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/examples/index.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/examples/index.js @@ -25,12 +25,12 @@ var bquinary5d = require( './../lib' ); var add = require( '@stdlib/math/base/ops/add5' ); var shapes = [ - [ 1, 1, 1, 1, 3 ], - [ 1, 1, 3, 1, 1 ], - [ 1, 1, 3, 3, 3 ], - [ 1, 1, 1, 1, 3 ], - [ 3, 3, 3, 3, 3 ], - [ 3, 3, 3, 3, 3 ] + [ 1, 1, 1, 1, 3 ], + [ 1, 1, 3, 1, 1 ], + [ 1, 1, 3, 3, 3 ], + [ 1, 1, 1, 1, 3 ], + [ 3, 3, 3, 3, 3 ], + [ 3, 3, 3, 3, 3 ] ]; var x = filled5dBy( shapes[ 0 ], discreteUniform( -100, 100 ) ); diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/package.json b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/package.json index 0f6517c1bfdd..0c151f741d7d 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/package.json +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/package.json @@ -65,4 +65,4 @@ ], "__stdlib__": {} } - \ No newline at end of file + diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js index b9933a9bc4a8..c7aaa35248df 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js @@ -21,7 +21,7 @@ // MODULES // var tape = require( 'tape' ); -var add =require( '@stdlib/math/base/ops/add5') +var add =require( '@stdlib/math/base/ops/add5' ); var zeros5d = require( '@stdlib/array/base/zeros5d' ); var bquinary5d = require( './../lib' ); @@ -45,22 +45,22 @@ tape( 'the function applies a provided callback to broadcasted input arrays and var u; shapes = [ - [ 2 ], + [ 2 ], [ 2, 1 ], [ 1, 1 ], [ 1 ], [ 1, 2 ], - [ 2, 2, 2, 2, 2 ] - ]; - x = [ 1.0, 2.0 ] ; - y = [ - [ 3.0 ], - [ 4.0 ] - ]; - z = [ [ 5.0 ] ]; - w = [ 1.0 ]; - u = [ [ 1.0, 2.0 ] ] ; - out = zeros5d( shapes[ 5 ] ); + [ 2, 2, 2, 2, 2 ] + ]; + x = [ 1.0, 2.0 ]; + y = [ + [ 3.0 ], + [ 4.0 ] + ]; + z = [ [ 5.0 ] ]; + w = [ 1.0 ]; + u = [ [ 1.0, 2.0 ] ]; + out = zeros5d( shapes[ 5 ] ); expected = [ [ @@ -167,30 +167,30 @@ tape( 'the function applies a provided callback to broadcasted input arrays and ] ] ] - ]; - bquinary5d( [ x, y, z, w, u, out ], shapes, add ); + ]; + bquinary5d( [ x, y, z, w, u, out ], shapes, add ); t.deepEqual( out, expected, 'returns expected value' ); shapes = [ - [ 1, 2 ], + [ 1, 2 ], [ 2 ], [ 1 ], [ 2, 2 ], [ 2, 1 ], [ 2, 2, 2, 2, 2 ] ]; - x = [ - [ 1.0, 2.0 ] - ]; + x = [ + [ 1.0, 2.0 ] + ]; y = [ 3.0, 4.0 ]; z = [ 5.0 ]; - w = [ - [ 2.0, 3.0 ], - [ 4.0, 5.0 ] - ]; - u = [ - [ 1.0 ] , - [ 2.0 ] + w = [ + [ 2.0, 3.0 ], + [ 4.0, 5.0 ] + ]; + u = [ + [ 1.0 ], + [ 2.0 ] ]; out = zeros5d( shapes[ 5 ] ); @@ -239,8 +239,8 @@ tape( 'the function applies a provided callback to broadcasted input arrays and ] ] ] - ]; - bquinary5d( [ x, y, z, w, u, out ], shapes, add ); + ]; + bquinary5d( [ x, y, z, w, u, out ], shapes, add ); t.deepEqual( out, expected, 'returns expected value' ); //Same shapes: @@ -251,8 +251,8 @@ 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 ] - ]; - x = [ + ]; + x = [ [ [ [ @@ -276,7 +276,7 @@ tape( 'the function applies a provided callback to broadcasted input arrays and ] ] ]; - y = [ + y = [ [ [ [ @@ -300,7 +300,7 @@ tape( 'the function applies a provided callback to broadcasted input arrays and ] ] ]; - z = [ + z = [ [ [ [ @@ -324,7 +324,7 @@ tape( 'the function applies a provided callback to broadcasted input arrays and ] ] ]; - w = [ + w = [ [ [ [ @@ -348,7 +348,7 @@ tape( 'the function applies a provided callback to broadcasted input arrays and ] ] ]; - u = [ + u = [ [ [ [ @@ -372,9 +372,9 @@ tape( 'the function applies a provided callback to broadcasted input arrays and ] ] ]; - out = zeros5d( shapes[ 5 ] ); + out = zeros5d( shapes[ 5 ] ); - expected = [ + expected = [ [ [ [ @@ -398,8 +398,8 @@ tape( 'the function applies a provided callback to broadcasted input arrays and ] ] ]; - bquinary5d( [ x, y, z, w, u, out ], shapes, add ); - t.deepEqual( out, expected, 'returns expected value' ); + bquinary5d( [ x, y, z, w, u, out ], shapes, add ); + t.deepEqual( out, expected, 'returns expected value' ); t.end(); }); @@ -423,19 +423,19 @@ tape( 'the function does not invoke a provided callback if provided an output sh [ 1, 1, 1, 2, 2 ], [ 0, 2, 2, 2, 2 ] ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ], - [ 3.0, 4.0 ] - ] - ] - ] - ]; - y = x; - z = x; - w = x; + x = [ + [ + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] + ] + ]; + y = x; + z = x; + w = x; u = x; out = zeros5d( [ 2, 2, 2, 2, 2 ] ); @@ -479,8 +479,8 @@ tape( 'the function does not invoke a provided callback if provided an output sh ] ]; y = x; - z = x; - w = x; + z = x; + w = x; u = x; out = zeros5d( [ 2, 2, 2, 2, 2 ] ); @@ -524,8 +524,8 @@ tape( 'the function does not invoke a provided callback if provided an output sh ] ]; y = x; - z = x; - w = x; + z = x; + w = x; u = x; out = zeros5d( [ 2, 2, 2, 2, 2 ] ); @@ -569,8 +569,8 @@ tape( 'the function does not invoke a provided callback if provided an output sh ] ]; y = x; - z = x; - w = x; + z = x; + w = x; u = x; out = zeros5d( [ 2, 2, 2, 2, 2 ] ); @@ -596,26 +596,26 @@ tape( 'the function does not invoke a provided callback if provided an output sh var u; shapes = [ - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 2, 2 ], - [ 2, 2, 2, 2, 0 ] + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 1, 2, 2 ], + [ 2, 2, 2, 2, 0 ] + ]; + x = [ + [ + [ + [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ] + ] + ] ]; - x = [ - [ - [ - [ - [ 1.0, 2.0 ] , - [ 3.0, 4.0 ] - ] - ] - ] - ]; - y= x; - z = x; - w = x; + y= x; + z = x; + w = x; u = x; out = zeros5d( [ 2, 2, 2, 2, 2 ] ); From 43052e310653e614b86c36c49b8323e9e97032a8 Mon Sep 17 00:00:00 2001 From: Athan Date: Tue, 10 Dec 2024 21:09:59 -0800 Subject: [PATCH 18/29] Apply suggestions from code review Signed-off-by: Athan --- .../@stdlib/array/base/broadcasted-quinary5D/test/test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js index c7aaa35248df..94ce6f0b72b3 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js @@ -243,7 +243,7 @@ tape( 'the function applies a provided callback to broadcasted input arrays and bquinary5d( [ x, y, z, w, u, out ], shapes, add ); t.deepEqual( out, expected, 'returns expected value' ); - //Same shapes: + // Same shapes: shapes = [ [ 2, 2, 2, 2, 2 ], [ 2, 2, 2, 2, 2 ], @@ -540,7 +540,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 four 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; From aae9bf26eac2f322a31b5d8e4f64af0a88b33333 Mon Sep 17 00:00:00 2001 From: Athan Date: Tue, 10 Dec 2024 22:03:06 -0800 Subject: [PATCH 19/29] test: fix symbol name Signed-off-by: Athan --- .../@stdlib/array/base/broadcasted-quinary5D/test/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js index 94ce6f0b72b3..78fef57a3cfe 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js @@ -108,7 +108,7 @@ tape( 'the function applies a provided callback to broadcasted input arrays and ] ] ]; - bbinary5d( [ x, y, z ], shapes, add ); + bquinary5d( [ x, y, z ], shapes, add ); t.deepEqual( z, expected, 'returns expected value' ); shapes = [ From 94fe43d75aa0f651eb3e47adb11c4a6f3bf28847 Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Sat, 14 Dec 2024 17:31:36 +0600 Subject: [PATCH 20/29] "added changes" --- .../benchmark/benchmark.js | 2 +- .../docs/types/index.d.ts | 10 ++-- .../base/broadcasted-quinary5D/lib/main.js | 48 +++++++++---------- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-binary5d/benchmark/benchmark.js b/lib/node_modules/@stdlib/array/base/broadcasted-binary5d/benchmark/benchmark.js index 0cdf9ed47cd3..85819f6db830 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-binary5d/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-binary5d/benchmark/benchmark.js @@ -87,7 +87,7 @@ function createBenchmark( shape ) { if ( isnan( arrays[ 2 ][ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { b.fail( 'should not return NaN' ); } - } + } b.toc(); i4 = i % shapes[ 1 ][ 0 ]; diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/index.d.ts b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/index.d.ts index 73dfbf3bd19a..e933b80863ee 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/index.d.ts @@ -100,11 +100,11 @@ type InOutShapes = [ * } * * var shapes = [ -* [ 1, 1, 1, 2, 2 ], -* [ 1, 1, 2, 1, 2 ], -* [ 1, 1, 1, 1, 1 ], -* [ 1, 1, 1, 1, 1 ], -* [ 1, 1, 1, 1, 1 ], +* [ 1, 1, 1, 2, 2 ], +* [ 1, 1, 2, 1, 2 ], +* [ 1, 1, 1, 1, 1 ], +* [ 1, 1, 1, 1, 1 ], +* [ 1, 1, 1, 1, 1 ], * [ 1, 1, 2, 2, 2 ] * ]; * diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/main.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/main.js index 6247c8adcd89..1dd3384564d1 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/main.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/main.js @@ -203,48 +203,48 @@ function bquinary5d( arrays, shapes, fcn ) { m3 = 0; n3 = 0; p3 = 0; - x0 = x[ j4 ]; - y0 = y[ k4 ]; - z0 = z[ m4 ]; - w0 = w[ n4 ]; - u0 = u[ p4 ]; - v0 = v[ i4 ]; + x3 = x[ j4 ]; + y3 = y[ k4 ]; + z3 = z[ m4 ]; + w3 = w[ n4 ]; + u3 = u[ p4 ]; + v3 = v[ i4 ]; for ( i3 = 0; i3 < S3; i3++ ) { j2 = 0; k2 = 0; m2 = 0; n2 = 0; p2 = 0; - x0 = x0[ j3 ]; - y0 = y0[ k3 ]; - z0 = z0[ m3 ]; - w0 = w0[ n3 ]; - u0 = u0[ p3 ]; - v0 = v0[ i3 ]; + x2 = x3[ j3 ]; + y2 = y3[ k3 ]; + z2 = z3[ m3 ]; + w2 = w3[ n3 ]; + u2 = u3[ p3 ]; + v2 = v3[ i3 ]; for ( i2 = 0; i2 < S2; i2++ ) { j1 = 0; k1 = 0; m1 = 0; n1 = 0; p1 = 0; - x0 = x0[ j2 ]; - y0 = y0[ k2 ]; - z0 = z0[ m2 ]; - w0 = w0[ n2 ]; - u0 = u0[ p2 ]; - v0 = v0[ i2 ]; + 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 = x0[ j1 ]; - y0 = y0[ k1 ]; - z0 = z0[ m1 ]; - w0 = w0[ n1 ]; - u0 = u0[ p1 ]; - v0 = v0[ i1 ]; + 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 ] ); j0 += dx0; From f4637163b72c88159d763fb4a65279b0c05a4d30 Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Sat, 14 Dec 2024 17:42:46 +0600 Subject: [PATCH 21/29] "added changes" --- .../base/broadcasted-quinary5D/lib/main.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/main.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/main.js index 1dd3384564d1..fd8a79f49f69 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/main.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/main.js @@ -121,11 +121,29 @@ function bquinary5d( arrays, shapes, fcn ) { var p3; var p4; var x0; + var x1; + var x2; + var x3; var y0; + var y1; + var y2; + var y3; var z0; + var z1; + var z2; + var z3; var w0; + var w1; + var w2; + var w3; var u0; + var u1; + var u2; + var u3; var v0; + var v1; + var v2; + var v3; var sh; var st; var o; From 6d7e65e6a3a4b2a1e84bb8d2e68461f5ae4b7199 Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Sat, 14 Dec 2024 18:35:01 +0600 Subject: [PATCH 22/29] "added changes" --- .../base/broadcasted-quinary5D/README.md | 24 +++--- .../benchmark/benchmark.js | 8 +- .../base/broadcasted-quinary5D/docs/repl.txt | 8 +- .../docs/types/index.d.ts | 12 +-- .../broadcasted-quinary5D/docs/types/test.ts | 60 +++++++------- .../broadcasted-quinary5D/examples/index.js | 12 +-- .../base/broadcasted-quinary5D/lib/index.js | 8 +- .../base/broadcasted-quinary5D/lib/main.js | 24 +++--- .../base/broadcasted-quinary5D/test/test.js | 79 ++++++++++--------- 9 files changed, 121 insertions(+), 114 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/README.md b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/README.md index 5445bd71b183..be5ae277e66d 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/README.md +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/README.md @@ -48,8 +48,8 @@ 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 = zeros5d( [ 2, 2, 2, 2, 2 ] ); +var u = [ [ 1.0 ] ]; +var v = zeros5d( [ 2, 2, 2, 2, 2 ] ); var shapes = [ [ 1, 2 ], @@ -60,8 +60,8 @@ var shapes = [ [ 2, 2, 2, 2, 2 ] ]; -bquinary5d( [ x, y, z, w, v, out ], shapes, add ); -// out => [ [ [ [ [ 12.0, 13.0 ] , [ 13.0, 14.0 ] ] , [ [ 12.0, 13.0 ] , [ 13.0, 14.0 ] ] ] ] ] +bquinary5d( [ x, y, z, w, u, v ], shapes, add ); +// v => [ [ [ [ [ 12.0, 13.0 ] , [ 13.0, 14.0 ] ] , [ [ 12.0, 13.0 ] , [ 13.0, 14.0 ] ] ] ] ] ``` @@ -97,8 +97,8 @@ var filled5dBy = require( '@stdlib/array/base/filled5d-by' ); var zeros5d = require( '@stdlib/array/base/zeros5d' ); var bquinary5d = require( '@stdlib/array/base/broadcasted-quinary5d' ); -function add( x, y, z, w, v ) { - return x + y + z + w + v; +function add( x, y, z, w, u ) { + return x + y + z + w + u; } var shapes = [ @@ -122,14 +122,14 @@ console.log( z ); var w = filled5dBy( shapes[ 3 ], discreteUniform( -100, 100 ) ); console.log( w ); -var v = filled5dBy( shapes[ 4 ], discreteUniform( -100, 100 ) ); -console.log( v ); +var u = filled5dBy( shapes[ 4 ], discreteUniform( -100, 100 ) ); +console.log( u ); -var out = zeros5d( shapes[ 5 ] ); -console.log( out ); +var v = zeros5d( shapes[ 5 ] ); +console.log( v ); -bquinary5d( [ x, y, z, w, v, out ], shapes, add ); -console.log( out ); +bquinary5d( [ x, y, z, w, u, v ], shapes, add ); +console.log( v ); ``` diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/benchmark/benchmark.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/benchmark/benchmark.js index f79921041bc3..57af1799aa18 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/benchmark/benchmark.js @@ -45,11 +45,11 @@ var bquinary5d = require( './../lib' ); function createBenchmark( shape ) { var arrays; var shapes; - var out; var x; var y; var z; var w; + var u; var v; shapes = [ @@ -64,10 +64,10 @@ function createBenchmark( shape ) { y = filled5dBy( shapes[ 1 ], uniform( -100.0, 100.0 ) ); z = filled5dBy( shapes[ 2 ], uniform( -100.0, 100.0 ) ); w = filled5dBy( shapes[ 3 ], uniform( -100.0, 100.0 ) ); - v = filled5dBy( shapes[ 4 ], uniform( -100.0, 100.0 ) ); - out = zeros5d( shapes[ 5 ] ); + u = filled5dBy( shapes[ 4 ], uniform( -100.0, 100.0 ) ); + v = zeros5d( shapes[ 5 ] ); - arrays = [ x, y, z, w, v, out ]; + arrays = [ x, y, z, w, u, v ]; return benchmark; diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/repl.txt b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/repl.txt index dda95424119b..8c45106e8211 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/repl.txt +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/repl.txt @@ -17,15 +17,15 @@ Examples -------- - > function fcn( x, y, z, w, v ) { return x + y + z + w + v; }; + > function fcn( x, y, z, w, u ) { return x + y + z + w + u; }; > 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 u = [ 1.0 ]; + > var v = [ [ [ [ [ 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 ); + > {{alias}}( [ x, y, z, w, u, v ], shapes, fcn ); > out [ [ [ [ [ 8.0, 9.0 ] ], [ [ 9.0, 10.0 ] ] ] ] ] diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/index.d.ts b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/index.d.ts index e933b80863ee..99e6912ceefa 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/index.d.ts @@ -95,8 +95,8 @@ type InOutShapes = [ * var zeros5d = require( '@stdlib/array/base/zeros5d' ); * var add = require( '@stdlib/math/base/ops/add5); * -* function add( x, y, z, w, v ) { -* return x + y + z + w + v; +* function add( x, y, z, w, u ) { +* return x + y + z + w + u; * } * * var shapes = [ @@ -112,12 +112,12 @@ type InOutShapes = [ * var y = ones5d( shapes[ 1 ] ); * var z = ones5d( shapes[ 2 ] ); * var w = ones5d( shapes[ 3 ] ); -* var v = ones5d( shapes[ 4 ] ); -* var out = zeros5d( shapes[ 5 ] ); +* var u = ones5d( shapes[ 4 ] ); +* var v = zeros5d( shapes[ 5 ] ); * -* bquinary5d( [ x, y, z, w, v, out ], shapes, add ); +* bquinary5d( [ x, y, z, w, u, v ], shapes, add ); * -* console.log( out ); +* console.log( v ); * // => [ [ [ [ [ 2.0, 2.0 ] ], [ [ 2.0, 2.0 ] ] ] ], [ [ [ [ 2.0, 2.0 ] ], [ [ 2.0, 2.0 ] ] ] ] ] */ declare function bquinary5d( arrays: InOutArrays, shapes: InOutShapes, fcn: Quinary ): void; diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/test.ts b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/test.ts index 79d8f442013b..74b8589226a0 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/test.ts +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/test.ts @@ -25,11 +25,11 @@ import bquinary5d = require( './index' ); * @param y - input value * @param z - input value * @param w - input value -* @param v - input value +* @param u - input value * @returns result */ -function fcn( x: number, y: number, z: number, w: number, v: number ): number { - return x + y + z + w + v; +function fcn( x: number, y: number, z: number, w: number, u: number ): number { + return x + y + z + w + u; } /** @@ -46,13 +46,13 @@ type InOutShapes = [ Array, Array, Array, Array, 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 u = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; + const v = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; const shapes: InOutShapes = [ [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ] ]; - bquinary5d( [ x, y, z, w, v, out ], shapes, fcn ); // $ExpectType void - bquinary5d( [ x, y, z, w, v, out ], [ [ shapes[ 0 ][ 4 ] ], shapes[ 1 ], shapes[ 2 ], shapes[ 3 ], shapes[ 4 ], shapes[ 5 ] ], fcn ); // $ExpectType void + bquinary5d( [ x, y, z, w, u, v ], shapes, fcn ); // $ExpectType void + bquinary5d( [ x, y, z, w, u, v ], [ [ shapes[ 0 ][ 4 ] ], 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... @@ -75,16 +75,16 @@ type InOutShapes = [ Array, Array, Array, Array, 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 ] ] ] ] ]; - bquinary5d( [ x, y, z, w, v, out ], 'abc', fcn ); // $ExpectError - bquinary5d( [ x, y, z, w, v, out ], 3.14, fcn ); // $ExpectError - bquinary5d( [ x, y, z, w, v, out ], true, fcn ); // $ExpectError - bquinary5d( [ x, y, z, w, v, out ], false, fcn ); // $ExpectError - bquinary5d( [ x, y, z, w, v, out ], null, fcn ); // $ExpectError - bquinary5d( [ x, y, z, w, v, out ], [ '1' ], fcn ); // $ExpectError - bquinary5d( [ x, y, z, w, v, out ], {}, fcn ); // $ExpectError - bquinary5d( [ x, y, z, w, v, out ], ( x: number ): number => x, fcn ); // $ExpectError + const u = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; + const v = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; + bquinary5d( [ x, y, z, w, u, v ], 'abc', fcn ); // $ExpectError + bquinary5d( [ x, y, z, w, u, v ], 3.14, fcn ); // $ExpectError + bquinary5d( [ x, y, z, w, u, v ], true, fcn ); // $ExpectError + bquinary5d( [ x, y, z, w, u, v ], false, fcn ); // $ExpectError + bquinary5d( [ x, y, z, w, u, v ], null, fcn ); // $ExpectError + bquinary5d( [ x, y, z, w, u, v ], [ '1' ], fcn ); // $ExpectError + bquinary5d( [ x, y, z, w, u, v ], {}, fcn ); // $ExpectError + bquinary5d( [ x, y, z, w, u, v ], ( 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... @@ -93,17 +93,17 @@ type InOutShapes = [ Array, Array, Array, Array, 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 u = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; + const v = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; const shapes: InOutShapes = [ [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ] ]; - bquinary5d( [ x, y, z, w, v, out ], shapes, 'abc' ); // $ExpectError - bquinary5d( [ x, y, z, w, v, out ], shapes, 3.14 ); // $ExpectError - bquinary5d( [ x, y, z, w, v, out ], shapes, true ); // $ExpectError - bquinary5d( [ x, y, z, w, v, out ], shapes, false ); // $ExpectError - bquinary5d( [ x, y, z, w, v, out ], shapes, null ); // $ExpectError - bquinary5d( [ x, y, z, w, v, out ], shapes, [ '1' ] ); // $ExpectError - bquinary5d( [ x, y, z, w, v, out ], shapes, {} ); // $ExpectError + bquinary5d( [ x, y, z, w, u, v ], shapes, 'abc' ); // $ExpectError + bquinary5d( [ x, y, z, w, u, v ], shapes, 3.14 ); // $ExpectError + bquinary5d( [ x, y, z, w, u, v ], shapes, true ); // $ExpectError + bquinary5d( [ x, y, z, w, u, v ], shapes, false ); // $ExpectError + bquinary5d( [ x, y, z, w, u, v ], shapes, null ); // $ExpectError + bquinary5d( [ x, y, z, w, u, v ], shapes, [ '1' ] ); // $ExpectError + bquinary5d( [ x, y, z, w, u, v ], shapes, {} ); // $ExpectError } // The compiler throws an error if the function is provided an unsupported number of arguments... @@ -112,11 +112,11 @@ type InOutShapes = [ Array, Array, Array, Array, 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 u = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; + const v = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; const shapes: InOutShapes = [ [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ] ]; bquinary5d(); // $ExpectError - bquinary5d( [ x, y, z, w, v, out ] ); // $ExpectError - bquinary5d( [ x, y, z, w, v, out ], shapes, fcn, {} ); // $ExpectError + bquinary5d( [ x, y, z, w, u, v ] ); // $ExpectError + bquinary5d( [ x, y, z, w, u, v ], shapes, fcn, {} ); // $ExpectError } diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/examples/index.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/examples/index.js index dfc48557192f..fb6730390c88 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/examples/index.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/examples/index.js @@ -45,11 +45,11 @@ console.log( z ); var w = filled5dBy( shapes[ 3 ], discreteUniform( -100, 100 ) ); console.log( w ); -var v = filled5dBy( shapes[ 4 ], discreteUniform( -100, 100 ) ); -console.log( v ); +var u = filled5dBy( shapes[ 4 ], discreteUniform( -100, 100 ) ); +console.log( u ); -var out = zeros5d( shapes[ 5 ] ); -console.log( out ); +var v = zeros5d( shapes[ 5 ] ); +console.log( v ); -bquinary5d( [ x, y, z, w, v, out ], shapes, add ); -console.log( out ); +bquinary5d( [ x, y, z, w, u, v ], shapes, add ); +console.log( v ); diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/index.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/index.js index f56ddb72df0c..7a4d29290828 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/index.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/index.js @@ -42,12 +42,12 @@ * var y = ones5d( shapes[ 1 ] ); * var z = ones5d( shapes[ 2 ] ); * var w = ones5d( shapes[ 3 ] ); -* var v = ones5d( shapes[ 4 ] ); -* var out = zeros5d( shapes[ 5 ] ); +* var u = ones5d( shapes[ 4 ] ); +* var v = zeros5d( shapes[ 5 ] ); * -* bquinary5d( [ x, y, z, w, v, out ], shapes, add ); +* bquinary5d( [ x, y, z, w, u, v ], shapes, add ); * -* console.log( out ); +* console.log( v ); * // => array of shape [2, 2, 2, 2, 2] filled with the value 5.0 */ diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/main.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/main.js index fd8a79f49f69..dde8ba46ab67 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/main.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/main.js @@ -51,12 +51,12 @@ var broadcastArray = require( '@stdlib/array/base/broadcast-array' ); * var y = ones5d( shapes[ 1 ] ); * var z = ones5d( shapes[ 2 ] ); * var w = ones5d( shapes[ 3 ] ); -* var v = ones5d( shapes[ 4 ] ); -* var out = zeros5d( shapes[ 5 ] ); +* var u = ones5d( shapes[ 4 ] ); +* var v = zeros5d( shapes[ 5 ] ); * -* bquinary5d( [ x, y, z, w, v, out ], shapes, add ); +* bquinary5d( [ x, y, z, w, u, v ], shapes, add ); * -* console.log( out ); +* console.log( v ); * // => [ [ [ [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ], [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] ] ] ] */ function bquinary5d( arrays, shapes, fcn ) { @@ -221,21 +221,21 @@ function bquinary5d( arrays, shapes, fcn ) { m3 = 0; n3 = 0; p3 = 0; - x3 = x[ j4 ]; - y3 = y[ k4 ]; + x3 = x[ j4 ]; + y3 = y[ k4 ]; z3 = z[ m4 ]; - w3 = w[ n4 ]; - u3 = u[ p4 ]; - v3 = v[ i4 ]; + w3 = w[ n4 ]; + u3 = u[ p4 ]; + v3 = v[ i4 ]; for ( i3 = 0; i3 < S3; i3++ ) { j2 = 0; k2 = 0; m2 = 0; n2 = 0; p2 = 0; - x2 = x3[ j3 ]; - y2 = y3[ k3 ]; - z2 = z3[ m3 ]; + x2 = x3[ j3 ]; + y2 = y3[ k3 ]; + z2 = z3[ m3 ]; w2 = w3[ n3 ]; u2 = u3[ p3 ]; v2 = v3[ i3 ]; diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js index 78fef57a3cfe..8bc5946e945b 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js @@ -37,12 +37,12 @@ tape( 'main export is a function', function test( t ) { 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; + var v; shapes = [ [ 2 ], @@ -60,7 +60,7 @@ tape( 'the function applies a provided callback to broadcasted input arrays and z = [ [ 5.0 ] ]; w = [ 1.0 ]; u = [ [ 1.0, 2.0 ] ]; - out = zeros5d( shapes[ 5 ] ); + v = zeros5d( shapes[ 5 ] ); expected = [ [ @@ -108,19 +108,26 @@ tape( 'the function applies a provided callback to broadcasted input arrays and ] ] ]; - bquinary5d( [ x, y, z ], shapes, add ); - t.deepEqual( z, expected, 'returns expected value' ); + bquinary5d( [ x, y, z, w, u, v ], shapes, add ); + t.deepEqual( v, expected, 'returns expected value' ); shapes = [ [ 1, 2 ], [ 2 ], + [ 1, 1 ], + [ 1 ], + [ 1, 2 ], [ 2, 2, 2, 2, 2 ] ]; - x = [ - [ 1.0, 2.0 ] + x = [ 1.0, 2.0 ]; + y = [ + [ 3.0 ], + [ 4.0 ] ]; - y = [ 3.0, 4.0 ]; - z = zeros5d( shapes[ 2 ] ); + z = [ [ 5.0 ] ]; + w = [ 1.0 ]; + u = [ [ 1.0, 2.0 ] ]; + v = zeros5d( shapes[ 5 ] ); expected = [ [ @@ -168,8 +175,8 @@ tape( 'the function applies a provided callback to broadcasted input arrays and ] ] ]; - bquinary5d( [ x, y, z, w, u, out ], shapes, add ); - t.deepEqual( out, expected, 'returns expected value' ); + bquinary5d( [ x, y, z, w, u, v ], shapes, add ); + t.deepEqual( v, expected, 'returns expected value' ); shapes = [ [ 1, 2 ], @@ -192,7 +199,7 @@ tape( 'the function applies a provided callback to broadcasted input arrays and [ 1.0 ], [ 2.0 ] ]; - out = zeros5d( shapes[ 5 ] ); + v = zeros5d( shapes[ 5 ] ); expected = [ [ @@ -240,8 +247,8 @@ tape( 'the function applies a provided callback to broadcasted input arrays and ] ] ]; - bquinary5d( [ x, y, z, w, u, out ], shapes, add ); - t.deepEqual( out, expected, 'returns expected value' ); + bquinary5d( [ x, y, z, w, u, v ], shapes, add ); + t.deepEqual( v, expected, 'returns expected value' ); // Same shapes: shapes = [ @@ -372,7 +379,7 @@ tape( 'the function applies a provided callback to broadcasted input arrays and ] ] ]; - out = zeros5d( shapes[ 5 ] ); + v = zeros5d( shapes[ 5 ] ); expected = [ [ @@ -398,8 +405,8 @@ tape( 'the function applies a provided callback to broadcasted input arrays and ] ] ]; - bquinary5d( [ x, y, z, w, u, out ], shapes, add ); - t.deepEqual( out, expected, 'returns expected value' ); + bquinary5d( [ x, y, z, w, u, v ], shapes, add ); + t.deepEqual( v, expected, 'returns expected value' ); t.end(); }); @@ -408,12 +415,12 @@ tape( 'the function applies a provided callback to broadcasted input arrays and 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; + var v; shapes = [ [ 1, 1, 1, 2, 2 ], @@ -437,11 +444,11 @@ tape( 'the function does not invoke a provided callback if provided an output sh z = x; w = x; u = x; - out = zeros5d( [ 2, 2, 2, 2, 2 ] ); + v = zeros5d( [ 2, 2, 2, 2, 2 ] ); expected = zeros5d( [ 2, 2, 2, 2, 2 ] ); - bquinary5d( [ x, y, z, w, u, out ], shapes, clbk ); - t.deepEqual( out, expected, 'returns expected value' ); + bquinary5d( [ x, y, z, w, u, v ], shapes, clbk ); + t.deepEqual( v, expected, 'returns expected value' ); t.end(); @@ -453,12 +460,12 @@ 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 ) { var expected; var shapes; - var out; var x; var y; var z; var w; var u; + var v; shapes = [ [ 1, 1, 1, 2, 2 ], @@ -482,11 +489,11 @@ tape( 'the function does not invoke a provided callback if provided an output sh z = x; w = x; u = x; - out = zeros5d( [ 2, 2, 2, 2, 2 ] ); + v = zeros5d( [ 2, 2, 2, 2, 2 ] ); expected = zeros5d( [ 2, 2, 2, 2, 2 ] ); - bquinary5d( [ x, y, z, w, u, out ], shapes, clbk ); - t.deepEqual( z, expected, 'returns expected value' ); + bquinary5d( [ x, y, z, w, u, v ], shapes, clbk ); + t.deepEqual( v, expected, 'returns expected value' ); t.end(); @@ -498,12 +505,12 @@ 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 third element equal to zero', function test( t ) { var expected; var shapes; - var out; var x; var y; var z; var w; var u; + var v; shapes = [ [ 1, 1, 1, 2, 2 ], @@ -527,11 +534,11 @@ tape( 'the function does not invoke a provided callback if provided an output sh z = x; w = x; u = x; - out = zeros5d( [ 2, 2, 2, 2, 2 ] ); + v = zeros5d( [ 2, 2, 2, 2, 2 ] ); expected = zeros5d( [ 2, 2, 2, 2, 2 ] ); - bquinary5d( [ x, y, z, w, u, out ], shapes, clbk ); - t.deepEqual( z, expected, 'returns expected value' ); + bquinary5d( [ x, y, z, w, u, v ], shapes, clbk ); + t.deepEqual( v, expected, 'returns expected value' ); t.end(); @@ -543,12 +550,12 @@ 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 fourth element equal to zero', function test( t ) { var expected; var shapes; - var out; var x; var y; var z; var w; var u; + var v; shapes = [ [ 1, 1, 1, 2, 2 ], @@ -572,11 +579,11 @@ tape( 'the function does not invoke a provided callback if provided an output sh z = x; w = x; u = x; - out = zeros5d( [ 2, 2, 2, 2, 2 ] ); + v = zeros5d( [ 2, 2, 2, 2, 2 ] ); expected = zeros5d( [ 2, 2, 2, 2, 2 ] ); - bquinary5d( [ x, y, z, w, u, out ], shapes, clbk ); - t.deepEqual( z, expected, 'returns expected value' ); + bquinary5d( [ x, y, z, w, u, v ], shapes, clbk ); + t.deepEqual( v, expected, 'returns expected value' ); t.end(); @@ -588,12 +595,12 @@ 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 fifth element equal to zero', function test( t ) { var expected; var shapes; - var out; var x; var y; var z; var w; var u; + var v; shapes = [ [ 1, 1, 1, 2, 2 ], @@ -617,11 +624,11 @@ tape( 'the function does not invoke a provided callback if provided an output sh z = x; w = x; u = x; - out = zeros5d( [ 2, 2, 2, 2, 2 ] ); + v = zeros5d( [ 2, 2, 2, 2, 2 ] ); expected = zeros5d( [ 2, 2, 2, 2, 2 ] ); - bquinary5d( [ x, y, z, w, u, out ], shapes, clbk ); - t.deepEqual( out, expected, 'returns expected value' ); + bquinary5d( [ x, y, z, w, u, v ], shapes, clbk ); + t.deepEqual( v, expected, 'returns expected value' ); t.end(); From 89e60d65439d2bdac722cea887b21ab3b369a430 Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Sat, 14 Dec 2024 19:01:50 +0600 Subject: [PATCH 23/29] "added changes" --- .../base/broadcasted-quinary5D/test/test.js | 39 +++++++++---------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js index 8bc5946e945b..74a07edb9844 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js @@ -66,44 +66,44 @@ tape( 'the function applies a provided callback to broadcasted input arrays and [ [ [ - [ 4.0, 5.0 ], - [ 5.0, 6.0 ] + [ 11, 13 ], + [ 12, 14 ] ], [ - [ 4.0, 5.0 ], - [ 5.0, 6.0 ] + [ 11, 13 ], + [ 12, 14 ] ] ], [ [ - [ 4.0, 5.0 ], - [ 5.0, 6.0 ] + [ 11, 13 ], + [ 12, 14 ] ], [ - [ 4.0, 5.0 ], - [ 5.0, 6.0 ] + [ 11, 13 ], + [ 12, 14 ] ] ] ], [ [ [ - [ 4.0, 5.0 ], - [ 5.0, 6.0 ] + [ 11, 13 ], + [ 12, 14 ] ], [ - [ 4.0, 5.0 ], - [ 5.0, 6.0 ] + [ 11, 13 ], + [ 12, 14 ] ] ], [ [ - [ 4.0, 5.0 ], - [ 5.0, 6.0 ] + [ 11, 13 ], + [ 12, 14 ] ], [ - [ 4.0, 5.0 ], - [ 5.0, 6.0 ] + [ 11, 13 ], + [ 12, 14 ] ] ] ] @@ -119,11 +119,8 @@ tape( 'the function applies a provided callback to broadcasted input arrays and [ 1, 2 ], [ 2, 2, 2, 2, 2 ] ]; - x = [ 1.0, 2.0 ]; - y = [ - [ 3.0 ], - [ 4.0 ] - ]; + x = [ [ 1.0, 2.0 ] ]; + y = [ 3.0, 4.0 ]; z = [ [ 5.0 ] ]; w = [ 1.0 ]; u = [ [ 1.0, 2.0 ] ]; From b3b6ff90f353f7169f03e22a06317a49dd66b49d Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Sat, 14 Dec 2024 19:18:41 +0600 Subject: [PATCH 24/29] "fixed something" --- .../base/broadcasted-quinary5D/test/test.js | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js index 74a07edb9844..b9f7e721e80a 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js @@ -130,44 +130,44 @@ tape( 'the function applies a provided callback to broadcasted input arrays and [ [ [ - [ 11.0, 13.0 ], - [ 12.0, 14.0 ] + [ 11.0, 14.0 ], + [ 11.0, 14.0 ] ], [ - [ 11.0, 13.0 ], - [ 12.0, 14.0 ] + [ 11.0, 14.0 ], + [ 11.0, 14.0 ] ] ], [ [ - [ 11.0, 13.0 ], - [ 12.0, 14.0 ] + [ 11.0, 14.0 ], + [ 11.0, 14.0 ] ], [ - [ 11.0, 13.0 ], - [ 12.0, 14.0 ] + [ 11.0, 14.0 ], + [ 11.0, 14.0 ] ] ] ], [ [ [ - [ 11.0, 13.0 ], - [ 12.0, 14.0 ] + [ 11.0, 14.0 ], + [ 11.0, 14.0 ] ], [ - [ 11.0, 13.0 ], - [ 12.0, 14.0 ] + [ 11.0, 14.0 ], + [ 11.0, 14.0 ] ] ], [ [ - [ 11.0, 13.0 ], - [ 12.0, 14.0 ] + [ 11.0, 14.0 ], + [ 11.0, 14.0 ] ], [ - [ 11.0, 13.0 ], - [ 12.0, 14.0 ] + [ 11.0, 14.0 ], + [ 11.0, 14.0 ] ] ] ] From 6f7811eff04ce7c85e4432eb661d425e223d44fc Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Sat, 14 Dec 2024 19:39:15 +0600 Subject: [PATCH 25/29] "added changes" --- .../@stdlib/array/base/broadcasted-quinary5D/test/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js index b9f7e721e80a..846f378aa7a6 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js @@ -417,7 +417,7 @@ tape( 'the function does not invoke a provided callback if provided an output sh var z; var w; var u; - var v; + var v; shapes = [ [ 1, 1, 1, 2, 2 ], From 8a17e15ecd449ef2c55c5516c3b338ad39eb7f5a Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Fri, 20 Dec 2024 21:49:43 +0600 Subject: [PATCH 26/29] "added changes" --- .../base/broadcasted-quinary5D/README.md | 46 +- .../benchmark/benchmark.js | 42 +- .../base/broadcasted-quinary5D/docs/repl.txt | 12 +- .../docs/types/index.d.ts | 22 +- .../broadcasted-quinary5D/docs/types/test.ts | 68 +- .../broadcasted-quinary5D/examples/index.js | 16 +- .../base/broadcasted-quinary5D/lib/index.js | 20 +- .../base/broadcasted-quinary5D/lib/main.js | 14 +- .../base/broadcasted-quinary5D/test/test.js | 605 +++++++++++++----- 9 files changed, 550 insertions(+), 295 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/README.md b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/README.md index be5ae277e66d..de11d5f99384 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/README.md +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/README.md @@ -44,23 +44,23 @@ Applies a quinary callback to elements in five [broadcasted][@stdlib/array/base/ var zeros5d = require( '@stdlib/array/base/zeros5d' ); var add = require( '@stdlib/math/base/add5' ); -var x = [ [ 1.0, 2.0 ] ]; -var y = [ [ 3.0 ] , [ 4.0 ] ]; -var z = [ [ 5.0 ] ]; -var w = [ [ 2.0 ] ]; -var u = [ [ 1.0 ] ]; -var v = zeros5d( [ 2, 2, 2, 2, 2 ] ); +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 = zeros5d( [ 2, 2, 2, 2, 2 ] ); var shapes = [ - [ 1, 2 ], - [ 2, 1 ], - [ 1, 1 ], - [ 1, 1 ], - [ 1, 1 ], + [ 1, 1, 1, 1, 2 ], + [ 1, 1, 1, 2, 1 ], + [ 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 1 ], + [ 1, 1, 1, 1, 1 ], [ 2, 2, 2, 2, 2 ] ]; -bquinary5d( [ x, y, z, w, u, v ], shapes, add ); +bquinary5d( [ x, y, z, w, v, out ], shapes, add ); // v => [ [ [ [ [ 12.0, 13.0 ] , [ 13.0, 14.0 ] ] , [ [ 12.0, 13.0 ] , [ 13.0, 14.0 ] ] ] ] ] ``` @@ -97,17 +97,17 @@ var filled5dBy = require( '@stdlib/array/base/filled5d-by' ); var zeros5d = require( '@stdlib/array/base/zeros5d' ); var bquinary5d = require( '@stdlib/array/base/broadcasted-quinary5d' ); -function add( x, y, z, w, u ) { - return x + y + z + w + u; +function add( x, y, z, w, v ) { + return x + y + z + w + v; } var shapes = [ [ 1, 1, 1, 1, 3 ], [ 1, 1, 1, 3, 1 ], - [ 1, 1, 1, 1, 1 ], [ 1, 1, 1, 3, 3 ], - [ 1, 1, 1, 1, 3 ], - [ 1, 1, 1, 3, 3 ] + [ 1, 1, 3, 1, 1 ], + [ 3, 3, 3, 3, 3 ], + [ 3, 3, 3, 3, 3 ] ]; var x = filled5dBy( shapes[ 0 ], discreteUniform( -100, 100 ) ); @@ -122,14 +122,14 @@ console.log( z ); var w = filled5dBy( shapes[ 3 ], discreteUniform( -100, 100 ) ); console.log( w ); -var u = filled5dBy( shapes[ 4 ], discreteUniform( -100, 100 ) ); -console.log( u ); - -var v = zeros5d( shapes[ 5 ] ); +var v = filled5dBy( shapes[ 4 ], discreteUniform( -100, 100 ) ); console.log( v ); -bquinary5d( [ x, y, z, w, u, v ], shapes, add ); -console.log( v ); +var out = zeros5d( shapes[ 5 ] ); +console.log( out ); + +bquinary5d( [ x, y, z, w, v, out ], shapes, add ); +console.log( out ); ``` diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/benchmark/benchmark.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/benchmark/benchmark.js index 57af1799aa18..c84812f94ed9 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/benchmark/benchmark.js @@ -45,29 +45,29 @@ var bquinary5d = require( './../lib' ); function createBenchmark( shape ) { var arrays; var shapes; + var out; var x; var y; var z; var w; - var u; var v; shapes = [ - [ 1, shape[ 1 ], shape[ 2 ], shape[ 3 ], shape[ 4 ] ], - [ shape[ 0 ], 1, shape[ 2 ], shape[ 3 ], shape[ 4 ] ], - [ shape[ 0 ], shape[ 1 ], 1, shape[ 3 ], shape[ 4 ] ], - [ shape[ 0 ], shape[ 1 ], shape[ 2 ], 1, shape[ 4 ] ], - [ shape[ 0 ], shape[ 1 ], shape[ 2 ], shape[ 3 ], 1 ], + [ 1, 1, 1, 1, shape[ 0 ] ], + [ 1, 1, 1, shape[ 1 ], 1 ], + [ 1, 1, 1, shape[ 2 ], shape[ 3 ] ], + [ 1, 1, shape[ 3 ], 1, 1 ], + [ shape[ 0 ], shape[ 1 ], shape[ 2 ], shape[ 3 ], shape[4] ], shape ]; x = filled5dBy( shapes[ 0 ], uniform( -100.0, 100.0 ) ); y = filled5dBy( shapes[ 1 ], uniform( -100.0, 100.0 ) ); z = filled5dBy( shapes[ 2 ], uniform( -100.0, 100.0 ) ); w = filled5dBy( shapes[ 3 ], uniform( -100.0, 100.0 ) ); - u = filled5dBy( shapes[ 4 ], uniform( -100.0, 100.0 ) ); - v = zeros5d( shapes[ 5 ] ); + v = filled5dBy( shapes[ 4 ], uniform( -100.0, 100.0 ) ); + out = zeros5d( shapes[ 5 ] ); - arrays = [ x, y, z, w, u, v ]; + arrays = [ x, y, z, w, v, out ]; return benchmark; @@ -88,23 +88,23 @@ function createBenchmark( shape ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { bquinary5d( arrays, shapes, add ); - i4 = i % shapes[ 5 ][ 4 ]; - i3 = i % shapes[ 5 ][ 3 ]; - i2 = i % shapes[ 5 ][ 2 ]; - i1 = i % shapes[ 5 ][ 1 ]; - i0 = i % shapes[ 5 ][ 0 ]; - if ( isnan( arrays[ 5 ][ i0 ][ i1 ][ i2 ][ i3 ][ i4 ] ) ) { + i4 = i % shapes[ 1 ][ 0 ]; + i3 = i % shapes[ 1 ][ 1 ]; + i2 = i % shapes[ 1 ][ 2 ]; + i1 = i % shapes[ 1 ][ 3 ]; + i0 = i % shapes[ 1 ][ 4 ]; + if ( isnan( arrays[ 5 ][ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { b.fail( 'should not return NaN' ); } } b.toc(); - i4 = i % shapes[ 5 ][ 4 ]; - i3 = i % shapes[ 5 ][ 3 ]; - i2 = i % shapes[ 5 ][ 2 ]; - i1 = i % shapes[ 5 ][ 1 ]; - i0 = i % shapes[ 5 ][ 0 ]; - if ( isnan( arrays[ 5 ][ i0 ][ i1 ][ i2 ][ i3 ][ i4 ] ) ) { + i4 = i % shapes[ 1 ][ 0 ]; + i3 = i % shapes[ 1 ][ 1 ]; + i2 = i % shapes[ 1 ][ 2 ]; + i1 = i % shapes[ 1 ][ 3 ]; + i0 = i % shapes[ 1 ][ 4 ]; + if ( isnan( arrays[ 5 ][ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { b.fail( 'should not return NaN' ); } b.pass( 'benchmark finished' ); diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/repl.txt b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/repl.txt index 8c45106e8211..e073cae3c05b 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/repl.txt +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/repl.txt @@ -17,15 +17,15 @@ Examples -------- - > function fcn( x, y, z, w, u ) { return x + y + z + w + u; }; + > 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 z = [ 1.0 ]; > var w = [ 2.0 ]; - > var u = [ 1.0 ]; - > var v = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - > var shapes = [ [ 2 ], [ 2, 1 ], [ 1, 1 ], [ 1 ], [ 1 ], [ 2, 2 ] ]; - > {{alias}}( [ x, y, z, w, u, v ], shapes, fcn ); + > 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, 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-quinary5D/docs/types/index.d.ts b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/index.d.ts index 99e6912ceefa..2d4e9b5a61e4 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/index.d.ts @@ -95,30 +95,30 @@ type InOutShapes = [ * var zeros5d = require( '@stdlib/array/base/zeros5d' ); * var add = require( '@stdlib/math/base/ops/add5); * -* function add( x, y, z, w, u ) { -* return x + y + z + w + u; +* function add( x, y, z, w, v ) { +* return x + y + z + w + v; * } * * var shapes = [ +* [ 1, 1, 1, 1, 2 ], +* [ 1, 1, 1, 2, 1 ], * [ 1, 1, 1, 2, 2 ], -* [ 1, 1, 2, 1, 2 ], -* [ 1, 1, 1, 1, 1 ], -* [ 1, 1, 1, 1, 1 ], -* [ 1, 1, 1, 1, 1 ], -* [ 1, 1, 2, 2, 2 ] +* [ 1, 1, 2, 1, 1 ], +* [ 2, 2, 2, 2, 2 ], +* [ 2, 2, 2, 2, 2 ] * ]; * * var x = ones5d( shapes[ 0 ] ); * var y = ones5d( shapes[ 1 ] ); * var z = ones5d( shapes[ 2 ] ); * var w = ones5d( shapes[ 3 ] ); -* var u = ones5d( shapes[ 4 ] ); -* var v = zeros5d( shapes[ 5 ] ); +* var v = ones5d( shapes[ 4 ] ); +* var out = zeros5d( shapes[ 5 ] ); * -* bquinary5d( [ x, y, z, w, u, v ], shapes, add ); +* bquinary5d( [ x, y, z, w, v, out ], shapes, add ); * * console.log( v ); -* // => [ [ [ [ [ 2.0, 2.0 ] ], [ [ 2.0, 2.0 ] ] ] ], [ [ [ [ 2.0, 2.0 ] ], [ [ 2.0, 2.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, 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 bquinary5d( arrays: InOutArrays, shapes: InOutShapes, fcn: Quinary ): void; diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/test.ts b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/test.ts index 74b8589226a0..699e7a5d9946 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/test.ts +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/docs/types/test.ts @@ -25,11 +25,11 @@ import bquinary5d = require( './index' ); * @param y - input value * @param z - input value * @param w - input value -* @param u - input value +* @param v - input value * @returns result */ -function fcn( x: number, y: number, z: number, w: number, u: number ): number { - return x + y + z + w + u; +function fcn( x: number, y: number, z: number, w: number, v: number ): number { + return x + y + z + w + v; } /** @@ -46,18 +46,18 @@ type InOutShapes = [ Array, Array, Array, Array, 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 u = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const v = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; + const v = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; + const out = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - const shapes: InOutShapes = [ [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ] ]; + 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, 2 ], [ 2, 2, 2, 2, 2 ] ]; - bquinary5d( [ x, y, z, w, u, v ], shapes, fcn ); // $ExpectType void - bquinary5d( [ x, y, z, w, u, v ], [ [ shapes[ 0 ][ 4 ] ], shapes[ 1 ], shapes[ 2 ], shapes[ 3 ], shapes[ 4 ], shapes[ 5 ] ], fcn ); // $ExpectType void + bquinary5d( [ x, y, z, w, v, out ], shapes, fcn ); // $ExpectType void + bquinary5d( [ x[ 0 ], y, z, w, v, out ], [ [ shapes[ 0 ][ 1 ][ 2 ][ 3 ][ 4 ] ], 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 = [ [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ] ]; + 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, 2 ], [ 2, 2, 2, 2, 2 ] ]; bquinary5d( 'abc', shapes, fcn ); // $ExpectError bquinary5d( 3.14, shapes, fcn ); // $ExpectError @@ -75,16 +75,16 @@ type InOutShapes = [ Array, Array, Array, Array, 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 u = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const v = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - bquinary5d( [ x, y, z, w, u, v ], 'abc', fcn ); // $ExpectError - bquinary5d( [ x, y, z, w, u, v ], 3.14, fcn ); // $ExpectError - bquinary5d( [ x, y, z, w, u, v ], true, fcn ); // $ExpectError - bquinary5d( [ x, y, z, w, u, v ], false, fcn ); // $ExpectError - bquinary5d( [ x, y, z, w, u, v ], null, fcn ); // $ExpectError - bquinary5d( [ x, y, z, w, u, v ], [ '1' ], fcn ); // $ExpectError - bquinary5d( [ x, y, z, w, u, v ], {}, fcn ); // $ExpectError - bquinary5d( [ x, y, z, w, u, v ], ( x: number ): number => x, fcn ); // $ExpectError + const v = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; + const out = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; + bquinary5d( [ x, y, z, w, v, out ], 'abc', fcn ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], 3.14, fcn ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], true, fcn ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], false, fcn ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], null, fcn ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], [ '1' ], fcn ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], {}, fcn ); // $ExpectError + bquinary5d( [ 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... @@ -93,17 +93,17 @@ type InOutShapes = [ Array, Array, Array, Array, 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 u = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const v = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - const shapes: InOutShapes = [ [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ] ]; + 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, 2 ], [ 2, 2, 2, 2, 2 ] ]; - bquinary5d( [ x, y, z, w, u, v ], shapes, 'abc' ); // $ExpectError - bquinary5d( [ x, y, z, w, u, v ], shapes, 3.14 ); // $ExpectError - bquinary5d( [ x, y, z, w, u, v ], shapes, true ); // $ExpectError - bquinary5d( [ x, y, z, w, u, v ], shapes, false ); // $ExpectError - bquinary5d( [ x, y, z, w, u, v ], shapes, null ); // $ExpectError - bquinary5d( [ x, y, z, w, u, v ], shapes, [ '1' ] ); // $ExpectError - bquinary5d( [ x, y, z, w, u, v ], shapes, {} ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], shapes, 'abc' ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], shapes, 3.14 ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], shapes, true ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], shapes, false ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], shapes, null ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], shapes, [ '1' ] ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], shapes, {} ); // $ExpectError } // The compiler throws an error if the function is provided an unsupported number of arguments... @@ -112,11 +112,11 @@ type InOutShapes = [ Array, Array, Array, Array, 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 u = [ [ [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ] ] ]; - const v = [ [ [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ] ] ]; - const shapes: InOutShapes = [ [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ], [ 1, 1, 1, 1, 2 ] ]; + 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, 2 ], [ 2, 2, 2, 2, 2 ] ]; bquinary5d(); // $ExpectError - bquinary5d( [ x, y, z, w, u, v ] ); // $ExpectError - bquinary5d( [ x, y, z, w, u, v ], shapes, fcn, {} ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ] ); // $ExpectError + bquinary5d( [ x, y, z, w, v, out ], shapes, fcn, {} ); // $ExpectError } diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/examples/index.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/examples/index.js index fb6730390c88..4c91e2385ba0 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/examples/index.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/examples/index.js @@ -26,9 +26,9 @@ var add = require( '@stdlib/math/base/ops/add5' ); var shapes = [ [ 1, 1, 1, 1, 3 ], + [ 1, 1, 1, 3, 1 ], + [ 1, 1, 1, 3, 3 ], [ 1, 1, 3, 1, 1 ], - [ 1, 1, 3, 3, 3 ], - [ 1, 1, 1, 1, 3 ], [ 3, 3, 3, 3, 3 ], [ 3, 3, 3, 3, 3 ] ]; @@ -45,11 +45,11 @@ console.log( z ); var w = filled5dBy( shapes[ 3 ], discreteUniform( -100, 100 ) ); console.log( w ); -var u = filled5dBy( shapes[ 4 ], discreteUniform( -100, 100 ) ); -console.log( u ); - -var v = zeros5d( shapes[ 5 ] ); +var v = filled5dBy( shapes[ 4 ], discreteUniform( -100, 100 ) ); console.log( v ); -bquinary5d( [ x, y, z, w, u, v ], shapes, add ); -console.log( v ); +var out = zeros5d( shapes[ 5 ] ); +console.log( out ); + +bquinary5d( [ x, y, z, w, v, out ], shapes, add ); +console.log( out ); diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/index.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/index.js index 7a4d29290828..3fa7b1966c61 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/index.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/index.js @@ -30,11 +30,11 @@ * var add = require( '@stdlib/array/base/broadcasted-quinary5D' ) * * var shapes = [ -* [ 1, 2, 2, 2, 2 ], -* [ 2, 1, 2, 2, 2 ], -* [ 2, 2, 1, 2, 2 ], -* [ 2, 2, 2, 1, 2 ], -* [ 2, 2, 2, 2, 1 ], +* [ 1, 1, 1, 1, 2 ], +* [ 1, 1, 1, 2, 1 ], +* [ 1, 1, 1, 2, 2 ], +* [ 1, 1, 2, 1, 1 ], +* [ 2, 2, 2, 2, 2 ], * [ 2, 2, 2, 2, 2 ] * ]; * @@ -42,13 +42,13 @@ * var y = ones5d( shapes[ 1 ] ); * var z = ones5d( shapes[ 2 ] ); * var w = ones5d( shapes[ 3 ] ); -* var u = ones5d( shapes[ 4 ] ); -* var v = zeros5d( shapes[ 5 ] ); +* var v = ones5d( shapes[ 4 ] ); +* var out = zeros5d( shapes[ 5 ] ); * -* bquinary5d( [ x, y, z, w, u, v ], shapes, add ); +* bquinary5d( [ x, y, z, w, v, out ], shapes, add ); * -* console.log( v ); -* // => array of shape [2, 2, 2, 2, 2] filled with the value 5.0 +* 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] ], [ [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-quinary5D/lib/main.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/main.js index dde8ba46ab67..4947ce583d3a 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/main.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/lib/main.js @@ -40,9 +40,9 @@ var broadcastArray = require( '@stdlib/array/base/broadcast-array' ); * * var shapes = [ * [ 1, 1, 1, 1, 2 ], -* [ 1, 1, 2, 1, 1 ], * [ 1, 1, 1, 2, 1 ], -* [ 2, 2, 2, 1, 2 ], +* [ 1, 1, 1, 2, 2 ], +* [ 1, 1, 2, 1, 1 ], * [ 2, 2, 2, 2, 2 ], * [ 2, 2, 2, 2, 2 ] * ]; @@ -51,13 +51,13 @@ var broadcastArray = require( '@stdlib/array/base/broadcast-array' ); * var y = ones5d( shapes[ 1 ] ); * var z = ones5d( shapes[ 2 ] ); * var w = ones5d( shapes[ 3 ] ); -* var u = ones5d( shapes[ 4 ] ); -* var v = zeros5d( shapes[ 5 ] ); +* var v = ones5d( shapes[ 4 ] ); +* var out = zeros5d( shapes[ 5 ] ); * -* bquinary5d( [ x, y, z, w, u, v ], shapes, add ); +* bquinary5d( [ x, y, z, w, v, out ], shapes, add ); * -* console.log( v ); -* // => [ [ [ [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ], [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] ] ] ] +* 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] ], [ [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 bquinary5d( arrays, shapes, fcn ) { var dx0; diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js index 846f378aa7a6..d70b918a9265 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js @@ -37,226 +37,261 @@ tape( 'main export is a function', function test( t ) { 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; - var v; shapes = [ - [ 2 ], - [ 2, 1 ], - [ 1, 1 ], - [ 1 ], - [ 1, 2 ], + [ 1, 1, 1, 1, 2 ], + [ 1, 1, 1, 2, 1 ], + [ 1, 1, 1, 2, 2 ], + [ 1, 1, 2, 1, 1 ], + [ 2, 2, 2, 2, 2 ], [ 2, 2, 2, 2, 2 ] ]; - x = [ 1.0, 2.0 ]; + x = [ + [ + [ + [ + [ 1.0, 2.0 ] + ] + ] + ] + ]; y = [ - [ 3.0 ], - [ 4.0 ] + [ + [ + [ + [ 3.0 ], + [ 4.0 ] + ] + ] + ] ]; - z = [ [ 5.0 ] ]; - w = [ 1.0 ]; - u = [ [ 1.0, 2.0 ] ]; - v = zeros5d( shapes[ 5 ] ); - - expected = [ + z = [ + [ + [ + [ + [ 5.0, 6.0 ], + [ 7.0, 8.0 ] + ] + ] + ] + ]; + w = [ + [ + [ + [ + [ 9.0 ] + ], + [ + [ 10.0 ] + ] + ] + ] + ]; + u = [ [ [ [ - [ 11, 13 ], - [ 12, 14 ] + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] ], [ - [ 11, 13 ], - [ 12, 14 ] + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] ] ], [ [ - [ 11, 13 ], - [ 12, 14 ] + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] ], [ - [ 11, 13 ], - [ 12, 14 ] + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] ] ] ], [ [ [ - [ 11, 13 ], - [ 12, 14 ] + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] ], [ - [ 11, 13 ], - [ 12, 14 ] + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] ] ], [ [ - [ 11, 13 ], - [ 12, 14 ] + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] ], [ - [ 11, 13 ], - [ 12, 14 ] + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] ] ] ] ]; - bquinary5d( [ x, y, z, w, u, v ], shapes, add ); - t.deepEqual( v, expected, 'returns expected value' ); + out = zeros5d( [ 2, 2, 2, 2, 2 ] ); + + expected = [ + [ + [ + [ + [19.0, 22.0], + [25.0, 28.0] + ], + [ + [19.0, 22.0], + [25.0, 28.0] + ] + ], + [ + [ + [19.0, 22.0], + [25.0, 28.0] + ], + [ + [19.0, 22.0], + [25.0, 28.0] + ] + ] + ], + [ + [ + [ + [19.0, 22.0], + [25.0, 28.0] + ], + [ + [19.0, 22.0], + [25.0, 28.0] + ] + ], + [ + [ + [19.0, 22.0], + [25.0, 28.0] + ], + [ + [19.0, 22.0], + [25.0, 28.0] + ] + ] + ] + ]; + bquinary5d( [ x, y, z, w, u, out ], shapes, clbk ); + t.deepEqual( out, expected, 'returns expected value' ); + // Same shapes: shapes = [ - [ 1, 2 ], - [ 2 ], - [ 1, 1 ], - [ 1 ], - [ 1, 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, 2, 2, 2 ], + [ 2, 2, 2, 2, 2 ] ]; - x = [ [ 1.0, 2.0 ] ]; - y = [ 3.0, 4.0 ]; - z = [ [ 5.0 ] ]; - w = [ 1.0 ]; - u = [ [ 1.0, 2.0 ] ]; - v = zeros5d( shapes[ 5 ] ); - - expected = [ + x = [ [ [ [ - [ 11.0, 14.0 ], - [ 11.0, 14.0 ] + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] ], [ - [ 11.0, 14.0 ], - [ 11.0, 14.0 ] + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] ] ], [ [ - [ 11.0, 14.0 ], - [ 11.0, 14.0 ] + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] ], [ - [ 11.0, 14.0 ], - [ 11.0, 14.0 ] + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] ] ] ], [ [ [ - [ 11.0, 14.0 ], - [ 11.0, 14.0 ] + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] ], [ - [ 11.0, 14.0 ], - [ 11.0, 14.0 ] + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] ] ], [ [ - [ 11.0, 14.0 ], - [ 11.0, 14.0 ] + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] ], [ - [ 11.0, 14.0 ], - [ 11.0, 14.0 ] + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] ] ] ] ]; - bquinary5d( [ x, y, z, w, u, v ], shapes, add ); - t.deepEqual( v, expected, 'returns expected value' ); - - shapes = [ - [ 1, 2 ], - [ 2 ], - [ 1 ], - [ 2, 2 ], - [ 2, 1 ], - [ 2, 2, 2, 2, 2 ] - ]; - x = [ - [ 1.0, 2.0 ] - ]; - y = [ 3.0, 4.0 ]; - z = [ 5.0 ]; - w = [ - [ 2.0, 3.0 ], - [ 4.0, 5.0 ] - ]; - u = [ - [ 1.0 ], - [ 2.0 ] - ]; - v = zeros5d( shapes[ 5 ] ); - - expected = [ + y = [ [ [ [ - [ 12.0, 15.0 ], - [ 15.0, 18.0 ] + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] ], [ - [ 12.0, 15.0 ], - [ 15.0, 18.0 ] + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] ] ], [ [ - [ 12.0, 15.0 ], - [ 15.0, 18.0 ] + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] ], [ - [ 12.0, 15.0 ], - [ 15.0, 18.0 ] + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] ] ] ], [ [ [ - [ 12.0, 15.0 ], - [ 15.0, 18.0 ] + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] ], [ - [ 12.0, 15.0 ], - [ 15.0, 18.0 ] + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] ] ], [ [ - [ 12.0, 15.0 ], - [ 15.0, 18.0 ] + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] ], [ - [ 12.0, 15.0 ], - [ 15.0, 18.0 ] + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] ] ] ] ]; - bquinary5d( [ x, y, z, w, u, v ], shapes, add ); - t.deepEqual( v, 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, 2 ], - [ 2, 2, 2, 2, 2 ] - ]; - x = [ + z = [ [ [ [ @@ -278,9 +313,7 @@ tape( 'the function applies a provided callback to broadcasted input arrays and [ 3.0, 4.0 ] ] ] - ] - ]; - y = [ + ], [ [ [ @@ -304,7 +337,7 @@ tape( 'the function applies a provided callback to broadcasted input arrays and ] ] ]; - z = [ + w = [ [ [ [ @@ -326,9 +359,7 @@ tape( 'the function applies a provided callback to broadcasted input arrays and [ 3.0, 4.0 ] ] ] - ] - ]; - w = [ + ], [ [ [ @@ -353,6 +384,28 @@ 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 ] + ] + ] + ], [ [ [ @@ -376,9 +429,31 @@ tape( 'the function applies a provided callback to broadcasted input arrays and ] ] ]; - v = zeros5d( shapes[ 5 ] ); + out = zeros5d( 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 ] + ] + ] + ], [ [ [ @@ -402,8 +477,8 @@ tape( 'the function applies a provided callback to broadcasted input arrays and ] ] ]; - bquinary5d( [ x, y, z, w, u, v ], shapes, add ); - t.deepEqual( v, expected, 'returns expected value' ); + bquinary5d( [ x, y, z, w, u, out ], shapes, add ); + t.deepEqual( out, expected, 'returns expected value' ); t.end(); }); @@ -412,24 +487,60 @@ tape( 'the function applies a provided callback to broadcasted input arrays and 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; - var v; + var u; shapes = [ - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 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 ], [ 0, 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 ] @@ -441,11 +552,11 @@ tape( 'the function does not invoke a provided callback if provided an output sh z = x; w = x; u = x; - v = zeros5d( [ 2, 2, 2, 2, 2 ] ); + out = zeros5d( [ 2, 2, 2, 2, 2 ] ); expected = zeros5d( [ 2, 2, 2, 2, 2 ] ); - bquinary5d( [ x, y, z, w, u, v ], shapes, clbk ); - t.deepEqual( v, expected, 'returns expected value' ); + bquinary5d( [ x, y, z, w, u, out ], shapes, clbk ); + t.deepEqual( out, expected, 'returns expected value' ); t.end(); @@ -457,24 +568,60 @@ 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 ) { var expected; var shapes; + var out; var x; var y; var z; var w; var u; - var v; shapes = [ - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 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, 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 ] @@ -486,11 +633,11 @@ tape( 'the function does not invoke a provided callback if provided an output sh z = x; w = x; u = x; - v = zeros5d( [ 2, 2, 2, 2, 2 ] ); + out = zeros5d( [ 2, 2, 2, 2, 2 ] ); expected = zeros5d( [ 2, 2, 2, 2, 2 ] ); - bquinary5d( [ x, y, z, w, u, v ], shapes, clbk ); - t.deepEqual( v, expected, 'returns expected value' ); + bquinary5d( [ x, y, z, w, u, out ], shapes, clbk ); + t.deepEqual( out, expected, 'returns expected value' ); t.end(); @@ -502,24 +649,60 @@ 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 third element equal to zero', function test( t ) { var expected; var shapes; + var out; var x; var y; var z; var w; var u; - var v; shapes = [ - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 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, 2, 0, 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 ] @@ -531,11 +714,11 @@ tape( 'the function does not invoke a provided callback if provided an output sh z = x; w = x; u = x; - v = zeros5d( [ 2, 2, 2, 2, 2 ] ); + out = zeros5d( [ 2, 2, 2, 2, 2 ] ); expected = zeros5d( [ 2, 2, 2, 2, 2 ] ); - bquinary5d( [ x, y, z, w, u, v ], shapes, clbk ); - t.deepEqual( v, expected, 'returns expected value' ); + bquinary5d( [ x, y, z, w, u, out ], shapes, clbk ); + t.deepEqual( out, expected, 'returns expected value' ); t.end(); @@ -547,24 +730,60 @@ 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 fourth element equal to zero', function test( t ) { var expected; var shapes; + var out; var x; var y; var z; var w; var u; - var v; shapes = [ - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 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, 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 ] + ] + ] + ], + [ + [ + [ + [ 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 ] @@ -576,11 +795,11 @@ tape( 'the function does not invoke a provided callback if provided an output sh z = x; w = x; u = x; - v = zeros5d( [ 2, 2, 2, 2, 2 ] ); + out = zeros5d( [ 2, 2, 2, 2, 2 ] ); expected = zeros5d( [ 2, 2, 2, 2, 2 ] ); - bquinary5d( [ x, y, z, w, u, v ], shapes, clbk ); - t.deepEqual( v, expected, 'returns expected value' ); + bquinary5d( [ x, y, z, w, u, out ], shapes, clbk ); + t.deepEqual( out, expected, 'returns expected value' ); t.end(); @@ -592,24 +811,60 @@ 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 fifth element equal to zero', function test( t ) { var expected; var shapes; + var out; var x; var y; var z; var w; var u; - var v; shapes = [ - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 2, 2 ], - [ 1, 1, 1, 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, 2, 2, 2, 0 ] ]; 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 ] @@ -621,11 +876,11 @@ tape( 'the function does not invoke a provided callback if provided an output sh z = x; w = x; u = x; - v = zeros5d( [ 2, 2, 2, 2, 2 ] ); + out = zeros5d( [ 2, 2, 2, 2, 2 ] ); expected = zeros5d( [ 2, 2, 2, 2, 2 ] ); - bquinary5d( [ x, y, z, w, u, v ], shapes, clbk ); - t.deepEqual( v, expected, 'returns expected value' ); + bquinary5d( [ x, y, z, w, u, out ], shapes, clbk ); + t.deepEqual( out, expected, 'returns expected value' ); t.end(); From 2d1b5962fe330ddbaf4c42dddfc1b67b86faa8a4 Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Fri, 20 Dec 2024 21:58:07 +0600 Subject: [PATCH 27/29] "fixed issues" --- .../@stdlib/array/base/broadcasted-quinary5D/test/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js index d70b918a9265..7687123d30ec 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js @@ -187,7 +187,7 @@ tape( 'the function applies a provided callback to broadcasted input arrays and ] ] ]; - bquinary5d( [ x, y, z, w, u, out ], shapes, clbk ); + bquinary5d( [ x, y, z, w, u, out ], shapes, add ); t.deepEqual( out, expected, 'returns expected value' ); // Same shapes: From f0543244f80e4db1a27d15fc8c3a7c3e9693cc78 Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Fri, 20 Dec 2024 22:04:46 +0600 Subject: [PATCH 28/29] "fixed issues" --- .../base/broadcasted-quinary5D/test/test.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js index 7687123d30ec..45cfcfc44da8 100644 --- a/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js +++ b/lib/node_modules/@stdlib/array/base/broadcasted-quinary5D/test/test.js @@ -146,20 +146,20 @@ tape( 'the function applies a provided callback to broadcasted input arrays and [ [ [19.0, 22.0], - [25.0, 28.0] + [24.0, 27.0] ], [ - [19.0, 22.0], + [20.0, 23.0], [25.0, 28.0] ] ], [ [ [19.0, 22.0], - [25.0, 28.0] + [24.0, 27.0] ], [ - [19.0, 22.0], + [20.0, 23.0], [25.0, 28.0] ] ] @@ -168,20 +168,20 @@ tape( 'the function applies a provided callback to broadcasted input arrays and [ [ [19.0, 22.0], - [25.0, 28.0] + [24.0, 27.0] ], [ - [19.0, 22.0], + [20.0, 23.0], [25.0, 28.0] ] ], [ [ [19.0, 22.0], - [25.0, 28.0] + [24.0, 27.0] ], [ - [19.0, 22.0], + [20.0, 23.0], [25.0, 28.0] ] ] From cf0bce7910d62049b2df5f51f65d8e645b2cbf2b Mon Sep 17 00:00:00 2001 From: Riya Chowdhury Date: Sat, 21 Dec 2024 12:44:49 +0600 Subject: [PATCH 29/29] Delete lib/node_modules/@stdlib/array/base/broadcasted-binary5d/benchmark/benchmark.js Signed-off-by: Riya Chowdhury --- .../benchmark/benchmark.js | 133 ------------------ 1 file changed, 133 deletions(-) delete mode 100644 lib/node_modules/@stdlib/array/base/broadcasted-binary5d/benchmark/benchmark.js diff --git a/lib/node_modules/@stdlib/array/base/broadcasted-binary5d/benchmark/benchmark.js b/lib/node_modules/@stdlib/array/base/broadcasted-binary5d/benchmark/benchmark.js deleted file mode 100644 index 85819f6db830..000000000000 --- a/lib/node_modules/@stdlib/array/base/broadcasted-binary5d/benchmark/benchmark.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 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 add = require( '@stdlib/math/base/ops/add' ); -var filled5dBy = require( '@stdlib/array/base/filled5d-by' ); -var zeros5d = require( '@stdlib/array/base/zeros5d' ); -var numel = require( '@stdlib/ndarray/base/numel' ); -var pkg = require( './../package.json' ).name; -var bbinary5d = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveIntegerArray} shape - output array shape -* @returns {Function} benchmark function -*/ -function createBenchmark( shape ) { - var arrays; - var shapes; - var x; - var y; - var z; - - shapes = [ - [ 1, 1, 1, 1, shape[ 2 ] ], - [ shape[ 0 ], 1, 1, 1, 1 ], - shape - ]; - x = filled5dBy( shapes[ 0 ], uniform( -100.0, 100.0 ) ); - y = filled5dBy( shapes[ 1 ], uniform( -100.0, 100.0 ) ); - z = zeros5d( shapes[ 2 ] ); - - arrays = [ x, y, z ]; - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i0; - var i1; - var i2; - var i3; - var i4; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bbinary5d( arrays, shapes, add ); - i4 = i % shapes[ 1 ][ 0 ]; - i3 = i % shapes[ 1 ][ 1 ]; - i2 = i % shapes[ 1 ][ 2 ]; - i1 = i % shapes[ 1 ][ 3 ]; - i0 = i % shapes[ 1 ][ 4 ]; - if ( isnan( arrays[ 2 ][ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - - i4 = i % shapes[ 1 ][ 0 ]; - i3 = i % shapes[ 1 ][ 1 ]; - i2 = i % shapes[ 1 ][ 2 ]; - i1 = i % shapes[ 1 ][ 3 ]; - i0 = i % shapes[ 1 ][ 4 ]; - if ( isnan( arrays[ 2 ][ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ) ) { - 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/5.0 ) ); - sh = [ N, N, N, N, N ]; - f = createBenchmark( sh ); - bench( pkg+'::equidimensional:size='+numel( sh ), f ); - } -} - -main();