diff --git a/spec/API_specification/creation_functions.md b/spec/API_specification/creation_functions.md index a072bd968..7ce12f5d9 100644 --- a/spec/API_specification/creation_functions.md +++ b/spec/API_specification/creation_functions.md @@ -289,6 +289,37 @@ Returns evenly spaced numbers over a specified interval. - a one-dimensional array containing evenly spaced values. +(function-meshgrid)= +### meshgrid(*arrays, /, *, indexing='xy') + +Returns coordinate matrices from coordinate vectors. + +#### Parameters + +- **arrays**: _Sequence\[ <array> ]_ + + - one-dimensional arrays representing grid coordinates. Must have a numeric data type. + +- **indexing**: _str_ + + - 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'`. + +#### Returns + +- **out**: _List\[ <array>, ... ]_ + + - 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)`, + + - if matrix indexing `ij`, then each returned array must have the shape `(N1, N2, N3, ..., Nn)`. + + - if Cartesian indexing `xy`, then each returned array must have shape `(N2, N1, N3, ..., Nn)`. + + 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)`. + + 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)`. + + The returned arrays must have a numeric data type determined by {ref}`type-promotion`. + (function-ones)= ### ones(shape, /, *, dtype=None, device=None)