MCPcopy Create free account
hub / github.com/dask/dask / vindex

Method vindex

dask/array/core.py:2074–2095  ·  view source on GitHub ↗

Vectorized indexing with broadcasting. This is equivalent to numpy's advanced indexing, using arrays that are broadcast against each other. This allows for pointwise indexing: >>> import dask.array as da >>> x = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) >>

(self)

Source from the content-addressed store, hash-verified

2072
2073 @property
2074 def vindex(self):
2075 """Vectorized indexing with broadcasting.
2076
2077 This is equivalent to numpy's advanced indexing, using arrays that are
2078 broadcast against each other. This allows for pointwise indexing:
2079
2080 >>> import dask.array as da
2081 >>> x = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
2082 >>> x = da.from_array(x, chunks=2)
2083 >>> x.vindex[[0, 1, 2], [0, 1, 2]].compute()
2084 array([1, 5, 9])
2085
2086 Mixed basic/advanced indexing with slices/arrays is also supported. The
2087 order of dimensions in the result follows those proposed for
2088 `ndarray.vindex <https://github.com/numpy/numpy/pull/6256>`_:
2089 the subspace spanned by arrays is followed by all slices.
2090
2091 Note: ``vindex`` provides more general functionality than standard
2092 indexing, but it also has fewer optimizations and can be significantly
2093 slower.
2094 """
2095 return IndexCallable(self._vindex)
2096
2097 @property
2098 def blocks(self):

Callers

nothing calls this directly

Calls 1

IndexCallableClass · 0.90

Tested by

no test coverage detected