numpy.tril()

numpy.tril

numpy.tril(m, k=0) [source]

Lower triangle of an array.

Return a copy of an array with elements above the k-th diagonal zeroed.

登录查看完整内容
Parameters:

m : array_like, shape (M, N)

Input array.

k : int, optional

Diagonal above which to zero elements. k = 0 (the default) is the main diagonal, k < 0 is below it and k > 0 is above.