sparse_meshgrid¶
- odl.discr.grid.sparse_meshgrid(*x)[source]¶
Make a sparse
meshgrid
by adding empty dimensions.- Parameters:
- x1,...,xN
array-like
Input arrays to turn into sparse meshgrid vectors.
- x1,...,xN
- Returns:
- meshgridtuple of
numpy.ndarray
's Sparse coordinate vectors representing an N-dimensional grid.
- meshgridtuple of
See also
numpy.meshgrid
dense or sparse meshgrids
Examples
>>> x, y = [0, 1], [2, 3, 4] >>> mesh = sparse_meshgrid(x, y) >>> sum(xi for xi in mesh).ravel() # first axis slowest array([2, 3, 4, 3, 4, 5])