Skip to content

Commit 6d15877

Browse files
Merge branch 'stdlib-js:develop' into develop
2 parents 2bd08ee + 6760298 commit 6d15877

File tree

74 files changed

+5540
-18
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+5540
-18
lines changed

.github/workflows/scripts/lint_package_json_files

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ files_to_process="$*"
4646
needs_changes=0
4747

4848
# Lint package.json files:
49-
files=$(echo "${files_to_process}" | tr ' ' '\n' | grep 'package\.json$' | grep -v 'datapackage\.json$' | tr '\n' ' ' | sed 's/ $//')
49+
files=$(echo "${files_to_process}" | tr ' ' '\n' | awk -F/ '$NF=="package.json"' | tr '\n' ' ' | sed 's/ $//')
5050
if [ -n "${files}" ]; then
5151
echo "Linting package.json files..."
5252
printf '%s' "${files}" | "${lint_package_json}" --split=" "

lib/node_modules/@stdlib/error/tools/database/data/data.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,3 +1208,5 @@
12081208
"JT","invalid argument. Fourth argument must be an ndarray. Value: `%s`.","TypeError"
12091209
"JU","invalid option. `%s` option must be a supported data type. Option: `%s`.","TypeError"
12101210
"JV","invalid argument. First argument must be either a supported data type string, a struct constructor, or another data type instance. Value: `%s`.","TypeError"
1211+
"JW","invalid argument. Second argument must be a valid sort order. Value: `%s`.","TypeError"
1212+
"JX","invalid argument. Second argument must be either an ndarray, a numeric scalar value, or a supported string. Value: `%s`.","TypeError"

lib/node_modules/@stdlib/error/tools/database/data/data.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

lib/node_modules/@stdlib/error/tools/id2pkg/data/data.csv

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2226,6 +2226,8 @@
22262226
"2VL",@stdlib/blas-ext-last-index-of
22272227
"0G2",@stdlib/blas/ext
22282228
"0G3",@stdlib/blas-ext
2229+
"2WM",@stdlib/blas/ext/sorthp
2230+
"2WN",@stdlib/blas-ext-sorthp
22292231
"2FU",@stdlib/blas/ext/sum
22302232
"2FV",@stdlib/blas-ext-sum
22312233
"0G4",@stdlib/blas/gdot
@@ -3591,6 +3593,8 @@
35913593
"2W5",@stdlib/math-base-special-fast-maxf
35923594
"0VK",@stdlib/math/base/special/fast/min
35933595
"0VL",@stdlib/math-base-special-fast-min
3596+
"2WO",@stdlib/math/base/special/fast/minf
3597+
"2WP",@stdlib/math-base-special-fast-minf
35943598
"0VM",@stdlib/math/base/special/fast
35953599
"0VN",@stdlib/math-base-special-fast
35963600
"0VO",@stdlib/math/base/special/fast/pow-int
@@ -4611,6 +4615,10 @@
46114615
"1ce",@stdlib/napi/export
46124616
"1cf",@stdlib/napi-export
46134617
"1ch",@stdlib/napi
4618+
"2WQ",@stdlib/ndarray/any-by
4619+
"2WR",@stdlib/ndarray-any-by
4620+
"2WS",@stdlib/ndarray/any
4621+
"2WT",@stdlib/ndarray-any
46144622
"0hS",@stdlib/ndarray/array
46154623
"0hT",@stdlib/ndarray-array
46164624
"1q2",@stdlib/ndarray/at
@@ -4759,12 +4767,18 @@
47594767
"0iR",@stdlib/ndarray-base-dtype-desc
47604768
"0iS",@stdlib/ndarray/base/dtype-enum2str
47614769
"0iT",@stdlib/ndarray-base-dtype-enum2str
4770+
"2WU",@stdlib/ndarray/base/dtype-enums
4771+
"2WV",@stdlib/ndarray-base-dtype-enums
4772+
"2WW",@stdlib/ndarray/base/dtype-objects
4773+
"2WX",@stdlib/ndarray-base-dtype-objects
47624774
"0iU",@stdlib/ndarray/base/dtype-resolve-enum
47634775
"0iV",@stdlib/ndarray-base-dtype-resolve-enum
47644776
"0iW",@stdlib/ndarray/base/dtype-resolve-str
47654777
"0iX",@stdlib/ndarray-base-dtype-resolve-str
47664778
"0iY",@stdlib/ndarray/base/dtype-str2enum
47674779
"0iZ",@stdlib/ndarray-base-dtype-str2enum
4780+
"2WY",@stdlib/ndarray/base/dtype-strings
4781+
"2WZ",@stdlib/ndarray-base-dtype-strings
47684782
"1kK",@stdlib/ndarray/base/dtype
47694783
"1kL",@stdlib/ndarray-base-dtype
47704784
"0ia",@stdlib/ndarray/base/dtype2c
@@ -4893,6 +4907,8 @@
48934907
"1dL",@stdlib/ndarray-base-output-policy-str2enum
48944908
"0jG",@stdlib/ndarray/base
48954909
"0jH",@stdlib/ndarray-base
4910+
"2Wa",@stdlib/ndarray/base/pop
4911+
"2Wb",@stdlib/ndarray-base-pop
48964912
"0jI",@stdlib/ndarray/base/prepend-singleton-dimensions
48974913
"0jJ",@stdlib/ndarray-base-prepend-singleton-dimensions
48984914
"2Go",@stdlib/ndarray/base/promote-dtypes
@@ -4909,6 +4925,8 @@
49094925
"1jj",@stdlib/ndarray-base-shape
49104926
"0jO",@stdlib/ndarray/base/shape2strides
49114927
"0jP",@stdlib/ndarray-base-shape2strides
4928+
"2Wc",@stdlib/ndarray/base/shift
4929+
"2Wd",@stdlib/ndarray-base-shift
49124930
"0jQ",@stdlib/ndarray/base/singleton-dimensions
49134931
"0jR",@stdlib/ndarray-base-singleton-dimensions
49144932
"1jO",@stdlib/ndarray/base/slice-assign
@@ -7471,12 +7489,18 @@
74717489
"1JL",@stdlib/stats-incr-mvmr
74727490
"1JM",@stdlib/stats/incr/nancount
74737491
"1JN",@stdlib/stats-incr-nancount
7492+
"2We",@stdlib/stats/incr/nangmean
7493+
"2Wf",@stdlib/stats-incr-nangmean
7494+
"2Wg",@stdlib/stats/incr/nanhmean
7495+
"2Wh",@stdlib/stats-incr-nanhmean
74747496
"2GU",@stdlib/stats/incr/nanmaxabs
74757497
"2GV",@stdlib/stats-incr-nanmaxabs
74767498
"2As",@stdlib/stats/incr/nanmean
74777499
"2At",@stdlib/stats-incr-nanmean
74787500
"2Au",@stdlib/stats/incr/nanmeanabs
74797501
"2Av",@stdlib/stats-incr-nanmeanabs
7502+
"2Wi",@stdlib/stats/incr/nanmin
7503+
"2Wj",@stdlib/stats-incr-nanmin
74807504
"2GW",@stdlib/stats/incr/nanmstdev
74817505
"2GX",@stdlib/stats-incr-nanmstdev
74827506
"2QC",@stdlib/stats/incr/nanmsum

lib/node_modules/@stdlib/error/tools/id2pkg/data/data.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

lib/node_modules/@stdlib/error/tools/pkg2id/data/data.csv

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9645,3 +9645,27 @@
96459645
"@stdlib/ndarray-flatten-by",2WJ
96469646
"@stdlib/stats/strided/wasm/dnanvariancewd",2WK
96479647
"@stdlib/stats-strided-wasm-dnanvariancewd",2WL
9648+
"@stdlib/blas/ext/sorthp",2WM
9649+
"@stdlib/blas-ext-sorthp",2WN
9650+
"@stdlib/math/base/special/fast/minf",2WO
9651+
"@stdlib/math-base-special-fast-minf",2WP
9652+
"@stdlib/ndarray/any-by",2WQ
9653+
"@stdlib/ndarray-any-by",2WR
9654+
"@stdlib/ndarray/any",2WS
9655+
"@stdlib/ndarray-any",2WT
9656+
"@stdlib/ndarray/base/dtype-enums",2WU
9657+
"@stdlib/ndarray-base-dtype-enums",2WV
9658+
"@stdlib/ndarray/base/dtype-objects",2WW
9659+
"@stdlib/ndarray-base-dtype-objects",2WX
9660+
"@stdlib/ndarray/base/dtype-strings",2WY
9661+
"@stdlib/ndarray-base-dtype-strings",2WZ
9662+
"@stdlib/ndarray/base/pop",2Wa
9663+
"@stdlib/ndarray-base-pop",2Wb
9664+
"@stdlib/ndarray/base/shift",2Wc
9665+
"@stdlib/ndarray-base-shift",2Wd
9666+
"@stdlib/stats/incr/nangmean",2We
9667+
"@stdlib/stats-incr-nangmean",2Wf
9668+
"@stdlib/stats/incr/nanhmean",2Wg
9669+
"@stdlib/stats-incr-nanhmean",2Wh
9670+
"@stdlib/stats/incr/nanmin",2Wi
9671+
"@stdlib/stats-incr-nanmin",2Wj

lib/node_modules/@stdlib/error/tools/pkg2id/data/data.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

lib/node_modules/@stdlib/math/base/special/sec/test/fixtures/julia/small_positive.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2001,4 +2001,4 @@
20012001
12.55693640218623,
20022002
12.566370614359172
20032003
]
2004-
}
2004+
}
Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
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+
# flattenShapeFrom
22+
23+
> Flatten a shape starting from a specified dimension.
24+
25+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
26+
27+
<section class="intro">
28+
29+
</section>
30+
31+
<!-- /.intro -->
32+
33+
<!-- Package usage documentation. -->
34+
35+
<section class="usage">
36+
37+
## Usage
38+
39+
```javascript
40+
var flattenShapeFrom = require( '@stdlib/ndarray/base/flatten-shape-from' );
41+
```
42+
43+
#### flattenShapeFrom( shape, dim )
44+
45+
Flattens a shape starting from a specified dimension.
46+
47+
```javascript
48+
var sh = flattenShapeFrom( [ 3, 3, 2 ], 1 );
49+
// returns [ 3, 6 ]
50+
```
51+
52+
The function accepts the following parameters:
53+
54+
- **shape**: array shape.
55+
- **dim**: dimension to start flattening from.
56+
57+
#### flattenShapeFrom.assign( shape, dim, out )
58+
59+
Flattens a shape starting from a specified dimension and assigns results to a provided output array.
60+
61+
```javascript
62+
var sh = [ 0, 0 ];
63+
64+
var out = flattenShapeFrom.assign( [ 3, 3, 2 ], 1, sh );
65+
// returns [ 3, 6 ]
66+
67+
var bool = ( sh === out );
68+
// returns true
69+
```
70+
71+
The function accepts the following parameters:
72+
73+
- **shape**: array shape.
74+
- **dim**: dimension to start flattening from. If provided an integer less than zero, the dimension index is resolved relative to the last dimension, with the last dimension corresponding to the value `-1`.
75+
- **out**: output array.
76+
77+
</section>
78+
79+
<!-- /.usage -->
80+
81+
<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
82+
83+
<section class="notes">
84+
85+
</section>
86+
87+
<!-- /.notes -->
88+
89+
<!-- Package usage examples. -->
90+
91+
<section class="examples">
92+
93+
## Examples
94+
95+
<!-- eslint no-undef: "error" -->
96+
97+
```javascript
98+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
99+
var zip = require( '@stdlib/array/base/zip' );
100+
var logEachMap = require( '@stdlib/console/log-each-map' );
101+
var flattenShapeFrom = require( '@stdlib/ndarray/base/flatten-shape-from' );
102+
103+
var opts = {
104+
'dtype': 'int32'
105+
};
106+
var d1 = discreteUniform( 100, 1, 10, opts );
107+
var d2 = discreteUniform( d1.length, 1, 10, opts );
108+
var d3 = discreteUniform( d1.length, 1, 10, opts );
109+
var d4 = discreteUniform( d1.length, 1, 10, opts );
110+
111+
var dims = discreteUniform( d1.length, -4, 3, opts );
112+
var shapes = zip( [ d1, d2, d3, d4 ] );
113+
114+
logEachMap( 'shape: (%s). dim: %d. flattened: (%s).', shapes, dims, flattenShapeFrom );
115+
```
116+
117+
</section>
118+
119+
<!-- /.examples -->
120+
121+
<!-- C interface documentation. -->
122+
123+
* * *
124+
125+
<section class="c">
126+
127+
## C APIs
128+
129+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
130+
131+
<section class="intro">
132+
133+
</section>
134+
135+
<!-- /.intro -->
136+
137+
<!-- C usage documentation. -->
138+
139+
<section class="usage">
140+
141+
### Usage
142+
143+
```c
144+
#include "stdlib/ndarray/base/flatten_shape_from.h"
145+
```
146+
147+
#### stdlib_ndarray_flatten_shape_from( ndims, \*shape, dim, \*out )
148+
149+
Flattens a shape starting from a specified dimension.
150+
151+
```c
152+
const int64_t ndims = 3;
153+
const int64_t shape[] = { 2, 3, 10 };
154+
int64_t out[ 2 ];
155+
156+
stdlib_ndarray_flatten_shape( ndims, shape, 1, out );
157+
```
158+
159+
The function accepts the following arguments:
160+
161+
- **ndims**: `[in] int64_t` number of dimensions.
162+
- **shape**: `[in] int64_t*` array shape (dimensions).
163+
- **dim**: `[in] int64_t` dimension to start flattening from.
164+
- **out**: `[out] int64_t*` output array.
165+
166+
```c
167+
int8_t stdlib_ndarray_flatten_shape_from( const int64_t ndims, const int64_t *shape, const int64_t dim, int64_t *out );
168+
```
169+
170+
</section>
171+
172+
<!-- /.usage -->
173+
174+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
175+
176+
<section class="notes">
177+
178+
</section>
179+
180+
<!-- /.notes -->
181+
182+
<!-- C API usage examples. -->
183+
184+
<section class="examples">
185+
186+
### Examples
187+
188+
```c
189+
#include "stdlib/ndarray/base/flatten_shape_from.h"
190+
#include <stdio.h>
191+
#include <inttypes.h>
192+
193+
int main( void ) {
194+
const int64_t shape[] = { 2, 3, 4, 10 };
195+
const int64_t ndims = 4;
196+
const int64_t dim = 2;
197+
int64_t out[ 3 ];
198+
199+
stdlib_ndarray_flatten_shape_from( ndims, shape, dim, out );
200+
201+
int i;
202+
printf( "shape = ( " );
203+
for ( i = 0; i < ndims-dim+1; i++ ) {
204+
printf( "%"PRId64"", out[ i ] );
205+
if ( i < ndims-dim ) {
206+
printf( ", " );
207+
}
208+
}
209+
printf( " )\n" );
210+
}
211+
```
212+
213+
</section>
214+
215+
<!-- /.examples -->
216+
217+
</section>
218+
219+
<!-- /.c -->
220+
221+
<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
222+
223+
<section class="references">
224+
225+
</section>
226+
227+
<!-- /.references -->
228+
229+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
230+
231+
<section class="related">
232+
233+
</section>
234+
235+
<!-- /.related -->
236+
237+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
238+
239+
<section class="links">
240+
241+
</section>
242+
243+
<!-- /.links -->

0 commit comments

Comments
 (0)