nlcpy.tril

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

Lower triangle of an array.

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

Parameters
marray_like

Input array.

kint, 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.

Returns
trindarray

Lower triangle of m, of same shape and data-type as m.

See also

triu

Upper triangle of an array.

Examples

>>> import nlcpy as vp
>>> vp.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1)
array([[ 0,  0,  0],
       [ 4,  0,  0],
       [ 7,  8,  0],
       [10, 11, 12]])