Skip to content

Commit fa53f07

Browse files
committed
Auto-generated commit
1 parent 2018379 commit fa53f07

File tree

40 files changed

+8814
-11
lines changed

40 files changed

+8814
-11
lines changed

CHANGELOG.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,23 @@
1010

1111
### Features
1212

13+
- [`0f1545f`](https://github.com/stdlib-js/stdlib/commit/0f1545fc6d22ad051bdae2f081f26d1d56cc9538) - add package entry point
14+
- [`142e477`](https://github.com/stdlib-js/stdlib/commit/142e4774ab7acbd79e76ff5f9f6e0ae47f70dae4) - add `factory` function
15+
- [`a752e25`](https://github.com/stdlib-js/stdlib/commit/a752e25ef1735c0253d3d3feb95dda2d145d5f1e) - add main entry point
16+
- [`ba8eed7`](https://github.com/stdlib-js/stdlib/commit/ba8eed78f0ffcb83ba752cf3ee2a841e9cf1a4b6) - add remaining kernels
17+
- [`af25b04`](https://github.com/stdlib-js/stdlib/commit/af25b04f00af720af3890f850dc5ea972d3711bb) - add 6d blocked kernel
18+
- [`c401a2a`](https://github.com/stdlib-js/stdlib/commit/c401a2a226b4589bf127cbb5e26e131a4aa39581) - add 6d kernel
19+
- [`2b3907f`](https://github.com/stdlib-js/stdlib/commit/2b3907fa3f5e2653f42d6be9b3ec3786880f4833) - add 5d blocked kernel
20+
- [`4e16eb2`](https://github.com/stdlib-js/stdlib/commit/4e16eb22dfe611c8649d40888fa4f1404bd6d329) - add 5d kernel
21+
- [`266d60a`](https://github.com/stdlib-js/stdlib/commit/266d60a3ec0b6d234f231c61e196a0ba0712dc79) - add 4d blocked kernel
22+
- [`22397d6`](https://github.com/stdlib-js/stdlib/commit/22397d61d7a0fdb3ae820434f6c256d1bb03dd09) - add 4d kernel
23+
- [`9942682`](https://github.com/stdlib-js/stdlib/commit/9942682d6e7ac1ab8f3a31a5868e3f32e2273d8a) - add 3d blocked kernel
24+
- [`6f4f47e`](https://github.com/stdlib-js/stdlib/commit/6f4f47e6d22ce8f9ae965d82112d229e19c7ca1f) - add 3d kernel
25+
- [`e152a98`](https://github.com/stdlib-js/stdlib/commit/e152a988d68f191b128cf5344812f423daee8099) - add 2d blocked kernel
26+
- [`bd392dc`](https://github.com/stdlib-js/stdlib/commit/bd392dcc6062a41edb281b4f87b70dc5485b9491) - add nd kernel
27+
- [`4d30065`](https://github.com/stdlib-js/stdlib/commit/4d3006542bd1526d173c1d56833249b6a000bd62) - add 2d kernel
28+
- [`f65a6ef`](https://github.com/stdlib-js/stdlib/commit/f65a6ef86b94fee9ba3ae0e7c5848002c6a32c56) - add 1d kernel
29+
- [`c9b5f5e`](https://github.com/stdlib-js/stdlib/commit/c9b5f5ecac19ea4602086a9f7dbc9c34938fb13d) - add 0d kernel
1330
- [`b1f7e33`](https://github.com/stdlib-js/stdlib/commit/b1f7e33277d00292ca5b45de636eaf80b3d45c22) - add `ndarraylike2scalar` to namespace
1431
- [`7a8bc40`](https://github.com/stdlib-js/stdlib/commit/7a8bc400fc2e1dd6a5edabc750bb75f4f665c041) - add `ndarray/base/ndarraylike2scalar`
1532
- [`eac188f`](https://github.com/stdlib-js/stdlib/commit/eac188f4def9fa545e9e0cfcd5731a66337fcd1a) - add support for struct data types
@@ -445,6 +462,38 @@ A total of 20 issues were closed in this release:
445462

446463
<details>
447464

465+
- [`b8cacc1`](https://github.com/stdlib-js/stdlib/commit/b8cacc136fceed774024cbbe0c24fc07f2675636) - **docs:** add README and fix docs _(by Athan Reines)_
466+
- [`c2e0a60`](https://github.com/stdlib-js/stdlib/commit/c2e0a60dfb54b54cd60a1a3c510fec38abf74c49) - **test:** add initial test stub _(by Athan Reines)_
467+
- [`43a64a5`](https://github.com/stdlib-js/stdlib/commit/43a64a54569efd99a3c03654f56e8e533d59dcfb) - **docs:** add examples _(by Athan Reines)_
468+
- [`0f1545f`](https://github.com/stdlib-js/stdlib/commit/0f1545fc6d22ad051bdae2f081f26d1d56cc9538) - **feat:** add package entry point _(by Athan Reines)_
469+
- [`142e477`](https://github.com/stdlib-js/stdlib/commit/142e4774ab7acbd79e76ff5f9f6e0ae47f70dae4) - **feat:** add `factory` function _(by Athan Reines)_
470+
- [`a752e25`](https://github.com/stdlib-js/stdlib/commit/a752e25ef1735c0253d3d3feb95dda2d145d5f1e) - **feat:** add main entry point _(by Athan Reines)_
471+
- [`ba8eed7`](https://github.com/stdlib-js/stdlib/commit/ba8eed78f0ffcb83ba752cf3ee2a841e9cf1a4b6) - **feat:** add remaining kernels _(by Athan Reines)_
472+
- [`81ce090`](https://github.com/stdlib-js/stdlib/commit/81ce090ad67eac64691e78508cfdc447a99b9fd7) - **docs:** update comment _(by Athan Reines)_
473+
- [`af25b04`](https://github.com/stdlib-js/stdlib/commit/af25b04f00af720af3890f850dc5ea972d3711bb) - **feat:** add 6d blocked kernel _(by Athan Reines)_
474+
- [`c401a2a`](https://github.com/stdlib-js/stdlib/commit/c401a2a226b4589bf127cbb5e26e131a4aa39581) - **feat:** add 6d kernel _(by Athan Reines)_
475+
- [`2b3907f`](https://github.com/stdlib-js/stdlib/commit/2b3907fa3f5e2653f42d6be9b3ec3786880f4833) - **feat:** add 5d blocked kernel _(by Athan Reines)_
476+
- [`4e16eb2`](https://github.com/stdlib-js/stdlib/commit/4e16eb22dfe611c8649d40888fa4f1404bd6d329) - **feat:** add 5d kernel _(by Athan Reines)_
477+
- [`266d60a`](https://github.com/stdlib-js/stdlib/commit/266d60a3ec0b6d234f231c61e196a0ba0712dc79) - **feat:** add 4d blocked kernel _(by Athan Reines)_
478+
- [`22397d6`](https://github.com/stdlib-js/stdlib/commit/22397d61d7a0fdb3ae820434f6c256d1bb03dd09) - **feat:** add 4d kernel _(by Athan Reines)_
479+
- [`9942682`](https://github.com/stdlib-js/stdlib/commit/9942682d6e7ac1ab8f3a31a5868e3f32e2273d8a) - **feat:** add 3d blocked kernel _(by Athan Reines)_
480+
- [`6f4f47e`](https://github.com/stdlib-js/stdlib/commit/6f4f47e6d22ce8f9ae965d82112d229e19c7ca1f) - **feat:** add 3d kernel _(by Athan Reines)_
481+
- [`e152a98`](https://github.com/stdlib-js/stdlib/commit/e152a988d68f191b128cf5344812f423daee8099) - **feat:** add 2d blocked kernel _(by Athan Reines)_
482+
- [`bd392dc`](https://github.com/stdlib-js/stdlib/commit/bd392dcc6062a41edb281b4f87b70dc5485b9491) - **feat:** add nd kernel _(by Athan Reines)_
483+
- [`aa126ca`](https://github.com/stdlib-js/stdlib/commit/aa126cac3c9fccd378bb3a936f9b8bcb6f580651) - **docs:** add REPL help _(by Athan Reines)_
484+
- [`2cc4943`](https://github.com/stdlib-js/stdlib/commit/2cc4943bf4042480bc123365f3943bced574ae17) - **docs:** fix example _(by Athan Reines)_
485+
- [`94d843a`](https://github.com/stdlib-js/stdlib/commit/94d843af73c57022a0ebf76e8c5316fe1493f09c) - **docs:** fix example _(by Athan Reines)_
486+
- [`19385a6`](https://github.com/stdlib-js/stdlib/commit/19385a661da9d3460d7328e456b5b59347c908f7) - **docs:** fix example _(by Athan Reines)_
487+
- [`c90080b`](https://github.com/stdlib-js/stdlib/commit/c90080b29f28aabee615d9f72a13c78cc6581436) - **docs:** fix example _(by Athan Reines)_
488+
- [`f628312`](https://github.com/stdlib-js/stdlib/commit/f628312bf9eada1a982b2563d3aa65908e29a476) - **docs:** fix example _(by Athan Reines)_
489+
- [`c4b89f1`](https://github.com/stdlib-js/stdlib/commit/c4b89f114fba9a82c26d0e1610784fc2113f6c5e) - **refactor:** add function to resolve a reshape strategy _(by Athan Reines)_
490+
- [`6de44d2`](https://github.com/stdlib-js/stdlib/commit/6de44d2a564e2f01c974cf11c65eff0bba624083) - **refactor:** add function to set view offsets _(by Athan Reines)_
491+
- [`e86640c`](https://github.com/stdlib-js/stdlib/commit/e86640cfc69ab81fb3c9f21363cf6b695a69181f) - **refactor:** add function to resolve offsets _(by Athan Reines)_
492+
- [`ceae67b`](https://github.com/stdlib-js/stdlib/commit/ceae67bbc4cb19fdc314ac6cc301fb37613730aa) - **refactor:** add function to initialize array views _(by Athan Reines)_
493+
- [`3864776`](https://github.com/stdlib-js/stdlib/commit/38647769542d8a285c56f95bca47b5a528b45323) - **refactor:** add function to increment offsets _(by Athan Reines)_
494+
- [`4d30065`](https://github.com/stdlib-js/stdlib/commit/4d3006542bd1526d173c1d56833249b6a000bd62) - **feat:** add 2d kernel _(by Athan Reines)_
495+
- [`f65a6ef`](https://github.com/stdlib-js/stdlib/commit/f65a6ef86b94fee9ba3ae0e7c5848002c6a32c56) - **feat:** add 1d kernel _(by Athan Reines)_
496+
- [`c9b5f5e`](https://github.com/stdlib-js/stdlib/commit/c9b5f5ecac19ea4602086a9f7dbc9c34938fb13d) - **feat:** add 0d kernel _(by Athan Reines)_
448497
- [`6bc3cd0`](https://github.com/stdlib-js/stdlib/commit/6bc3cd01d5760daa41777a070aae6a9d6b476d44) - **docs:** update examples _(by Athan Reines)_
449498
- [`b1f7e33`](https://github.com/stdlib-js/stdlib/commit/b1f7e33277d00292ca5b45de636eaf80b3d45c22) - **feat:** add `ndarraylike2scalar` to namespace _(by Athan Reines)_
450499
- [`7a8bc40`](https://github.com/stdlib-js/stdlib/commit/7a8bc400fc2e1dd6a5edabc750bb75f4f665c041) - **feat:** add `ndarray/base/ndarraylike2scalar` _(by Athan Reines)_

base/unary-reduce-strided1d-by/docs/repl.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,15 @@
8181
... };
8282

8383
// Using minimal ndarray-like objects...
84-
> x = {
84+
> var x = {
8585
... 'dtype': dtype,
8686
... 'data': xbuf,
8787
... 'shape': shx,
8888
... 'strides': sx,
8989
... 'offset': ox,
9090
... 'order': order
9191
... };
92-
> y = {
92+
> var y = {
9393
... 'dtype': dtype,
9494
... 'data': ybuf,
9595
... 'shape': shy,
Lines changed: 268 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,268 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2025 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+
# unaryReduceStrided1d
22+
23+
> Perform a reduction over a list of specified dimensions in an input ndarray via a one-dimensional strided array reduction function and assign results to a provided output ndarray.
24+
25+
<section class="intro">
26+
27+
</section>
28+
29+
<!-- /.intro -->
30+
31+
<section class="usage">
32+
33+
## Usage
34+
35+
```javascript
36+
var unaryReduceStrided1d = require( '@stdlib/ndarray/base/unary-reduce-strided1d-to-struct' );
37+
```
38+
39+
#### unaryReduceStrided1d( fcn, arrays, dims\[, options] )
40+
41+
Performs a reduction over a list of specified dimensions in an input ndarray via a one-dimensional strided array reduction function and assigns results to a provided output ndarray.
42+
43+
<!-- eslint-disable max-len -->
44+
45+
```javascript
46+
var Float64Array = require( '@stdlib/array/float64' );
47+
var ndarray2array = require( '@stdlib/ndarray/base/to-array' );
48+
var Float64Results = require( '@stdlib/stats/base/ztest/one-sample/results/float64' );
49+
var structFactory = require( '@stdlib/array/struct-factory' );
50+
var ztest = require( '@stdlib/stats/base/ndarray/ztest' );
51+
52+
var ResultsArray = structFactory( Float64Results );
53+
54+
// Create data buffers:
55+
var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );
56+
var ybuf = new ResultsArray( 3 );
57+
58+
// Define the array shapes:
59+
var xsh = [ 1, 3, 2, 2 ];
60+
var ysh = [ 1, 3 ];
61+
62+
// Define the array strides:
63+
var sx = [ 12, 4, 2, 1 ];
64+
var sy = [ 3, 1 ];
65+
66+
// Define the index offsets:
67+
var ox = 0;
68+
var oy = 0;
69+
70+
// Create an input ndarray-like object:
71+
var x = {
72+
'dtype': 'float64',
73+
'data': xbuf,
74+
'shape': xsh,
75+
'strides': sx,
76+
'offset': ox,
77+
'order': 'row-major'
78+
};
79+
80+
// Create an output ndarray-like object:
81+
var y = {
82+
'dtype': Float64Results,
83+
'data': ybuf,
84+
'shape': ysh,
85+
'strides': sy,
86+
'offset': oy,
87+
'order': 'row-major'
88+
};
89+
90+
// Create additional parameter ndarray-like objects:
91+
var alternative = {
92+
'dtype': 'generic',
93+
'data': [ 'two-sided' ],
94+
'shape': ysh,
95+
'strides': [ 0, 0 ],
96+
'offset': 0,
97+
'order': 'row-major'
98+
};
99+
var alpha = {
100+
'dtype': 'float64',
101+
'data': [ 0.05 ],
102+
'shape': ysh,
103+
'strides': [ 0, 0 ],
104+
'offset': 0,
105+
'order': 'row-major'
106+
};
107+
var mu = {
108+
'dtype': 'float64',
109+
'data': [ 0.0 ],
110+
'shape': ysh,
111+
'strides': [ 0, 0 ],
112+
'offset': 0,
113+
'order': 'row-major'
114+
};
115+
var sigma = {
116+
'dtype': 'float64',
117+
'data': [ 1.0 ],
118+
'shape': ysh,
119+
'strides': [ 0, 0 ],
120+
'offset': 0,
121+
'order': 'row-major'
122+
};
123+
124+
// Perform a reduction:
125+
unaryReduceStrided1d( ztest, [ x, y, alternative, alpha, mu, sigma ], [ 2, 3 ] );
126+
127+
var arr = ndarray2array( y.data, y.shape, y.strides, y.offset, y.order );
128+
// returns [ [ <Float64Results>, <Float64Results>, <Float64Results> ] ]
129+
```
130+
131+
The function accepts the following arguments:
132+
133+
- **fcn**: function which will be applied to a one-dimensional subarray and should store reduction results in an output [`struct`][@stdlib/dstructs/struct] object.
134+
- **arrays**: array-like object containing one input ndarray and one output ndarray, followed by any additional ndarray arguments.
135+
- **dims**: list of dimensions over which to perform a reduction.
136+
- **options**: function options which are passed through to `fcn` (_optional_).
137+
138+
Each provided ndarray should be an object with the following properties:
139+
140+
- **dtype**: data type.
141+
- **data**: data buffer.
142+
- **shape**: dimensions.
143+
- **strides**: stride lengths.
144+
- **offset**: index offset.
145+
- **order**: specifies whether an ndarray is row-major (C-style) or column major (Fortran-style).
146+
147+
#### TODO: document factory method
148+
149+
</section>
150+
151+
<!-- /.usage -->
152+
153+
<section class="notes">
154+
155+
## Notes
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.
158+
159+
- The reduction function is expected to have the following signature:
160+
161+
```text
162+
fcn( arrays[, options] )
163+
```
164+
165+
where
166+
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.
168+
- **options**: function options (_optional_).
169+
170+
- 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.
171+
172+
</section>
173+
174+
<!-- /.notes -->
175+
176+
<section class="examples">
177+
178+
## Examples
179+
180+
<!-- eslint no-undef: "error" -->
181+
182+
```javascript
183+
var normal = require( '@stdlib/random/array/normal' );
184+
var ndarray2array = require( '@stdlib/ndarray/base/to-array' );
185+
var Float64Results = require( '@stdlib/stats/base/ztest/one-sample/results/float64' );
186+
var structFactory = require( '@stdlib/array/struct-factory' );
187+
var ztest = require( '@stdlib/stats/base/ndarray/ztest' );
188+
var unaryReduceStrided1d = require( '@stdlib/ndarray/base/unary-reduce-strided1d-to-struct' );
189+
190+
var ResultsArray = structFactory( Float64Results );
191+
192+
var N = 10;
193+
var x = {
194+
'dtype': 'generic',
195+
'data': normal( N, 0.0, 1.0, {
196+
'dtype': 'generic'
197+
}),
198+
'shape': [ 1, 5, 2 ],
199+
'strides': [ 10, 2, 1 ],
200+
'offset': 0,
201+
'order': 'row-major'
202+
};
203+
var y = {
204+
'dtype': Float64Results,
205+
'data': new ResultsArray( 2 ),
206+
'shape': [ 1, 2 ],
207+
'strides': [ 2, 1 ],
208+
'offset': 0,
209+
'order': 'row-major'
210+
};
211+
var alternative = {
212+
'dtype': 'generic',
213+
'data': [ 'two-sided' ],
214+
'shape': [ 1, 2 ],
215+
'strides': [ 0, 0 ],
216+
'offset': 0,
217+
'order': 'row-major'
218+
};
219+
var alpha = {
220+
'dtype': 'generic',
221+
'data': [ 0.05 ],
222+
'shape': [ 1, 2 ],
223+
'strides': [ 0, 0 ],
224+
'offset': 0,
225+
'order': 'row-major'
226+
};
227+
var mu = {
228+
'dtype': 'generic',
229+
'data': [ 0.0 ],
230+
'shape': [ 1, 2 ],
231+
'strides': [ 0, 0 ],
232+
'offset': 0,
233+
'order': 'row-major'
234+
};
235+
var sigma = {
236+
'dtype': 'generic',
237+
'data': [ 1.0 ],
238+
'shape': [ 1, 2 ],
239+
'strides': [ 0, 0 ],
240+
'offset': 0,
241+
'order': 'row-major'
242+
};
243+
244+
unaryReduceStrided1d( ztest, [ x, y, alternative, alpha, mu, sigma ], [ 1 ] );
245+
246+
console.log( ndarray2array( x.data, x.shape, x.strides, x.offset, x.order ) );
247+
console.log( ndarray2array( y.data, y.shape, y.strides, y.offset, y.order ) );
248+
```
249+
250+
</section>
251+
252+
<!-- /.examples -->
253+
254+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
255+
256+
<section class="related">
257+
258+
</section>
259+
260+
<!-- /.related -->
261+
262+
<section class="links">
263+
264+
[@stdlib/dstructs/struct]: https://github.com/stdlib-js/dstructs-struct
265+
266+
</section>
267+
268+
<!-- /.links -->

0 commit comments

Comments
 (0)