meshgrid#
- class brainunit.math.meshgrid(*xi, copy=True, sparse=False, indexing='xy')#
Return coordinate matrices from coordinate vectors.
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.- Parameters:
xi (saiunit.Quantity |
Array|ndarray|bool|number|bool|int|float|complex) – 1-D arrays representing the coordinates of a grid.copy (
bool|None) – Must beTrue(the default). JAX does not supportcopy=False.sparse (
bool|None) – IfTrue, return a sparse grid instead of a dense grid.indexing (
str|None) – Cartesian ('xy', default) or matrix ('ij') indexing of output.
- Returns:
X1, X2, …, XN – Coordinate matrices.
- Return type:
List[saiunit.Quantity |Array]
Examples
>>> import saiunit as u >>> import jax.numpy as jnp >>> x, y = u.math.meshgrid(jnp.array([1, 2]), jnp.array([3, 4])) >>> x Array([[1, 2], [1, 2]], dtype=int32)