Skip to content

tril

builtin · libnexusinterp/corefcn/tril-proprietary.cc

: l = tril (x)
: l = tril (x, k)

Extract the lower triangular portion of x, zeroing every entry that lies above the main diagonal.

The optional integer k selects which diagonal bounds the result: with k equal to 0 (the default) the main diagonal and everything below it is kept; a positive k additionally keeps the k superdiagonals above the main one; a negative k drops that many diagonals starting from the main one. A sparse x produces a sparse result.