SciPy

numpy.triu_indices_from

numpy.triu_indices_from(arr, k=0)[source]

Return the indices for the upper-triangle of arr.

See triu_indices for full details.

Parameters:
arr : ndarray, shape(N, N)

The indices will be valid for square arrays.

k : int, optional

Diagonal offset (see triu for details).

Returns:
triu_indices_from : tuple, shape(2) of ndarray, shape(N)

Indices for the upper-triangle of arr.

See also

triu_indices, triu

Notes

New in version 1.4.0.

Previous topic

numpy.triu_indices

Next topic

numpy.take