COO.linear_loc¶
-
COO.
linear_loc
()[source]¶ The nonzero coordinates of a flattened version of this array. Note that the coordinates may be out of order.
- Parameters
signed (bool, optional) – Whether to use a signed datatype for the output array.
False
by default.- Returns
The flattened coordinates.
- Return type
See also
numpy.flatnonzero
Equivalent Numpy function.
Examples
>>> x = np.eye(5) >>> s = COO.from_numpy(x) >>> s.linear_loc() array([ 0, 6, 12, 18, 24]) >>> np.array_equal(np.flatnonzero(x), s.linear_loc()) True