tril#
- class brainunit.math.tril(m, k=0, unit=Unit('1'))#
Return the lower triangle of an array.
Return a copy of a matrix with the elements above the
k-th diagonal zeroed. For arrays withndim > 2,trilapplies to the final two axes.- Parameters:
m (saiunit.Quantity |
Array|ndarray|number|bool) – Input array.k (
int) – Diagonal above which to zero elements.k = 0is the main diagonal,k < 0is below it, andk > 0is above.unit (saiunit.Unit) – Unit of the returned
Quantity.
- Returns:
out – Lower triangle of
m, of the same shape and data-type asm.- Return type:
saiunit.Quantity |
Array
Examples
>>> import saiunit as u >>> import jax.numpy as jnp >>> u.math.tril(jnp.ones((3, 3))) Array([[1., 0., 0.], [1., 1., 0.], [1., 1., 1.]], dtype=float32)