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