@stdlib/ndarray-base-binary-reduce-strided1d 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.
Files changed (57) hide show
  1. package/LICENSE +177 -0
  2. package/NOTICE +1 -0
  3. package/README.md +307 -0
  4. package/SECURITY.md +5 -0
  5. package/dist/index.js +101 -0
  6. package/dist/index.js.map +7 -0
  7. package/lib/0d.js +118 -0
  8. package/lib/0d_accessors.js +124 -0
  9. package/lib/10d.js +365 -0
  10. package/lib/10d_accessors.js +374 -0
  11. package/lib/10d_blocked.js +429 -0
  12. package/lib/10d_blocked_accessors.js +438 -0
  13. package/lib/1d.js +186 -0
  14. package/lib/1d_accessors.js +195 -0
  15. package/lib/2d.js +221 -0
  16. package/lib/2d_accessors.js +230 -0
  17. package/lib/2d_blocked.js +245 -0
  18. package/lib/2d_blocked_accessors.js +254 -0
  19. package/lib/3d.js +239 -0
  20. package/lib/3d_accessors.js +248 -0
  21. package/lib/3d_blocked.js +268 -0
  22. package/lib/3d_blocked_accessors.js +277 -0
  23. package/lib/4d.js +257 -0
  24. package/lib/4d_accessors.js +266 -0
  25. package/lib/4d_blocked.js +291 -0
  26. package/lib/4d_blocked_accessors.js +300 -0
  27. package/lib/5d.js +275 -0
  28. package/lib/5d_accessors.js +284 -0
  29. package/lib/5d_blocked.js +314 -0
  30. package/lib/5d_blocked_accessors.js +323 -0
  31. package/lib/6d.js +293 -0
  32. package/lib/6d_accessors.js +302 -0
  33. package/lib/6d_blocked.js +337 -0
  34. package/lib/6d_blocked_accessors.js +346 -0
  35. package/lib/7d.js +311 -0
  36. package/lib/7d_accessors.js +320 -0
  37. package/lib/7d_blocked.js +360 -0
  38. package/lib/7d_blocked_accessors.js +369 -0
  39. package/lib/8d.js +329 -0
  40. package/lib/8d_accessors.js +338 -0
  41. package/lib/8d_blocked.js +383 -0
  42. package/lib/8d_blocked_accessors.js +392 -0
  43. package/lib/9d.js +347 -0
  44. package/lib/9d_accessors.js +356 -0
  45. package/lib/9d_blocked.js +406 -0
  46. package/lib/9d_blocked_accessors.js +415 -0
  47. package/lib/factory.js +133 -0
  48. package/lib/increment_offsets.js +46 -0
  49. package/lib/index.js +175 -0
  50. package/lib/initialize_array_views.js +57 -0
  51. package/lib/main.js +573 -0
  52. package/lib/nd.js +189 -0
  53. package/lib/nd_accessors.js +198 -0
  54. package/lib/offsets.js +42 -0
  55. package/lib/reshape_strategy.js +260 -0
  56. package/lib/set_view_offsets.js +52 -0
  57. package/package.json +91 -0
@@ -0,0 +1,52 @@
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
+ * Sets view offsets according to a list of index offsets.
25
+ *
26
+ * ## Notes
27
+ *
28
+ * - This function skips the third element in the list of index offsets, as that is assumed to correspond to the output ndarray which does not have a corresponding view. Meaning, the list of views is expected to have `N` elements, and the list of index offsets is expected to have `N+1` elements.
29
+ * - This function mutates the provides view objects.
30
+ *
31
+ * @private
32
+ * @param {Array<Object>} views - list of ndarray-like objects representing ndarray views
33
+ * @param {NonNegativeIntegerArray} offsets - list of index offsets
34
+ * @returns {Array<Object>} updated views
35
+ */
36
+ function setViewOffsets( views, offsets ) {
37
+ var i;
38
+ var j;
39
+ for ( i = 0, j = 0; i < offsets.length; i++ ) {
40
+ if ( i === 2 ) { // note: expected to correspond to the output ndarray which does not have a corresponding view
41
+ continue;
42
+ }
43
+ views[ j ].offset = offsets[ i ];
44
+ j += 1;
45
+ }
46
+ return views;
47
+ }
48
+
49
+
50
+ // EXPORTS //
51
+
52
+ module.exports = setViewOffsets;
package/package.json ADDED
@@ -0,0 +1,91 @@
1
+ {
2
+ "name": "@stdlib/ndarray-base-binary-reduce-strided1d",
3
+ "version": "0.1.0",
4
+ "description": "Perform a reduction over a list of specified dimensions in two input ndarrays via a one-dimensional strided array reduction function and assign results to a provided output ndarray.",
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/ndarray-base-binary-reduce-strided1d.git"
28
+ },
29
+ "bugs": {
30
+ "url": "https://github.com/stdlib-js/stdlib/issues"
31
+ },
32
+ "dependencies": {
33
+ "@stdlib/array-base-any-is-entry-in": "^0.1.0",
34
+ "@stdlib/array-base-copy-indexed": "^0.2.2",
35
+ "@stdlib/array-base-indices-complement": "^0.1.0",
36
+ "@stdlib/array-base-join": "^0.1.1",
37
+ "@stdlib/array-base-take-indexed": "^0.2.2",
38
+ "@stdlib/array-base-take-indexed2": "^0.1.0",
39
+ "@stdlib/array-base-without": "github:stdlib-js/array-base-without#main",
40
+ "@stdlib/array-base-zeros": "^0.2.2",
41
+ "@stdlib/assert-is-function": "^0.2.2",
42
+ "@stdlib/ndarray-base-assign": "^0.1.1",
43
+ "@stdlib/ndarray-base-binary-loop-interchange-order": "^0.2.2",
44
+ "@stdlib/ndarray-base-binary-tiling-block-size": "^0.2.2",
45
+ "@stdlib/ndarray-base-empty-like": "^0.3.0",
46
+ "@stdlib/ndarray-base-iteration-order": "^0.2.2",
47
+ "@stdlib/ndarray-base-minmax-view-buffer-index": "^0.2.2",
48
+ "@stdlib/ndarray-base-ndarraylike2ndarray": "github:stdlib-js/ndarray-base-ndarraylike2ndarray#main",
49
+ "@stdlib/ndarray-base-ndarraylike2object": "^0.2.2",
50
+ "@stdlib/ndarray-base-numel": "^0.2.2",
51
+ "@stdlib/ndarray-base-strides2order": "^0.2.2",
52
+ "@stdlib/ndarray-base-to-unique-normalized-indices": "^0.1.0",
53
+ "@stdlib/ndarray-base-vind2bind": "^0.2.2",
54
+ "@stdlib/string-format": "^0.2.2",
55
+ "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2",
56
+ "@stdlib/error-tools-fmtprodmsg": "^0.2.2"
57
+ },
58
+ "devDependencies": {},
59
+ "engines": {
60
+ "node": ">=0.10.0",
61
+ "npm": ">2.7.0"
62
+ },
63
+ "os": [
64
+ "aix",
65
+ "darwin",
66
+ "freebsd",
67
+ "linux",
68
+ "macos",
69
+ "openbsd",
70
+ "sunos",
71
+ "win32",
72
+ "windows"
73
+ ],
74
+ "keywords": [
75
+ "stdlib",
76
+ "base",
77
+ "strided",
78
+ "array",
79
+ "ndarray",
80
+ "binary",
81
+ "reduce",
82
+ "reduction",
83
+ "accumulate",
84
+ "accumulation",
85
+ "vector"
86
+ ],
87
+ "funding": {
88
+ "type": "opencollective",
89
+ "url": "https://opencollective.com/stdlib"
90
+ }
91
+ }