jax.numpy.meshgrid(*args, **kwargs)[source]ΒΆ

Return coordinate matrices from coordinate vectors.

LAX-backend implementation of meshgrid().

The JAX version of this function may in some cases return a copy rather than a view of the input.

Original docstring below.

Make N-D coordinate arrays for vectorized evaluations of N-D scalar/vector fields over N-D grids, given one-dimensional coordinate arrays x1, x2,…, xn.

Changed in version 1.9: 1-D and 0-D cases are allowed.

  • indexing ({'xy', 'ij'}, optional) – Cartesian (β€˜xy’, default) or matrix (β€˜ij’) indexing of output. See Notes for more details.

  • sparse (bool, optional) – If True a sparse grid is returned in order to conserve memory. Default is False.

  • copy (bool, optional) – If False, a view into the original arrays are returned in order to conserve memory. Default is True. Please note that sparse=False, copy=False will likely return non-contiguous arrays. Furthermore, more than one element of a broadcast array may refer to a single memory location. If you need to write to the arrays, make copies first.


X1, X2,…, XN – For vectors x1, x2,…, β€˜xn’ with lengths Ni=len(xi) , return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ with the elements of xi repeated to fill the matrix along the first dimension for x1, the second for x2 and so on.

Return type