nlcpy.argwhere

nlcpy.argwhere(a) ndarray

Finds the indices of array elements that are non-zero, grouped by element.

Parameters
aarray_like

Input data.

Returns
index_arrayndarray

Indices of elements that are non-zero. Indices are grouped by element.

See also

where

Returns elements chosen from x or y depending on condition.

nonzero

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

Note

The output of argwhere is not suitable for indexing arrays. For this purpose use nonzero() instead.

Examples

>>> import nlcpy as vp
>>> x = vp.arange(6).reshape(2,3)
>>> x
array([[0, 1, 2],
       [3, 4, 5]])
>>> vp.argwhere(x>1)
array([[0, 2],
       [1, 0],
       [1, 1],
       [1, 2]])