meshgrid#
- class saiunit.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 (
Union[saiunit.Quantity,Array,ndarray,number,bool]) – 1-D arrays representing the coordinates of a grid.copy (
Optional[bool]) – Must beTrue(the default). JAX does not supportcopy=False.sparse (
Optional[bool]) – IfTrue, return a sparse grid instead of a dense grid.indexing (
Optional[str]) – Cartesian ('xy', default) or matrix ('ij') indexing of output.
- Returns:
X1, X2, …, XN – Coordinate matrices.
- Return type:
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)