@stdlib/array-base-broadcasted-quaternary5d 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
package/NOTICE ADDED
@@ -0,0 +1 @@
1
+ Copyright (c) 2016-2026 The Stdlib Authors.
package/README.md ADDED
@@ -0,0 +1,238 @@
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
+
22
+ <details>
23
+ <summary>
24
+ About stdlib...
25
+ </summary>
26
+ <p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
27
+ <p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
28
+ <p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
29
+ <p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
30
+ </details>
31
+
32
+ # bquaternary5d
33
+
34
+ [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
35
+
36
+ > Apply a quaternary callback to elements in four [broadcasted][@stdlib/array/base/broadcast-array] input arrays and assign results to elements in a five-dimensional nested output array.
37
+
38
+ <section class="intro">
39
+
40
+ </section>
41
+
42
+ <!-- /.intro -->
43
+
44
+ <section class="installation">
45
+
46
+ ## Installation
47
+
48
+ ```bash
49
+ npm install @stdlib/array-base-broadcasted-quaternary5d
50
+ ```
51
+
52
+ </section>
53
+
54
+ <section class="usage">
55
+
56
+ ## Usage
57
+
58
+ ```javascript
59
+ var bquaternary5d = require( '@stdlib/array-base-broadcasted-quaternary5d' );
60
+ ```
61
+
62
+ #### bquaternary5d( arrays, shapes, fcn )
63
+
64
+ Applies a quaternary callback to elements in four [broadcasted][@stdlib/array/base/broadcast-array] input arrays and assigns results to elements in a five-dimensional nested output array.
65
+
66
+ ```javascript
67
+ var add = require( '@stdlib/number-float64-base-add4' );
68
+ var zeros5d = require( '@stdlib/array-base-zeros5d' );
69
+
70
+ var x = [ [ 1.0, 2.0 ] ];
71
+ var y = [ [ 3.0 ], [ 4.0 ] ];
72
+ var z = [ [ 5.0 ] ];
73
+ var w = [ [ 2.0 ] ];
74
+ var out = zeros5d( [ 1, 1, 2, 2, 2 ] );
75
+
76
+ var shapes = [
77
+ [ 1, 2 ],
78
+ [ 2, 1 ],
79
+ [ 1, 1 ],
80
+ [ 1, 1 ],
81
+ [ 1, 1, 2, 2, 2 ]
82
+ ];
83
+
84
+ bquaternary5d( [ x, y, z, w, out ], shapes, add );
85
+ // out => [ [ [ [ [ 11.0, 12.0 ], [ 12.0, 13.0 ] ], [ [ 11.0, 12.0 ], [ 12.0, 13.0 ] ] ] ] ]
86
+ ```
87
+
88
+ The function accepts the following arguments:
89
+
90
+ - **arrays**: array-like object containing four input nested arrays and one output nested array.
91
+ - **shapes**: array shapes.
92
+ - **fcn**: quaternary function to apply.
93
+
94
+ </section>
95
+
96
+ <!-- /.usage -->
97
+
98
+ <section class="notes">
99
+
100
+ ## Notes
101
+
102
+ - The input and output array shapes must be broadcast [compatible][@stdlib/ndarray/base/broadcast-shapes].
103
+
104
+ </section>
105
+
106
+ <!-- /.notes -->
107
+
108
+ <section class="examples">
109
+
110
+ ## Examples
111
+
112
+ <!-- eslint no-undef: "error" -->
113
+
114
+ ```javascript
115
+ var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory;
116
+ var filled5dBy = require( '@stdlib/array-base-filled5d-by' );
117
+ var zeros5d = require( '@stdlib/array-base-zeros5d' );
118
+ var add = require( '@stdlib/number-float64-base-add4' );
119
+ var bquaternary5d = require( '@stdlib/array-base-broadcasted-quaternary5d' );
120
+
121
+ var shapes = [
122
+ [ 1, 1, 1, 3, 1 ],
123
+ [ 1, 3, 1, 1, 1 ],
124
+ [ 1, 1, 1, 1, 3 ],
125
+ [ 1, 1, 3, 1, 1 ],
126
+ [ 1, 3, 3, 3, 3 ]
127
+ ];
128
+
129
+ var x = filled5dBy( shapes[ 0 ], discreteUniform( -100, 100 ) );
130
+ console.log( x );
131
+
132
+ var y = filled5dBy( shapes[ 1 ], discreteUniform( -100, 100 ) );
133
+ console.log( y );
134
+
135
+ var z = filled5dBy( shapes[ 2 ], discreteUniform( -100, 100 ) );
136
+ console.log( z );
137
+
138
+ var w = filled5dBy( shapes[ 3 ], discreteUniform( -100, 100 ) );
139
+ console.log( w );
140
+
141
+ var out = zeros5d( shapes[ 4 ] );
142
+ console.log( out );
143
+
144
+ bquaternary5d( [ x, y, z, w, out ], shapes, add );
145
+ console.log( out );
146
+ ```
147
+
148
+ </section>
149
+
150
+ <!-- /.examples -->
151
+
152
+ <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
153
+
154
+ <section class="related">
155
+
156
+ </section>
157
+
158
+ <!-- /.related -->
159
+
160
+ <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
161
+
162
+
163
+ <section class="main-repo" >
164
+
165
+ * * *
166
+
167
+ ## Notice
168
+
169
+ This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
170
+
171
+ For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib].
172
+
173
+ #### Community
174
+
175
+ [![Chat][chat-image]][chat-url]
176
+
177
+ ---
178
+
179
+ ## License
180
+
181
+ See [LICENSE][stdlib-license].
182
+
183
+
184
+ ## Copyright
185
+
186
+ Copyright &copy; 2016-2026. The Stdlib [Authors][stdlib-authors].
187
+
188
+ </section>
189
+
190
+ <!-- /.stdlib -->
191
+
192
+ <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
193
+
194
+ <section class="links">
195
+
196
+ [npm-image]: http://img.shields.io/npm/v/@stdlib/array-base-broadcasted-quaternary5d.svg
197
+ [npm-url]: https://npmjs.org/package/@stdlib/array-base-broadcasted-quaternary5d
198
+
199
+ [test-image]: https://github.com/stdlib-js/array-base-broadcasted-quaternary5d/actions/workflows/test.yml/badge.svg?branch=v0.1.0
200
+ [test-url]: https://github.com/stdlib-js/array-base-broadcasted-quaternary5d/actions/workflows/test.yml?query=branch:v0.1.0
201
+
202
+ [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/array-base-broadcasted-quaternary5d/main.svg
203
+ [coverage-url]: https://codecov.io/github/stdlib-js/array-base-broadcasted-quaternary5d?branch=main
204
+
205
+ <!--
206
+
207
+ [dependencies-image]: https://img.shields.io/david/stdlib-js/array-base-broadcasted-quaternary5d.svg
208
+ [dependencies-url]: https://david-dm.org/stdlib-js/array-base-broadcasted-quaternary5d/main
209
+
210
+ -->
211
+
212
+ [chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
213
+ [chat-url]: https://stdlib.zulipchat.com
214
+
215
+ [stdlib]: https://github.com/stdlib-js/stdlib
216
+
217
+ [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
218
+
219
+ [umd]: https://github.com/umdjs/umd
220
+ [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
221
+
222
+ [deno-url]: https://github.com/stdlib-js/array-base-broadcasted-quaternary5d/tree/deno
223
+ [deno-readme]: https://github.com/stdlib-js/array-base-broadcasted-quaternary5d/blob/deno/README.md
224
+ [umd-url]: https://github.com/stdlib-js/array-base-broadcasted-quaternary5d/tree/umd
225
+ [umd-readme]: https://github.com/stdlib-js/array-base-broadcasted-quaternary5d/blob/umd/README.md
226
+ [esm-url]: https://github.com/stdlib-js/array-base-broadcasted-quaternary5d/tree/esm
227
+ [esm-readme]: https://github.com/stdlib-js/array-base-broadcasted-quaternary5d/blob/esm/README.md
228
+ [branches-url]: https://github.com/stdlib-js/array-base-broadcasted-quaternary5d/blob/main/branches.md
229
+
230
+ [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/array-base-broadcasted-quaternary5d/main/LICENSE
231
+
232
+ [@stdlib/array/base/broadcast-array]: https://www.npmjs.com/package/@stdlib/array-base-broadcast-array
233
+
234
+ [@stdlib/ndarray/base/broadcast-shapes]: https://www.npmjs.com/package/@stdlib/ndarray-base-broadcast-shapes
235
+
236
+ </section>
237
+
238
+ <!-- /.links -->
package/SECURITY.md ADDED
@@ -0,0 +1,5 @@
1
+ # Security
2
+
3
+ > Policy for reporting security vulnerabilities.
4
+
5
+ See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security).
@@ -0,0 +1,3 @@
1
+ /// <reference path="../docs/types/index.d.ts" />
2
+ import bquaternary5d from '../docs/types/index';
3
+ export = bquaternary5d;
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";var Fr=function(t,v){return function(){return v||t((v={exports:{}}).exports,v),v.exports}};var Dr=Fr(function(Jr,Cr){
2
+ var o=require('@stdlib/array-base-broadcast-array/dist');function Gr(t,v,Er){var L,M,N,O,P,Q,R,T,U,V,W,X,Y,Z,_,$,p,h,rr,ar,w,z,y,f,m,i,u,x,e,n,j,k,s,S,c,q,b,A,g,l,B,C,D,E,F,G,H,I,J,K,vr,dr,tr,ir,ur,xr,er,nr,or,wr,zr,yr,fr,mr,jr,kr,sr,Sr,cr,qr,d,r,a,br,Ar,gr,lr,Br;if(d=v[4],w=d[4],z=d[3],y=d[2],f=d[1],m=d[0],!(w<=0||z<=0||y<=0||f<=0||m<=0))for(a=o(t[0],v[0],d),br=a.data,r=a.strides,L=r[4],M=r[3],N=r[2],O=r[1],P=r[0],a=o(t[1],v[1],d),Ar=a.data,r=a.strides,Q=r[4],R=r[3],T=r[2],U=r[1],V=r[0],a=o(t[2],v[2],d),gr=a.data,r=a.strides,W=r[4],X=r[3],Y=r[2],Z=r[1],_=r[0],a=o(t[3],v[3],d),lr=a.data,r=a.strides,$=r[4],p=r[3],h=r[2],rr=r[1],ar=r[0],Br=t[4],c=0,l=0,F=0,K=0,n=0;n<m;n++){for(S=0,g=0,E=0,J=0,ir=br[c],nr=Ar[l],yr=gr[F],kr=lr[K],qr=Br[n],e=0;e<f;e++){for(s=0,A=0,D=0,I=0,tr=ir[S],er=nr[g],zr=yr[E],jr=kr[J],cr=qr[e],x=0;x<y;x++){for(k=0,b=0,C=0,H=0,dr=tr[s],xr=er[A],wr=zr[D],mr=jr[I],Sr=cr[x],u=0;u<z;u++){for(j=0,q=0,B=0,G=0,vr=dr[k],ur=xr[b],or=wr[C],fr=mr[H],sr=Sr[u],i=0;i<w;i++)sr[i]=Er(vr[j],ur[q],or[B],fr[G]),j+=L,q+=Q,B+=W,G+=$;k+=M,b+=R,C+=X,H+=p}s+=N,A+=T,D+=Y,I+=h}S+=O,g+=U,E+=Z,J+=rr}c+=P,l+=V,F+=_,K+=ar}}Cr.exports=Gr
3
+ });var Hr=Dr();module.exports=Hr;
4
+ /** @license Apache-2.0 */
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../lib/main.js", "../lib/index.js"],
4
+ "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar broadcastArray = require( '@stdlib/array-base-broadcast-array' );\n\n\n// MAIN //\n\n/**\n* Applies a quaternary callback to elements in four broadcasted input arrays and assigns results to elements in a five-dimensional nested output array.\n*\n* @param {ArrayLikeObject<Array>} arrays - array-like object containing four input nested arrays and one output nested array\n* @param {ArrayLikeObject<NonNegativeIntegerArray>} shapes - array shapes\n* @param {Callback} fcn - quaternary callback\n* @returns {void}\n*\n* @example\n* var add = require( '@stdlib/number-float64-base-add4' );\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n*\n* var shapes = [\n* [ 1, 1, 3, 1, 1 ],\n* [ 1, 1, 1, 3, 1 ],\n* [ 1, 1, 1, 1, 3 ],\n* [ 1, 1, 1, 1, 1 ],\n* [ 1, 1, 3, 3, 3 ]\n* ];\n*\n* var x = ones5d( shapes[ 0 ] );\n* var y = ones5d( shapes[ 1 ] );\n* var z = ones5d( shapes[ 2 ] );\n* var w = ones5d( shapes[ 3 ] );\n* var out = zeros5d( shapes[ 4 ] );\n*\n* bquaternary5d( [ x, y, z, w, out ], shapes, add );\n*\n* console.log( out );\n* // => [ [ [ [ [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ] ], [ [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ] ], [ [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ] ] ] ] ]\n*/\nfunction bquaternary5d( arrays, shapes, fcn ) { // eslint-disable-line max-statements\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dz0;\n\tvar dz1;\n\tvar dz2;\n\tvar dz3;\n\tvar dz4;\n\tvar dw0;\n\tvar dw1;\n\tvar dw2;\n\tvar dw3;\n\tvar dw4;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar k0;\n\tvar k1;\n\tvar k2;\n\tvar k3;\n\tvar k4;\n\tvar m0;\n\tvar m1;\n\tvar m2;\n\tvar m3;\n\tvar m4;\n\tvar n0;\n\tvar n1;\n\tvar n2;\n\tvar n3;\n\tvar n4;\n\tvar x0;\n\tvar x1;\n\tvar x2;\n\tvar x3;\n\tvar y0;\n\tvar y1;\n\tvar y2;\n\tvar y3;\n\tvar z0;\n\tvar z1;\n\tvar z2;\n\tvar z3;\n\tvar w0;\n\tvar w1;\n\tvar w2;\n\tvar w3;\n\tvar u0;\n\tvar u1;\n\tvar u2;\n\tvar u3;\n\tvar sh;\n\tvar st;\n\tvar o;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar w;\n\tvar u;\n\n\tsh = shapes[ 4 ];\n\tS0 = sh[ 4 ];\n\tS1 = sh[ 3 ];\n\tS2 = sh[ 2 ];\n\tS3 = sh[ 1 ];\n\tS4 = sh[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {\n\t\treturn;\n\t}\n\to = broadcastArray( arrays[ 0 ], shapes[ 0 ], sh );\n\tx = o.data;\n\tst = o.strides;\n\tdx0 = st[ 4 ];\n\tdx1 = st[ 3 ];\n\tdx2 = st[ 2 ];\n\tdx3 = st[ 1 ];\n\tdx4 = st[ 0 ];\n\n\to = broadcastArray( arrays[ 1 ], shapes[ 1 ], sh );\n\ty = o.data;\n\tst = o.strides;\n\tdy0 = st[ 4 ];\n\tdy1 = st[ 3 ];\n\tdy2 = st[ 2 ];\n\tdy3 = st[ 1 ];\n\tdy4 = st[ 0 ];\n\n\to = broadcastArray( arrays[ 2 ], shapes[ 2 ], sh );\n\tz = o.data;\n\tst = o.strides;\n\tdz0 = st[ 4 ];\n\tdz1 = st[ 3 ];\n\tdz2 = st[ 2 ];\n\tdz3 = st[ 1 ];\n\tdz4 = st[ 0 ];\n\n\to = broadcastArray( arrays[ 3 ], shapes[ 3 ], sh );\n\tw = o.data;\n\tst = o.strides;\n\tdw0 = st[ 4 ];\n\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[ k0 ], z0[ m0 ], w0[ n0 ] );\n\t\t\t\t\t\tj0 += dx0;\n\t\t\t\t\t\tk0 += dy0;\n\t\t\t\t\t\tm0 += dz0;\n\t\t\t\t\t\tn0 += dw0;\n\t\t\t\t\t}\n\t\t\t\t\tj1 += dx1;\n\t\t\t\t\tk1 += dy1;\n\t\t\t\t\tm1 += dz1;\n\t\t\t\t\tn1 += dw1;\n\t\t\t\t}\n\t\t\t\tj2 += dx2;\n\t\t\t\tk2 += dy2;\n\t\t\t\tm2 += dz2;\n\t\t\t\tn2 += dw2;\n\t\t\t}\n\t\t\tj3 += dx3;\n\t\t\tk3 += dy3;\n\t\t\tm3 += dz3;\n\t\t\tn3 += dw3;\n\t\t}\n\t\tj4 += dx4;\n\t\tk4 += dy4;\n\t\tm4 += dz4;\n\t\tn4 += dw4;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = bquaternary5d;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Apply a quaternary callback to elements in four broadcasted input arrays and assign results to elements in a five-dimensional nested output array.\n*\n* @module @stdlib/array-base-broadcasted-quaternary5d\n*\n* @example\n* var add = require( '@stdlib/number-float64-base-add4' );\n* var ones5d = require( '@stdlib/array-base-ones5d' );\n* var zeros5d = require( '@stdlib/array-base-zeros5d' );\n* var bquaternary5d = require( '@stdlib/array-base-broadcasted-quaternary5d' );\n*\n* var shapes = [\n* [ 1, 1, 3, 1, 1 ],\n* [ 1, 1, 1, 3, 1 ],\n* [ 1, 1, 1, 1, 3 ],\n* [ 1, 1, 1, 1, 1 ],\n* [ 1, 1, 3, 3, 3 ]\n* ];\n*\n* var x = ones5d( shapes[ 0 ] );\n* var y = ones5d( shapes[ 1 ] );\n* var z = ones5d( shapes[ 2 ] );\n* var w = ones5d( shapes[ 3 ] );\n* var out = zeros5d( shapes[ 4 ] );\n*\n* bquaternary5d( [ x, y, z, w, out ], shapes, add );\n*\n* console.log( out );\n* // => [ [ [ [ [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ] ], [ [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ] ], [ [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ] ] ] ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
5
+ "mappings": "wGAAA,IAAAA,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAsBA,IAAIC,EAAiB,QAAS,oCAAqC,EAqCnE,SAASC,GAAeC,EAAQC,EAAQC,GAAM,CAC7C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,GACAC,GACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,EACAC,EACAC,EACAC,GACAC,GACAC,GACAC,GACAC,GAQJ,GANAP,EAAKxE,EAAQ,CAAE,EACfsB,EA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B,EAEPgB,GAAM9B,EACNmC,GAAM9B,EACNmC,GAAM9B,EACNmC,GAAM9B,CACP,CACAgB,GAAM9B,EACNmC,GAAM9B,EACNmC,GAAM9B,EACNmC,GAAM9B,CACP,CACAgB,GAAM9B,EACNmC,GAAM9B,EACNmC,GAAM9B,EACNmC,GAAM9B,EACP,CACAgB,GAAM9B,EACNmC,GAAM9B,EACNmC,GAAM9B,EACNmC,GAAM9B,EACP,CACD,CAKAzB,GAAO,QAAUE,KCjNjB,IAAIkF,GAAO,KAKX,OAAO,QAAUA",
6
+ "names": ["require_main", "__commonJSMin", "exports", "module", "broadcastArray", "bquaternary5d", "arrays", "shapes", "fcn", "dx0", "dx1", "dx2", "dx3", "dx4", "dy0", "dy1", "dy2", "dy3", "dy4", "dz0", "dz1", "dz2", "dz3", "dz4", "dw0", "dw1", "dw2", "dw3", "dw4", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "j0", "j1", "j2", "j3", "j4", "k0", "k1", "k2", "k3", "k4", "m0", "m1", "m2", "m3", "m4", "n0", "n1", "n2", "n3", "n4", "x0", "x1", "x2", "x3", "y0", "y1", "y2", "y3", "z0", "z1", "z2", "z3", "w0", "w1", "w2", "w3", "u0", "u1", "u2", "u3", "sh", "st", "o", "x", "y", "z", "w", "u", "main"]
7
+ }
@@ -0,0 +1,119 @@
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
+ // TypeScript Version: 4.1
20
+
21
+ /// <reference types="@stdlib/types"/>
22
+
23
+ import { Array1D, Array2D, Array3D, Array4D, Array5D } from '@stdlib/types/array';
24
+ import { Shape1D, Shape2D, Shape3D, Shape4D, Shape5D } from '@stdlib/types/ndarray';
25
+
26
+ /**
27
+ * Quaternary callback.
28
+ *
29
+ * @param v1 - element from first input array
30
+ * @param v2 - element from second input array
31
+ * @param v3 - element from third input array
32
+ * @param v4 - element from fourth input array
33
+ * @returns result
34
+ */
35
+ type Quaternary<T, U, V, W, X> = ( v1: T, v2: U, v3: V, v4: W ) => X;
36
+
37
+ /**
38
+ * Input array.
39
+ */
40
+ type InputArray<T> = Array1D<T> | Array2D<T> | Array3D<T> | Array4D<T> | Array5D<T>;
41
+
42
+ /**
43
+ * Input array shape.
44
+ */
45
+ type InputArrayShape = Shape1D | Shape2D | Shape3D | Shape4D | Shape5D;
46
+
47
+ /**
48
+ * Output array.
49
+ */
50
+ type OutputArray<T> = Array5D<T>;
51
+
52
+ /**
53
+ * Output array shape.
54
+ */
55
+ type OutputArrayShape = Shape5D;
56
+
57
+ /**
58
+ * Input and output arrays.
59
+ */
60
+ type InOutArrays<T, U, V, W, X> = [
61
+ InputArray<T>,
62
+ InputArray<U>,
63
+ InputArray<V>,
64
+ InputArray<W>,
65
+ OutputArray<X>
66
+ ];
67
+
68
+ /**
69
+ * Input and output array shapes.
70
+ */
71
+ type InOutShapes = [
72
+ InputArrayShape,
73
+ InputArrayShape,
74
+ InputArrayShape,
75
+ InputArrayShape,
76
+ OutputArrayShape
77
+ ];
78
+
79
+ /**
80
+ * Applies a quaternary callback to elements in four broadcasted input arrays and assigns results to elements in a five-dimensional nested output array.
81
+ *
82
+ * ## Notes
83
+ *
84
+ * - The input array shapes must be broadcast compatible with the output array shape.
85
+ *
86
+ * @param arrays - array containing four input nested arrays and one output nested array
87
+ * @param shapes - array shapes
88
+ * @param fcn - quaternary callback
89
+ *
90
+ * @example
91
+ * var add = require( '@stdlib/number-float64-base-add4' );
92
+ * var ones5d = require( '@stdlib/array-base-ones5d' );
93
+ * var zeros5d = require( '@stdlib/array-base-zeros5d' );
94
+ *
95
+ * var shapes = [
96
+ * [ 1, 1, 3, 1, 1 ],
97
+ * [ 1, 1, 1, 3, 1 ],
98
+ * [ 1, 1, 1, 1, 3 ],
99
+ * [ 1, 1, 1, 1, 1 ],
100
+ * [ 1, 1, 3, 3, 3 ]
101
+ * ];
102
+ *
103
+ * var x = ones5d( shapes[ 0 ] );
104
+ * var y = ones5d( shapes[ 1 ] );
105
+ * var z = ones5d( shapes[ 2 ] );
106
+ * var w = ones5d( shapes[ 3 ] );
107
+ * var out = zeros5d( shapes[ 4 ] );
108
+ *
109
+ * bquaternary5d( [ x, y, z, w, out ], shapes, add );
110
+ *
111
+ * console.log( out );
112
+ * // => [ [ [ [ [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ] ], [ [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ] ], [ [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ] ] ] ] ]
113
+ */
114
+ declare function bquaternary5d<T = unknown, U = unknown, V = unknown, W = unknown, X = unknown>( arrays: InOutArrays<T, U, V, W, X>, shapes: InOutShapes, fcn: Quaternary<T, U, V, W, X> ): void;
115
+
116
+
117
+ // EXPORTS //
118
+
119
+ export = bquaternary5d;
package/lib/index.js ADDED
@@ -0,0 +1,59 @@
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
+ /**
22
+ * Apply a quaternary callback to elements in four broadcasted input arrays and assign results to elements in a five-dimensional nested output array.
23
+ *
24
+ * @module @stdlib/array-base-broadcasted-quaternary5d
25
+ *
26
+ * @example
27
+ * var add = require( '@stdlib/number-float64-base-add4' );
28
+ * var ones5d = require( '@stdlib/array-base-ones5d' );
29
+ * var zeros5d = require( '@stdlib/array-base-zeros5d' );
30
+ * var bquaternary5d = require( '@stdlib/array-base-broadcasted-quaternary5d' );
31
+ *
32
+ * var shapes = [
33
+ * [ 1, 1, 3, 1, 1 ],
34
+ * [ 1, 1, 1, 3, 1 ],
35
+ * [ 1, 1, 1, 1, 3 ],
36
+ * [ 1, 1, 1, 1, 1 ],
37
+ * [ 1, 1, 3, 3, 3 ]
38
+ * ];
39
+ *
40
+ * var x = ones5d( shapes[ 0 ] );
41
+ * var y = ones5d( shapes[ 1 ] );
42
+ * var z = ones5d( shapes[ 2 ] );
43
+ * var w = ones5d( shapes[ 3 ] );
44
+ * var out = zeros5d( shapes[ 4 ] );
45
+ *
46
+ * bquaternary5d( [ x, y, z, w, out ], shapes, add );
47
+ *
48
+ * console.log( out );
49
+ * // => [ [ [ [ [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ] ], [ [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ] ], [ [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ] ] ] ] ]
50
+ */
51
+
52
+ // MODULES //
53
+
54
+ var main = require( './main.js' );
55
+
56
+
57
+ // EXPORTS //
58
+
59
+ module.exports = main;
package/lib/main.js ADDED
@@ -0,0 +1,263 @@
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 broadcastArray = require( '@stdlib/array-base-broadcast-array' );
24
+
25
+
26
+ // MAIN //
27
+
28
+ /**
29
+ * Applies a quaternary callback to elements in four broadcasted input arrays and assigns results to elements in a five-dimensional nested output array.
30
+ *
31
+ * @param {ArrayLikeObject<Array>} arrays - array-like object containing four input nested arrays and one output nested array
32
+ * @param {ArrayLikeObject<NonNegativeIntegerArray>} shapes - array shapes
33
+ * @param {Callback} fcn - quaternary callback
34
+ * @returns {void}
35
+ *
36
+ * @example
37
+ * var add = require( '@stdlib/number-float64-base-add4' );
38
+ * var ones5d = require( '@stdlib/array-base-ones5d' );
39
+ * var zeros5d = require( '@stdlib/array-base-zeros5d' );
40
+ *
41
+ * var shapes = [
42
+ * [ 1, 1, 3, 1, 1 ],
43
+ * [ 1, 1, 1, 3, 1 ],
44
+ * [ 1, 1, 1, 1, 3 ],
45
+ * [ 1, 1, 1, 1, 1 ],
46
+ * [ 1, 1, 3, 3, 3 ]
47
+ * ];
48
+ *
49
+ * var x = ones5d( shapes[ 0 ] );
50
+ * var y = ones5d( shapes[ 1 ] );
51
+ * var z = ones5d( shapes[ 2 ] );
52
+ * var w = ones5d( shapes[ 3 ] );
53
+ * var out = zeros5d( shapes[ 4 ] );
54
+ *
55
+ * bquaternary5d( [ x, y, z, w, out ], shapes, add );
56
+ *
57
+ * console.log( out );
58
+ * // => [ [ [ [ [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ] ], [ [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ] ], [ [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ], [ 4.0, 4.0, 4.0 ] ] ] ] ]
59
+ */
60
+ function bquaternary5d( arrays, shapes, fcn ) { // eslint-disable-line max-statements
61
+ var dx0;
62
+ var dx1;
63
+ var dx2;
64
+ var dx3;
65
+ var dx4;
66
+ var dy0;
67
+ var dy1;
68
+ var dy2;
69
+ var dy3;
70
+ var dy4;
71
+ var dz0;
72
+ var dz1;
73
+ var dz2;
74
+ var dz3;
75
+ var dz4;
76
+ var dw0;
77
+ var dw1;
78
+ var dw2;
79
+ var dw3;
80
+ var dw4;
81
+ var S0;
82
+ var S1;
83
+ var S2;
84
+ var S3;
85
+ var S4;
86
+ var i0;
87
+ var i1;
88
+ var i2;
89
+ var i3;
90
+ var i4;
91
+ var j0;
92
+ var j1;
93
+ var j2;
94
+ var j3;
95
+ var j4;
96
+ var k0;
97
+ var k1;
98
+ var k2;
99
+ var k3;
100
+ var k4;
101
+ var m0;
102
+ var m1;
103
+ var m2;
104
+ var m3;
105
+ var m4;
106
+ var n0;
107
+ var n1;
108
+ var n2;
109
+ var n3;
110
+ var n4;
111
+ var x0;
112
+ var x1;
113
+ var x2;
114
+ var x3;
115
+ var y0;
116
+ var y1;
117
+ var y2;
118
+ var y3;
119
+ var z0;
120
+ var z1;
121
+ var z2;
122
+ var z3;
123
+ var w0;
124
+ var w1;
125
+ var w2;
126
+ var w3;
127
+ var u0;
128
+ var u1;
129
+ var u2;
130
+ var u3;
131
+ var sh;
132
+ var st;
133
+ var o;
134
+ var x;
135
+ var y;
136
+ var z;
137
+ var w;
138
+ var u;
139
+
140
+ sh = shapes[ 4 ];
141
+ S0 = sh[ 4 ];
142
+ S1 = sh[ 3 ];
143
+ S2 = sh[ 2 ];
144
+ S3 = sh[ 1 ];
145
+ S4 = sh[ 0 ];
146
+ if ( S0 <= 0 || S1 <= 0 || S2 <= 0 || S3 <= 0 || S4 <= 0 ) {
147
+ return;
148
+ }
149
+ o = broadcastArray( arrays[ 0 ], shapes[ 0 ], sh );
150
+ x = o.data;
151
+ st = o.strides;
152
+ dx0 = st[ 4 ];
153
+ dx1 = st[ 3 ];
154
+ dx2 = st[ 2 ];
155
+ dx3 = st[ 1 ];
156
+ dx4 = st[ 0 ];
157
+
158
+ o = broadcastArray( arrays[ 1 ], shapes[ 1 ], sh );
159
+ y = o.data;
160
+ st = o.strides;
161
+ dy0 = st[ 4 ];
162
+ dy1 = st[ 3 ];
163
+ dy2 = st[ 2 ];
164
+ dy3 = st[ 1 ];
165
+ dy4 = st[ 0 ];
166
+
167
+ o = broadcastArray( arrays[ 2 ], shapes[ 2 ], sh );
168
+ z = o.data;
169
+ st = o.strides;
170
+ dz0 = st[ 4 ];
171
+ dz1 = st[ 3 ];
172
+ dz2 = st[ 2 ];
173
+ dz3 = st[ 1 ];
174
+ dz4 = st[ 0 ];
175
+
176
+ o = broadcastArray( arrays[ 3 ], shapes[ 3 ], sh );
177
+ w = o.data;
178
+ st = o.strides;
179
+ dw0 = st[ 4 ];
180
+ dw1 = st[ 3 ];
181
+ dw2 = st[ 2 ];
182
+ dw3 = st[ 1 ];
183
+ dw4 = st[ 0 ];
184
+
185
+ u = arrays[ 4 ];
186
+
187
+ j4 = 0;
188
+ k4 = 0;
189
+ m4 = 0;
190
+ n4 = 0;
191
+ for ( i4 = 0; i4 < S4; i4++ ) {
192
+ j3 = 0;
193
+ k3 = 0;
194
+ m3 = 0;
195
+ n3 = 0;
196
+ x3 = x[ j4 ];
197
+ y3 = y[ k4 ];
198
+ z3 = z[ m4 ];
199
+ w3 = w[ n4 ];
200
+ u3 = u[ i4 ];
201
+ for ( i3 = 0; i3 < S3; i3++ ) {
202
+ j2 = 0;
203
+ k2 = 0;
204
+ m2 = 0;
205
+ n2 = 0;
206
+ x2 = x3[ j3 ];
207
+ y2 = y3[ k3 ];
208
+ z2 = z3[ m3 ];
209
+ w2 = w3[ n3 ];
210
+ u2 = u3[ i3 ];
211
+ for ( i2 = 0; i2 < S2; i2++ ) {
212
+ j1 = 0;
213
+ k1 = 0;
214
+ m1 = 0;
215
+ n1 = 0;
216
+ x1 = x2[ j2 ];
217
+ y1 = y2[ k2 ];
218
+ z1 = z2[ m2 ];
219
+ w1 = w2[ n2 ];
220
+ u1 = u2[ i2 ];
221
+ for ( i1 = 0; i1 < S1; i1++ ) {
222
+ j0 = 0;
223
+ k0 = 0;
224
+ m0 = 0;
225
+ n0 = 0;
226
+ x0 = x1[ j1 ];
227
+ y0 = y1[ k1 ];
228
+ z0 = z1[ m1 ];
229
+ w0 = w1[ n1 ];
230
+ u0 = u1[ i1 ];
231
+ for ( i0 = 0; i0 < S0; i0++ ) {
232
+ u0[ i0 ] = fcn( x0[ j0 ], y0[ k0 ], z0[ m0 ], w0[ n0 ] );
233
+ j0 += dx0;
234
+ k0 += dy0;
235
+ m0 += dz0;
236
+ n0 += dw0;
237
+ }
238
+ j1 += dx1;
239
+ k1 += dy1;
240
+ m1 += dz1;
241
+ n1 += dw1;
242
+ }
243
+ j2 += dx2;
244
+ k2 += dy2;
245
+ m2 += dz2;
246
+ n2 += dw2;
247
+ }
248
+ j3 += dx3;
249
+ k3 += dy3;
250
+ m3 += dz3;
251
+ n3 += dw3;
252
+ }
253
+ j4 += dx4;
254
+ k4 += dy4;
255
+ m4 += dz4;
256
+ n4 += dw4;
257
+ }
258
+ }
259
+
260
+
261
+ // EXPORTS //
262
+
263
+ module.exports = bquaternary5d;
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@stdlib/array-base-broadcasted-quaternary5d",
3
+ "version": "0.1.0",
4
+ "description": "Apply a quaternary callback to elements in four broadcasted input arrays and assign results to elements in a five-dimensional nested output array.",
5
+ "license": "Apache-2.0",
6
+ "author": {
7
+ "name": "The Stdlib Authors",
8
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
9
+ },
10
+ "contributors": [
11
+ {
12
+ "name": "The Stdlib Authors",
13
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
14
+ }
15
+ ],
16
+ "main": "./lib",
17
+ "directories": {
18
+ "doc": "./docs",
19
+ "lib": "./lib",
20
+ "dist": "./dist"
21
+ },
22
+ "types": "./docs/types",
23
+ "scripts": {},
24
+ "homepage": "https://stdlib.io",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git://github.com/stdlib-js/array-base-broadcasted-quaternary5d.git"
28
+ },
29
+ "bugs": {
30
+ "url": "https://github.com/stdlib-js/stdlib/issues"
31
+ },
32
+ "dependencies": {
33
+ "@stdlib/array-base-broadcast-array": "^0.2.2"
34
+ },
35
+ "devDependencies": {},
36
+ "engines": {
37
+ "node": ">=0.10.0",
38
+ "npm": ">2.7.0"
39
+ },
40
+ "os": [
41
+ "aix",
42
+ "darwin",
43
+ "freebsd",
44
+ "linux",
45
+ "macos",
46
+ "openbsd",
47
+ "sunos",
48
+ "win32",
49
+ "windows"
50
+ ],
51
+ "keywords": [
52
+ "stdlib",
53
+ "base",
54
+ "array",
55
+ "multidimensional",
56
+ "ndarray",
57
+ "matrix",
58
+ "5d",
59
+ "quaternary",
60
+ "apply",
61
+ "foreach",
62
+ "map",
63
+ "transform",
64
+ "broadcast"
65
+ ],
66
+ "funding": {
67
+ "type": "opencollective",
68
+ "url": "https://opencollective.com/stdlib"
69
+ }
70
+ }