Skip to content

Commit 0cbbfea

Browse files
authored
PR: Add meshgrid (#145)
1 parent 138e963 commit 0cbbfea

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

Diff for: spec/API_specification/creation_functions.md

+31
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,37 @@ Returns evenly spaced numbers over a specified interval.
289289
290290
- a one-dimensional array containing evenly spaced values.
291291
292+
(function-meshgrid)=
293+
### meshgrid(*arrays, /, *, indexing='xy')
294+
295+
Returns coordinate matrices from coordinate vectors.
296+
297+
#### Parameters
298+
299+
- **arrays**: _Sequence\[ <array> ]_
300+
301+
- one-dimensional arrays representing grid coordinates. Must have a numeric data type.
302+
303+
- **indexing**: _str_
304+
305+
- Cartesian 'xy' or matrix 'ij' indexing of output. If provided zero or one one-dimensional vector(s) (i.e., the zero- and one-dimensional cases, respectively), the `indexing` keyword has no effect and should be ignored. Default: `'xy'`.
306+
307+
#### Returns
308+
309+
- **out**: _List\[ <array>, ... ]_
310+
311+
- list of N arrays, where `N` is the number of provided one-dimensional input arrays. Each returned array must have rank `N`. For `N` one-dimensional arrays having lengths `Ni = len(xi)`,
312+
313+
- if matrix indexing `ij`, then each returned array must have the shape `(N1, N2, N3, ..., Nn)`.
314+
315+
- if Cartesian indexing `xy`, then each returned array must have shape `(N2, N1, N3, ..., Nn)`.
316+
317+
Accordingly, for the two-dimensional case with input one-dimensional arrays of length `M` and `N`, if matrix indexing `ij`, then each returned array must have shape `(M, N)`, and, if Cartesian indexing `xy`, then each returned array must have shape `(N, M)`.
318+
319+
Similarly, for the three-dimensional case with input one-dimensional arrays of length `M`, `N`, and `P`, if matrix indexing `ij`, then each returned array must have shape `(M, N, P)`, and, if Cartesian indexing `xy`, then each returned array must have shape `(N, M, P)`.
320+
321+
The returned arrays must have a numeric data type determined by {ref}`type-promotion`.
322+
292323
(function-ones)=
293324
### ones(shape, /, *, dtype=None, device=None)
294325

0 commit comments

Comments
 (0)