Skip to content

Commit d91c1d8

Browse files
authored
Merge branch 'develop' into gdiff
2 parents 38d5aac + 5a06940 commit d91c1d8

1,125 files changed

Lines changed: 35347 additions & 6101 deletions

File tree

Some content is hidden

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

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ package.json.copy
2525
###############
2626
build/
2727
downloads/
28+
plans/
2829
reports/
2930
tmp/
3031

@@ -175,6 +176,10 @@ acs-*.bib
175176
*.ind
176177
*.ist
177178

179+
# Git #
180+
#######
181+
.worktrees
182+
178183
# Visual Studio #
179184
#################
180185
.vscode/
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2026 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+
<!-- lint disable expected-html-sections -->
22+
23+
# NumPy
24+
25+
> Migration guide for NumPy.
26+
27+
## Common Operations
28+
29+
<!-- lint disable table-pipe-alignment -->
30+
31+
| Description | NumPy | stdlib |
32+
| ----------- | ----- | ------ |
33+
| Append a zero-filled array of the same shape along a specified dimension | `np.concat((x, np.zeros_like(x)), axis=dim)` | [`concat([x, zerosLike(x)], {dim: dim})`][@stdlib/ndarray/concat] |
34+
| Broadcast an array to a specified shape | `np.broadcast_to(x, shape)` | [`broadcastArray(x, shape)`][@stdlib/ndarray/broadcast-array] |
35+
| Broadcast a scalar to a specified shape | `np.broadcast_to(np.array(scalar), shape)` | [`broadcastScalar(scalar, shape)`][@stdlib/ndarray/broadcast-scalar] |
36+
| Compute the maximum absolute value | `np.max(np.abs(x))` | [`maxabs(x)`][@stdlib/stats/maxabs] |
37+
| Compute the minimum absolute value | `np.min(np.abs(x))` | [`minabs(x)`][@stdlib/stats/minabs] |
38+
| Concatenate a list of arrays along the second-to-last dimension | `np.concat(arrays, axis=-2)` | [`vconcat(arrays)`][@stdlib/ndarray/vconcat] |
39+
| Concatenate a list of arrays along the last dimension | `np.concat(arrays, axis=-1)` | [`hconcat(arrays)`][@stdlib/ndarray/hconcat] |
40+
| Concatenate a list of one-dimensional arrays as columns | `np.column_stack(arrays)` | [`colcat(arrays)`][@stdlib/ndarray/colcat] |
41+
| Concatenate a list of one-dimensional arrays as rows | `np.vstack(arrays)` | [`rowcat(arrays)`][@stdlib/ndarray/rowcat] |
42+
| Copy an array | `np.copy(x)` | [`copy(x)`][@stdlib/ndarray/copy] |
43+
| Count the number of falsy values in an array | `x.size-np.count_nonzero(x)` | [`countFalsy(x)`][@stdlib/ndarray/count-falsy] |
44+
| Count the number of truthy values in an array | `np.count_nonzero(x)` | [`countTruthy(x)`][@stdlib/ndarray/count-truthy] |
45+
| Create a sorted copy of an array | `np.sort(x)` | [`toSorted(x)`][@stdlib/blas/ext/to-sorted] |
46+
| Create an array containing evenly spaced numbers over a specified interval and having a desired shape | `np.reshape(np.linspace(start, stop), shape)` | [`linspace(shape, start, stop)`][@stdlib/blas/ext/linspace] |
47+
| Create an array of uniformly distributed pseudorandom numbers | `np.random.default_rng().uniform(low,high,shape)` | [`uniform(shape,low,high)`][@stdlib/random/uniform] |
48+
| Filter an array according to a predicate function | `x[np.vectorize(predicate)(x)]` | [`filter(x, predicate)`][@stdlib/ndarray/filter] |
49+
| Find the index of the first element which equals a specified value | `np.argmax(x == v, axis=dim)` | [`indexOf(x, v, {dim: dim})`][@stdlib/blas/ext/index-of] |
50+
| Find the index of the last element which equals a specified value | `x.shape[dim]-1-np.argmax(np.flip(x, axis=dim) == v, axis=dim)` | [`lastIndexOf(x, v, {dim: dim})`][@stdlib/blas/ext/last-index-of] |
51+
| Flatten an array to a desired depth | `np.reshape(x, newshape)` | [`flatten(x, {depth: depth})`][@stdlib/ndarray/flatten] |
52+
| Flatten an array starting from a specific dimension | `np.reshape(x, x.shape[:dim] + (-1,))` | [`flattenFrom(x, dim)`][@stdlib/ndarray/flatten-from] |
53+
| Prepend a specified number of singleton dimensions | `np.reshape(x, (1,)*n + x.shape)` | [`prependSingletonDimensions(x, n)`][@stdlib/ndarray/prepend-singleton-dimensions] |
54+
| Prepend a zero-filled array of the same shape along a specified dimension | `np.concat((np.zeros_like(x), x), axis=dim)` | [`concat([zerosLike(x), x], {dim: dim})`][@stdlib/ndarray/concat] |
55+
| Remove singleton dimensions | `np.squeeze(x)` | [`removeSingletonDimensions(x)`][@stdlib/ndarray/remove-singleton-dimensions] |
56+
| Reverse the elements along a dimension | `np.flip(x, axis=dim)` | [`reverseDimension(x, dim)`][@stdlib/ndarray/reverse-dimension] |
57+
| Rotate an array by 90 degrees in a specified plane | `np.rot90(x, axes=dims)` | [`rot90(x, {dims: dims})`][@stdlib/ndarray/rot90] |
58+
| Rotate an array by 180 degrees in a specified plane | `np.rot90(x, k=2, axes=dims)` | [`rot180(x, {dims: dims})`][@stdlib/ndarray/rot180] |
59+
| Sort an array in-place | `x[:] = np.sort(x)` | [`sort(x)`][@stdlib/blas/ext/sort] |
60+
| Test whether an array contains at least `n` truthy values | `np.count_nonzero(x) >= n` | [`some(x, n)`][@stdlib/ndarray/some] |
61+
| Test whether an array contains truthy values | `np.any(x)` | [`any(x)`][@stdlib/ndarray/any] |
62+
| Test whether an array includes a specific value | `np.any(x == v)` | [`includes(x,v)`][@stdlib/ndarray/includes] |
63+
64+
<!-- lint enable table-pipe-alignment -->
65+
66+
## Function Reference
67+
68+
{{table}}
69+
70+
<section class="links">
71+
72+
[@stdlib/blas/ext/index-of]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/index-of
73+
74+
[@stdlib/blas/ext/last-index-of]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/last-index-of
75+
76+
[@stdlib/blas/ext/linspace]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/linspace
77+
78+
[@stdlib/blas/ext/sort]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/sort
79+
80+
[@stdlib/blas/ext/to-sorted]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/to-sorted
81+
82+
[@stdlib/ndarray/any]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/any
83+
84+
[@stdlib/ndarray/broadcast-array]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/broadcast-array
85+
86+
[@stdlib/ndarray/broadcast-scalar]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/broadcast-scalar
87+
88+
[@stdlib/ndarray/colcat]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/colcat
89+
90+
[@stdlib/ndarray/concat]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/concat
91+
92+
[@stdlib/ndarray/copy]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/copy
93+
94+
[@stdlib/ndarray/count-falsy]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/count-falsy
95+
96+
[@stdlib/ndarray/count-truthy]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/count-truthy
97+
98+
[@stdlib/ndarray/filter]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/filter
99+
100+
[@stdlib/ndarray/flatten]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/flatten
101+
102+
[@stdlib/ndarray/flatten-from]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/flatten-from
103+
104+
[@stdlib/ndarray/hconcat]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/hconcat
105+
106+
[@stdlib/ndarray/includes]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/includes
107+
108+
[@stdlib/ndarray/prepend-singleton-dimensions]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/prepend-singleton-dimensions
109+
110+
[@stdlib/ndarray/remove-singleton-dimensions]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/remove-singleton-dimensions
111+
112+
[@stdlib/ndarray/reverse-dimension]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/reverse-dimension
113+
114+
[@stdlib/ndarray/rot90]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/rot90
115+
116+
[@stdlib/ndarray/rot180]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/rot180
117+
118+
[@stdlib/ndarray/rowcat]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/rowcat
119+
120+
[@stdlib/ndarray/some]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/some
121+
122+
[@stdlib/ndarray/vconcat]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/vconcat
123+
124+
[@stdlib/random/uniform]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/random/uniform
125+
126+
[@stdlib/stats/maxabs]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/maxabs
127+
128+
[@stdlib/stats/minabs]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/minabs
129+
130+
</section>
131+
132+
<!-- /.links -->

0 commit comments

Comments
 (0)