You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -820,6 +820,14 @@ A total of 45 issues were closed in this release:
820
820
821
821
<details>
822
822
823
+
- [`c13dd70`](https://github.com/stdlib-js/stdlib/commit/c13dd703daff4a5893dac860a78fe6e0631e68ec) - **refactor:** normalize dtypes to enums to reduce memory consumption and speed-up comparisons _(by Athan Reines)_
824
+
- [`2041e12`](https://github.com/stdlib-js/stdlib/commit/2041e12c968c4bd6f4a4f051271aacaa65727a6d) - **docs:** ensure support for dtype instances and update examples _(by Athan Reines)_
825
+
- [`88a7c4d`](https://github.com/stdlib-js/stdlib/commit/88a7c4de78c60740018a7038279248e48a2019cc) - **refactor:** add support for ancillary ndarray arguments having trailing dimensions _(by Athan Reines)_
826
+
- [`9929838`](https://github.com/stdlib-js/stdlib/commit/99298389ec07331f424d4a8ed570d974d7ad3c44) - **refactor:** add support for ancillary ndarray arguments having trailing dimensions _(by Athan Reines)_
827
+
- [`ed8da6f`](https://github.com/stdlib-js/stdlib/commit/ed8da6f296e6031ef298cbeeb03ee121fdf0d0a7) - **refactor:** add support for ancillary ndarray arguments having trailing dimensions _(by Athan Reines)_
828
+
- [`94e56f0`](https://github.com/stdlib-js/stdlib/commit/94e56f0ce160c8d5409fd7750ff42c4249704e5c) - **refactor:** add support for ancillary ndarray arguments having trailing dimensions _(by Athan Reines)_
829
+
- [`07462e4`](https://github.com/stdlib-js/stdlib/commit/07462e494d3442559bb88d713009f50f9130b33e) - **refactor:** support ancillary ndarray arguments with trailing dimensions _(by Athan Reines)_
- [`c8df03c`](https://github.com/stdlib-js/stdlib/commit/c8df03cfe4cb5362cfff5f981aff4c0abc6d0e5a) - **refactor:** add support for ancilliary ndarrays which decompose into subarrays _(by Athan Reines)_
Copy file name to clipboardExpand all lines: base/unary-reduce-strided1d-assign-struct/README.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -154,7 +154,11 @@ Each provided ndarray should be an object with the following properties:
154
154
155
155
## Notes
156
156
157
-
- The output ndarray and any additional ndarray arguments are expected to have the same dimensions as the non-reduced dimensions of the input ndarray. When calling the reduction function, any additional ndarray arguments are provided as zero-dimensional ndarray-like objects.
157
+
- The output ndarray is expected to have the same dimensions as the non-reduced dimensions of the input ndarray.
158
+
159
+
- Any additional ndarray arguments are expected to have the same leading dimensions as the non-reduced dimensions of the input ndarray.
160
+
161
+
- When calling the reduction function, any additional ndarray arguments are provided as k-dimensional subarrays, where `k = M - N` with `M` being the number of dimensions in an ndarray argument and `N` being the number of non-reduced dimensions in the input ndarray. For example, if an input ndarray has three dimensions, the number of reduced dimensions is two, and an additional ndarray argument has one dimension, thus matching the number of non-reduced dimensions in the input ndarray, the reduction function is provided a zero-dimensional subarray as an additional ndarray argument. In the same scenario but where an additional ndarray argument has two dimensions, thus exceeding the number of non-reduced dimensions in the input ndarray, the reduction function is provided a one-dimensional subarray as an additional ndarray argument.
158
162
159
163
- The reduction function is expected to have the following signature:
160
164
@@ -164,7 +168,7 @@ Each provided ndarray should be an object with the following properties:
164
168
165
169
where
166
170
167
-
- **arrays**: array containing a one-dimensional subarray of the input ndarray, a zero-dimensional subarray of the output ndarray containing the output [`struct`][@stdlib/dstructs/struct] object, and any additional ndarray arguments as zero-dimensional ndarrays.
171
+
- **arrays**: array containing a one-dimensional subarray of the input ndarray, a zero-dimensional subarray of the output ndarray containing the output [`struct`][@stdlib/dstructs/struct] object, and any additional ndarray arguments as subarrays.
168
172
- **options**: function options (_optional_).
169
173
170
174
- For very high-dimensional ndarrays which are non-contiguous, one should consider copying the underlying data to contiguous memory before performing a reduction in order to achieve better performance.
thrownewRangeError(format('invalid argument. Number of specified dimensions cannot exceed the number of dimensions in the input array. Number of dimensions: %d. Value: [%s].',ndims,join(dims,',')));
418
418
}
419
-
// Verify that provided ndarrays have the expected number of dimensions...
419
+
// Compute the number of non-reduced dimensions:
420
420
K=ndims-M;
421
-
for(i=1;i<N;i++){
422
-
if(arr[i].shape.length!==K){
421
+
422
+
// Verify that the output ndarray has the expected number of dimensions...
423
+
if(arr[1].shape.length!==K){
424
+
thrownewError(format('invalid argument. Arrays which are not being reduced must have the same number of non-reduced dimensions. Input array shape: [%s]. Number of non-reduced dimensions: %d. Array shape: [%s] (index: %d).',join(shx,','),K,join(arr[1].shape,','),1));
425
+
}
426
+
// Verify that any ancillary ndarrays have at least the number of non-reduced dimensions...
427
+
for(i=2;i<N;i++){
428
+
if(arr[i].shape.length<K){
423
429
thrownewError(format('invalid argument. Arrays which are not being reduced must have the same number of non-reduced dimensions. Input array shape: [%s]. Number of non-reduced dimensions: %d. Array shape: [%s] (index: %d).',join(shx,','),K,join(arr[i].shape,','),i));
// Determine whether the loop dimensions have only **one** non-singleton dimension (e.g., shape=[10,1,1,1]) so that we can treat loop iteration as being equivalent to one-dimensional iteration...
486
490
if(ns===K-1){
487
491
// Get the index of the non-singleton dimension...
Copy file name to clipboardExpand all lines: base/unary-reduce-strided1d-by/README.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -195,7 +195,11 @@ var count = ctx.count;
195
195
196
196
## Notes
197
197
198
-
- The output ndarray and any additional ndarray arguments are expected to have the same dimensions as the non-reduced dimensions of the input ndarray. When calling the reduction function, any additional ndarray arguments are provided as zero-dimensional ndarray-like objects.
198
+
- The output ndarray is expected to have the same dimensions as the non-reduced dimensions of the input ndarray.
199
+
200
+
- Any additional ndarray arguments are expected to have the same leading dimensions as the non-reduced dimensions of the input ndarray.
201
+
202
+
- When calling the reduction function, any additional ndarray arguments are provided as k-dimensional subarrays, where `k = M - N` with `M` being the number of dimensions in an ndarray argument and `N` being the number of non-reduced dimensions in the input ndarray. For example, if an input ndarray has three dimensions, the number of reduced dimensions is two, and an additional ndarray argument has one dimension, thus matching the number of non-reduced dimensions in the input ndarray, the reduction function is provided a zero-dimensional subarray as an additional ndarray argument. In the same scenario but where an additional ndarray argument has two dimensions, thus exceeding the number of non-reduced dimensions in the input ndarray, the reduction function is provided a one-dimensional subarray as an additional ndarray argument.
199
203
200
204
- The reduction function is expected to have the following signature:
201
205
@@ -205,7 +209,7 @@ var count = ctx.count;
205
209
206
210
where
207
211
208
-
- **arrays**: array containing a one-dimensional subarray of the input ndarray and any additional ndarray arguments as zero-dimensional ndarrays.
212
+
- **arrays**: array containing a one-dimensional subarray of the input ndarray and any additional ndarray arguments as subarrays.
thrownewRangeError(format('invalid argument. Number of specified dimensions cannot exceed the number of dimensions in the input array. Number of dimensions: %d. Value: [%s].',ndims,join(dims,',')));
393
393
}
394
-
// Verify that provided ndarrays have the expected number of dimensions...
394
+
// Compute the number of non-reduced dimensions:
395
395
K=ndims-M;
396
-
for(i=1;i<N;i++){
397
-
if(arr[i].shape.length!==K){
396
+
397
+
// Verify that the output ndarray has the expected number of dimensions...
398
+
if(arr[1].shape.length!==K){
399
+
thrownewError(format('invalid argument. Arrays which are not being reduced must have the same number of non-reduced dimensions. Input array shape: [%s]. Number of non-reduced dimensions: %d. Array shape: [%s] (index: %d).',join(shx,','),K,join(arr[1].shape,','),1));
400
+
}
401
+
// Verify that any ancillary ndarrays have at least the number of non-reduced dimensions...
402
+
for(i=2;i<N;i++){
403
+
if(arr[i].shape.length<K){
398
404
thrownewError(format('invalid argument. Arrays which are not being reduced must have the same number of non-reduced dimensions. Input array shape: [%s]. Number of non-reduced dimensions: %d. Array shape: [%s] (index: %d).',join(shx,','),K,join(arr[i].shape,','),i));
0 commit comments