ravel_multi_index
Convert a tuple of index arrays into a flat index array for a given shape.| Name | Type | Default | Description |
|---|---|---|---|
multi_index | ArrayLike[] | — | Tuple of integer arrays, one per dimension. |
dims | number[] | — | Shape of the array into which the indices apply. |
mode | 'raise' | 'wrap' | 'clip' | 'raise' | How to handle out-of-bounds indices. 'raise' throws an error, 'wrap' wraps around, 'clip' clips to the valid range. |
NDArray — Array of flat indices corresponding to the multi-dimensional indices.
unravel_index
Convert flat indices into a tuple of coordinate arrays for a given shape.| Name | Type | Default | Description |
|---|---|---|---|
indices | ArrayLike | — | Array of flat indices to convert. |
shape | number[] | — | Shape of the array used for unraveling. |
NDArray[] — Tuple of index arrays, one per dimension. Each array has the same shape as indices.
iindex
Perform integer (fancy) indexing on an array. Select elements froma using an array of integer indices.
| Name | Type | Default | Description |
|---|---|---|---|
a | ArrayLike | — | Source array. |
indices | ArrayLike | — | Integer array of indices. The result has the same shape as indices. |
axis | number | undefined | Axis along which to index. |
NDArray — Array of elements selected from a at the given flat indices.
bindex
Perform boolean array indexing on an array. Select elements froma where the mask is true.
| Name | Type | Default | Description |
|---|---|---|---|
a | ArrayLike | — | Source array. |
mask | ArrayLike | — | Boolean array. Must be broadcastable to the shape of a. |
axis | number | undefined | Axis along which to index. |
NDArray — 1-D array of elements from a where mask is true.