Back to Numerical Arrays (NumPy)
np.mask_indices
Return indices that are non-zero in the mask.
Syntax
np.mask_indices(n, func, k?)
Description
Return indices that are non-zero in the mask. Calling this function with a mask function that returns a 2-D array will return indices appropriate for accessing the elements that would be selected by the mask.
Parameters
| Name | Description |
|---|---|
| n | - Size of the array for which indices are needed |
| func | - A function whose call signature is similar to that of triu, tril. That is, func(n, k) returns a boolean array of shape (n, n). |
| k(optional) | - Diagonal offset |
Returns
Promise<[NDArray, NDArray]>