Indexing routines

Generating index arrays

dpnp.nonzero

Return the indices of the elements that are non-zero.

dpnp.where

Return elements chosen from x or y depending on condition.

dpnp.indices

Return an array representing the indices of a grid.

dpnp.ix_

Construct an open mesh from multiple sequences.

dpnp.ogrid

Construct an open multi-dimensional "meshgrid".

dpnp.ravel_multi_index

Converts a tuple of index arrays into an array of flat indices, applying boundary modes to the multi-index.

dpnp.unravel_index

Converts array of flat indices into a tuple of coordinate arrays.

dpnp.diag_indices

Return the indices to access the main diagonal of an array.

dpnp.diag_indices_from

Return the indices to access the main diagonal of an n-dimensional array.

dpnp.mask_indices

Return the indices to access (n, n) arrays, given a masking function.

dpnp.tril_indices

Return the indices for the lower-triangle of an (n, m) array.

dpnp.tril_indices_from

Return the indices for the lower-triangle of arr.

dpnp.triu_indices

Return the indices for the upper-triangle of an (n, m) array.

dpnp.triu_indices_from

Return the indices for the lower-triangle of arr.

Indexing-like operations

dpnp.take

Take elements from an array along an axis.

dpnp.take_along_axis

Take values from the input array by matching 1d index and data slices.

dpnp.choose

Construct an array from an index array and a set of arrays to choose from.

dpnp.compress

Return selected slices of an array along given axis.

dpnp.diag

Extract a diagonal or construct a diagonal array.

dpnp.diagonal

Return specified diagonals.

dpnp.select

Return an array drawn from elements in choicelist, depending on conditions.

Inserting data into arrays

dpnp.place

Change elements of an array based on conditional and input values.

dpnp.put

Puts values of an array into another array along a given axis.

dpnp.put_along_axis

Put values into the destination array by matching 1d index and data slices.

dpnp.putmask

Changes elements of an array based on conditional and input values.

dpnp.fill_diagonal

Fill the main diagonal of the given array of any dimensionality.

Iterating over arrays

dpnp.ndindex

An N-dimensional iterator object to index arrays.

dpnp.flatiter

Flat iterator object to iterate over arrays.

dpnp.iterable

Check whether or not an object can be iterated over.