Skip to content

PR: Add meshgrid #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions spec/API_specification/creation_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down