# mlx.core.tri — MLX 0.0.7 documentation

Skip to main content
`Ctrl`+`K`

# mlx.core.tri

mlx.core.tri(n: int, m: int, k: int, dtype: Optional[ Dtype ] = None, *, stream: Union[ None , Stream , Device ] = None) → array

  An array with ones at and below the given diagonal and zeros elsewhere.

  Parameters:

    - n (int) – The number of rows in the output.

    - m (int , optional) – The number of cols in the output. Defaults to `None`.

    - k (int , optional) – The diagonal of the 2-D array. Defaults to `0`.

    - dtype (Dtype , optional) – Data type of the output array. Defaults to `float32`.

    - stream (Stream , optional) – Stream or device. Defaults to `None`.

  Returns:

    Array with its lower triangle filled with ones and zeros elsewhere

  Return type:

    array