@@ -2375,8 +2375,9 @@ def tril_indices(
23752375 Returns
23762376 -------
23772377 inds : tuple of dpnp.ndarray
2378- The indices for the triangle. The returned tuple contains two arrays,
2379- each with the indices along one dimension of the array.
2378+ The row and column indices, respectively. The row indices are sorted in
2379+ non-decreasing order, and the corresponding column indices are strictly
2380+ increasing for each row.
23802381
23812382 See Also
23822383 --------
@@ -2394,7 +2395,13 @@ def tril_indices(
23942395
23952396 >>> import dpnp as np
23962397 >>> il1 = np.tril_indices(4)
2397- >>> il2 = np.tril_indices(4, 2)
2398+ >>> il1
2399+ (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]),
2400+ array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3]))
2401+
2402+ Note that row indices (first array) are non-decreasing, and the
2403+ corresponding column indices (second array) are strictly increasing for
2404+ each row.
23982405
23992406 Here is how they can be used with a sample array:
24002407
@@ -2421,6 +2428,7 @@ def tril_indices(
24212428
24222429 These cover almost the whole array (two diagonals right of the main one):
24232430
2431+ >>> il2 = np.tril_indices(4, 2)
24242432 >>> a[il2] = -10
24252433 >>> a
24262434 array([[-10, -10, -10, 3],
@@ -2584,9 +2592,9 @@ def triu_indices(
25842592 Returns
25852593 -------
25862594 inds : tuple of dpnp.ndarray
2587- The indices for the triangle . The returned tuple contains two arrays,
2588- each with the indices along one dimension of the array. Can be used
2589- to slice a ndarray of shape(`n`, `n`) .
2595+ The row and column indices, respectively . The row indices are sorted in
2596+ non-decreasing order, and the corresponding column indices are strictly
2597+ increasing for each row .
25902598
25912599 See Also
25922600 --------
@@ -2604,7 +2612,13 @@ def triu_indices(
26042612
26052613 >>> import dpnp as np
26062614 >>> iu1 = np.triu_indices(4)
2607- >>> iu2 = np.triu_indices(4, 2)
2615+ >>> iu1
2616+ (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]),
2617+ array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3]))
2618+
2619+ Note that row indices (first array) are non-decreasing, and the
2620+ corresponding column indices (second array) are strictly increasing for
2621+ each row.
26082622
26092623 Here is how they can be used with a sample array:
26102624
@@ -2632,6 +2646,7 @@ def triu_indices(
26322646 These cover only a small part of the whole array (two diagonals right
26332647 of the main one):
26342648
2649+ >>> iu2 = np.triu_indices(4, 2)
26352650 >>> a[iu2] = -10
26362651 >>> a
26372652 array([[ -1, -1, -10, -10],
0 commit comments