Skip to content

Commit 73f6815

Browse files
committed
Auto-generated commit
1 parent ef7e503 commit 73f6815

File tree

11 files changed

+1240
-3
lines changed

11 files changed

+1240
-3
lines changed

CHANGELOG.md

+39-3
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,40 @@
123123

124124
<!-- /.package -->
125125

126+
<section class="package" id="array-base-broadcasted-quaternary3d-unreleased">
127+
128+
#### [@stdlib/array/base/broadcasted-quaternary3d](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/broadcasted-quaternary3d)
129+
130+
<details>
131+
132+
<section class="features">
133+
134+
##### Features
135+
136+
- [`6559e70`](https://github.com/stdlib-js/stdlib/commit/6559e70d5a7eaf8aa0cf5356aa4a12f857507bb2) - add `array/base/broadcasted/quaternary3d` [(#3230)](https://github.com/stdlib-js/stdlib/pull/3230)
137+
138+
</section>
139+
140+
<!-- /.features -->
141+
142+
<section class="issues">
143+
144+
##### Closed Issues
145+
146+
This release closes the following issue:
147+
148+
[#3167](https://github.com/stdlib-js/stdlib/issues/3167)
149+
150+
</section>
151+
152+
<!-- /.issues -->
153+
154+
</details>
155+
156+
</section>
157+
158+
<!-- /.package -->
159+
126160
<section class="package" id="array-base-broadcasted-ternary3d-unreleased">
127161

128162
#### [@stdlib/array/base/broadcasted-ternary3d](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/broadcasted-ternary3d)
@@ -695,9 +729,9 @@ A total of 12 issues were closed in this release:
695729

696730
### Closed Issues
697731

698-
A total of 23 issues were closed in this release:
732+
A total of 24 issues were closed in this release:
699733

700-
[#3135](https://github.com/stdlib-js/stdlib/issues/3135), [#3138](https://github.com/stdlib-js/stdlib/issues/3138), [#3140](https://github.com/stdlib-js/stdlib/issues/3140), [#3145](https://github.com/stdlib-js/stdlib/issues/3145), [#3146](https://github.com/stdlib-js/stdlib/issues/3146), [#3147](https://github.com/stdlib-js/stdlib/issues/3147), [#3149](https://github.com/stdlib-js/stdlib/issues/3149), [#3150](https://github.com/stdlib-js/stdlib/issues/3150), [#3151](https://github.com/stdlib-js/stdlib/issues/3151), [#3152](https://github.com/stdlib-js/stdlib/issues/3152), [#3155](https://github.com/stdlib-js/stdlib/issues/3155), [#3162](https://github.com/stdlib-js/stdlib/issues/3162), [#3164](https://github.com/stdlib-js/stdlib/issues/3164), [#3165](https://github.com/stdlib-js/stdlib/issues/3165), [#3166](https://github.com/stdlib-js/stdlib/issues/3166), [#3173](https://github.com/stdlib-js/stdlib/issues/3173), [#3174](https://github.com/stdlib-js/stdlib/issues/3174), [#3175](https://github.com/stdlib-js/stdlib/issues/3175), [#3176](https://github.com/stdlib-js/stdlib/issues/3176), [#3177](https://github.com/stdlib-js/stdlib/issues/3177), [#3178](https://github.com/stdlib-js/stdlib/issues/3178), [#3179](https://github.com/stdlib-js/stdlib/issues/3179), [#3180](https://github.com/stdlib-js/stdlib/issues/3180)
734+
[#3135](https://github.com/stdlib-js/stdlib/issues/3135), [#3138](https://github.com/stdlib-js/stdlib/issues/3138), [#3140](https://github.com/stdlib-js/stdlib/issues/3140), [#3145](https://github.com/stdlib-js/stdlib/issues/3145), [#3146](https://github.com/stdlib-js/stdlib/issues/3146), [#3147](https://github.com/stdlib-js/stdlib/issues/3147), [#3149](https://github.com/stdlib-js/stdlib/issues/3149), [#3150](https://github.com/stdlib-js/stdlib/issues/3150), [#3151](https://github.com/stdlib-js/stdlib/issues/3151), [#3152](https://github.com/stdlib-js/stdlib/issues/3152), [#3155](https://github.com/stdlib-js/stdlib/issues/3155), [#3162](https://github.com/stdlib-js/stdlib/issues/3162), [#3164](https://github.com/stdlib-js/stdlib/issues/3164), [#3165](https://github.com/stdlib-js/stdlib/issues/3165), [#3166](https://github.com/stdlib-js/stdlib/issues/3166), [#3167](https://github.com/stdlib-js/stdlib/issues/3167), [#3173](https://github.com/stdlib-js/stdlib/issues/3173), [#3174](https://github.com/stdlib-js/stdlib/issues/3174), [#3175](https://github.com/stdlib-js/stdlib/issues/3175), [#3176](https://github.com/stdlib-js/stdlib/issues/3176), [#3177](https://github.com/stdlib-js/stdlib/issues/3177), [#3178](https://github.com/stdlib-js/stdlib/issues/3178), [#3179](https://github.com/stdlib-js/stdlib/issues/3179), [#3180](https://github.com/stdlib-js/stdlib/issues/3180)
701735

702736
</section>
703737

@@ -707,13 +741,14 @@ A total of 23 issues were closed in this release:
707741

708742
### Contributors
709743

710-
A total of 11 people contributed to this release. Thank you to the following contributors:
744+
A total of 12 people contributed to this release. Thank you to the following contributors:
711745

712746
- Aayush Khanna
713747
- Abhijit Raut
714748
- Aditya Sapra
715749
- Ahmed Kashkoush
716750
- Athan Reines
751+
- Gururaj Gurram
717752
- Kshitij-Dale
718753
- Muhammad Haris
719754
- Neeraj Pathak
@@ -731,6 +766,7 @@ A total of 11 people contributed to this release. Thank you to the following con
731766

732767
<details>
733768

769+
- [`6559e70`](https://github.com/stdlib-js/stdlib/commit/6559e70d5a7eaf8aa0cf5356aa4a12f857507bb2) - **feat:** add `array/base/broadcasted/quaternary3d` [(#3230)](https://github.com/stdlib-js/stdlib/pull/3230) _(by Gururaj Gurram, Athan Reines, stdlib-bot)_
734770
- [`1788e0a`](https://github.com/stdlib-js/stdlib/commit/1788e0a90708cdf7b5be6e1b86b3f5d40093ebab) - **feat:** add `array/base/unary5d-by` [(#3221)](https://github.com/stdlib-js/stdlib/pull/3221) _(by Neeraj Pathak, Athan Reines, stdlib-bot)_
735771
- [`143b370`](https://github.com/stdlib-js/stdlib/commit/143b37022fe8b96b30a0b79466e310380ddd2628) - **feat:** add `array/base/unary4d-by` [(#3220)](https://github.com/stdlib-js/stdlib/pull/3220) _(by Abhijit Raut, Athan Reines)_
736772
- [`70aaa8c`](https://github.com/stdlib-js/stdlib/commit/70aaa8ca5c7fa401321769137542c4001f529536) - **feat:** add `array/base/unary3d-by` [(#3219)](https://github.com/stdlib-js/stdlib/pull/3219) _(by Neeraj Pathak, Athan Reines, stdlib-bot)_
+147
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2024 The Stdlib Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
21+
# bquaternary3d
22+
23+
> Apply a quaternary callback to elements in four [broadcasted][@stdlib/array/base/broadcast-array] input arrays and assign results to elements in a three-dimensional nested output array.
24+
25+
<section class="intro">
26+
27+
</section>
28+
29+
<!-- /.intro -->
30+
31+
<section class="usage">
32+
33+
## Usage
34+
35+
```javascript
36+
var bquaternary3d = require( '@stdlib/array/base/broadcasted-quaternary3d' );
37+
```
38+
39+
#### bquaternary3d( arrays, shapes, fcn )
40+
41+
Applies a quaternary callback to elements in four [broadcasted][@stdlib/array/base/broadcast-array] input arrays and assigns results to elements in a three-dimensional nested output array.
42+
43+
```javascript
44+
var add = require( '@stdlib/math/base/ops/add4' );
45+
var zeros3d = require( '@stdlib/array/base/zeros3d' );
46+
47+
var x = [ [ 1.0, 2.0 ] ];
48+
var y = [ [ 3.0 ], [ 4.0 ] ];
49+
var z = [ [ 5.0 ] ];
50+
var w = [ [ 2.0 ] ];
51+
var out = zeros3d( [ 2, 2, 2 ] );
52+
53+
var shapes = [
54+
[ 1, 2 ],
55+
[ 2, 1 ],
56+
[ 1, 1 ],
57+
[ 1, 1 ],
58+
[ 2, 2, 2 ]
59+
];
60+
61+
bquaternary3d( [ x, y, z, w, out ], shapes, add );
62+
// out => [ [ [ 11.0, 12.0 ], [ 12.0, 13.0 ] ], [ [ 11.0, 12.0 ], [ 12.0, 13.0 ] ] ]
63+
```
64+
65+
The function accepts the following arguments:
66+
67+
- **arrays**: array-like object containing four input nested arrays and one output nested array.
68+
- **shapes**: array shapes.
69+
- **fcn**: quaternary function to apply.
70+
71+
</section>
72+
73+
<!-- /.usage -->
74+
75+
<section class="notes">
76+
77+
## Notes
78+
79+
- The input and output array shapes must be broadcast [compatible][@stdlib/ndarray/base/broadcast-shapes].
80+
81+
</section>
82+
83+
<!-- /.notes -->
84+
85+
<section class="examples">
86+
87+
## Examples
88+
89+
<!-- eslint no-undef: "error" -->
90+
91+
```javascript
92+
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory;
93+
var filled3dBy = require( '@stdlib/array/base/filled3d-by' );
94+
var zeros3d = require( '@stdlib/array/base/zeros3d' );
95+
var add = require( '@stdlib/math/base/ops/add4' );
96+
var bquaternary3d = require( '@stdlib/array/base/broadcasted-quaternary3d' );
97+
98+
var shapes = [
99+
[ 1, 1, 3 ],
100+
[ 3, 1, 1 ],
101+
[ 1, 3, 1 ],
102+
[ 3, 3, 3 ],
103+
[ 3, 3, 3 ]
104+
];
105+
106+
var x = filled3dBy( shapes[ 0 ], discreteUniform( -100, 100 ) );
107+
console.log( x );
108+
109+
var y = filled3dBy( shapes[ 1 ], discreteUniform( -100, 100 ) );
110+
console.log( y );
111+
112+
var z = filled3dBy( shapes[ 2 ], discreteUniform( -100, 100 ) );
113+
console.log( z );
114+
115+
var w = filled3dBy( shapes[ 3 ], discreteUniform( -100, 100 ) );
116+
console.log( w );
117+
118+
var out = zeros3d( shapes[ 4 ] );
119+
console.log( z );
120+
121+
bquaternary3d( [ x, y, z, w, out ], shapes, add );
122+
console.log( out );
123+
```
124+
125+
</section>
126+
127+
<!-- /.examples -->
128+
129+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
130+
131+
<section class="related">
132+
133+
</section>
134+
135+
<!-- /.related -->
136+
137+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
138+
139+
<section class="links">
140+
141+
[@stdlib/array/base/broadcast-array]: https://github.com/stdlib-js/array/tree/main/base/broadcast-array
142+
143+
[@stdlib/ndarray/base/broadcast-shapes]: https://github.com/stdlib-js/ndarray-base-broadcast-shapes
144+
145+
</section>
146+
147+
<!-- /.links -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2024 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var bench = require( '@stdlib/bench' );
24+
var uniform = require( '@stdlib/random/base/uniform' ).factory;
25+
var isnan = require( '@stdlib/math/base/assert/is-nan' );
26+
var pow = require( '@stdlib/math/base/special/pow' );
27+
var floor = require( '@stdlib/math/base/special/floor' );
28+
var add = require( '@stdlib/math/base/ops/add4' );
29+
var filled3dBy = require( './../../../base/filled3d-by' );
30+
var zeros3d = require( './../../../base/zeros3d' );
31+
var numel = require( '@stdlib/ndarray/base/numel' );
32+
var pkg = require( './../package.json' ).name;
33+
var bquaternary3d = require( './../lib' );
34+
35+
36+
// FUNCTIONS //
37+
38+
/**
39+
* Creates a benchmark function.
40+
*
41+
* @private
42+
* @param {PositiveIntegerArray} shape - output array shape
43+
* @returns {Function} benchmark function
44+
*/
45+
function createBenchmark( shape ) {
46+
var arrays;
47+
var shapes;
48+
var out;
49+
var x;
50+
var y;
51+
var z;
52+
var w;
53+
54+
shapes = [
55+
[ 1, 1, shape[ 2 ] ],
56+
[ 1, shape[ 1 ], 1 ],
57+
[ shape[ 0 ], 1, 1 ],
58+
[ shape[ 0 ], shape[ 1 ], shape[ 2 ] ],
59+
shape
60+
];
61+
x = filled3dBy( shapes[ 0 ], uniform( -100.0, 100.0 ) );
62+
y = filled3dBy( shapes[ 1 ], uniform( -100.0, 100.0 ) );
63+
z = filled3dBy( shapes[ 2 ], uniform( -100.0, 100.0 ) );
64+
w = filled3dBy( shapes[ 3 ], uniform( -100.0, 100.0 ) );
65+
out = zeros3d( shapes[ 4 ] );
66+
67+
arrays = [ x, y, z, w, out ];
68+
69+
return benchmark;
70+
71+
/**
72+
* Benchmark function.
73+
*
74+
* @private
75+
* @param {Benchmark} b - benchmark instance
76+
*/
77+
function benchmark( b ) {
78+
var i0;
79+
var i1;
80+
var i2;
81+
var i;
82+
83+
b.tic();
84+
for ( i = 0; i < b.iterations; i++ ) {
85+
bquaternary3d( arrays, shapes, add );
86+
i2 = i % shapes[ 1 ][ 0 ];
87+
i1 = i % shapes[ 1 ][ 1 ];
88+
i0 = i % shapes[ 1 ][ 2 ];
89+
if ( isnan( arrays[ 4 ][ i2 ][ i1 ][ i0 ] ) ) {
90+
b.fail( 'should not return NaN' );
91+
}
92+
}
93+
b.toc();
94+
95+
i2 = i % shapes[ 1 ][ 0 ];
96+
i1 = i % shapes[ 1 ][ 1 ];
97+
i0 = i % shapes[ 1 ][ 2 ];
98+
if ( isnan( arrays[ 4 ][ i2 ][ i1 ][ i0 ] ) ) {
99+
b.fail( 'should not return NaN' );
100+
}
101+
b.pass( 'benchmark finished' );
102+
b.end();
103+
}
104+
}
105+
106+
107+
// MAIN //
108+
109+
/**
110+
* Main execution sequence.
111+
*
112+
* @private
113+
*/
114+
function main() {
115+
var min;
116+
var max;
117+
var sh;
118+
var N;
119+
var f;
120+
var i;
121+
122+
min = 1; // 10^min
123+
max = 6; // 10^max
124+
125+
for ( i = min; i <= max; i++ ) {
126+
N = floor( pow( pow( 10, i ), 1.0/3.0 ) );
127+
sh = [ N, N, N ];
128+
f = createBenchmark( sh );
129+
bench( pkg+'::equidimensional:size='+numel( sh ), f );
130+
}
131+
}
132+
133+
main();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
{{alias}}( arrays, shapes, fcn )
3+
Applies a quaternary callback to elements in four broadcasted input arrays
4+
and assigns results to elements in a three-dimensional nested output array.
5+
6+
Parameters
7+
----------
8+
arrays: ArrayLikeObject
9+
Array-like object containing four input nested arrays and one output
10+
nested array.
11+
12+
shapes: Array<Array<integer>>
13+
Array shapes.
14+
15+
fcn: Function
16+
Quaternary callback.
17+
18+
Examples
19+
--------
20+
> function fcn( x, y, z, w ) { return x + y + z + w; };
21+
> var x = [ 1.0, 2.0 ];
22+
> var y = [ [ 3.0 ], [ 4.0 ] ];
23+
> var z = [ [ 5.0 ] ];
24+
> var w = [ 1.0 ];
25+
> var out = [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ];
26+
> var shapes = [ [ 2 ], [ 2, 1 ], [ 1, 1 ], [ 1 ], [ 1, 2, 2 ] ];
27+
> {{alias}}( [ x, y, z, w, out ], shapes, fcn );
28+
> out
29+
[ [ [ 10.0, 11.0 ], [ 11.0, 12.0 ] ] ]
30+
31+
See Also
32+
--------
33+

0 commit comments

Comments
 (0)