tril

sparse.tril(x, k=0)[source]

Returns an array with all elements above the k-th diagonal set to zero.

Parameters:
  • x (COO) – The input array.

  • k (int, optional) – The diagonal above which elements are set to zero. The default is zero, which corresponds to the main diagonal.

Returns:

The output lower-triangular matrix.

Return type:

COO

Raises:

ValueError – If x doesn’t have zero fill-values.

See also

numpy.tril

NumPy equivalent function