File tree Expand file tree Collapse file tree 1 file changed +57
-0
lines changed
lib/node_modules/@stdlib/ndarray/base/unary-reduce-strided1d-to-struct/lib Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 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
+ // MAIN //
22
+
23
+ /**
24
+ * Initialize ndarray-like objects for representing zero-dimensional sub-array views of the output and ancillary ndarray arguments.
25
+ *
26
+ * ## Notes
27
+ *
28
+ * - This function ignores the first ndarray-like object, which is assumed to be the input ndarray.
29
+ * - This function mutates the provided output array.
30
+ *
31
+ * @private
32
+ * @param {ArrayLikeObject<Object> } arrays - list of ndarray-like objects
33
+ * @param {Array<Object> } out - output array
34
+ * @returns {Array<Object> } output array
35
+ */
36
+ function initializeViews ( arrays , out ) {
37
+ var v ;
38
+ var i ;
39
+
40
+ for ( i = 1 ; i < arrays . length ; i ++ ) {
41
+ v = arrays [ i ] ;
42
+ out . push ( {
43
+ 'dtype' : v . dtype ,
44
+ 'data' : v . data ,
45
+ 'shape' : [ ] ,
46
+ 'strides' : [ 0 ] ,
47
+ 'offset' : v . offset ,
48
+ 'order' : v . order
49
+ } ) ;
50
+ }
51
+ return out ;
52
+ }
53
+
54
+
55
+ // EXPORTS //
56
+
57
+ module . exports = initializeViews ;
You can’t perform that action at this time.
0 commit comments