tril(M)

tril(M)

Lower triangle of a matrix.

Examples

  1. Extract the lower triangle of a matrix:

    julia> A = [1 2 3; 4 5 6; 7 8 9];
    julia> tril(A)
    3×3 Array{Int64,2}:
    1  0  0
    4  5  0
    7  8  9

    This example extracts the lower triangle of matrix A and replaces the upper triangle with zeros.

  2. Specify the superdiagonal offset:
    julia> B = [1 2 3 4; 5 6 7 8; 9 10 11 12; 13 14 15 16];
    julia> tril(B, 1)
    4×4 Array{Int64,2}:
    1   0   0   0
    5   6   0   0
    9  10  11   0
    13  14  15  16

    Here, the lower triangle of matrix B starting from the first superdiagonal (k=1) is extracted.

Common mistake example:

julia> C = [1 2 3; 4 5 6; 7 8 9];
julia> tril(C, -1)
ERROR: ArgumentError: k must be non-negative

In this example, a negative value for k is provided, which is not allowed. The k parameter should be non-negative. Always ensure that k is a valid value when using tril.

See Also

Ac_ldiv_B, Ac_ldiv_Bc, Ac_mul_B, Ac_mul_Bc, Ac_rdiv_B, Ac_rdiv_Bc, At_ldiv_B, At_ldiv_Bt, At_mul_B, At_mul_Bt, At_rdiv_B, At_rdiv_Bt, A_ldiv_Bc, A_ldiv_Bt, A_mul_B!, A_mul_Bc, A_mul_Bt, A_rdiv_Bc, A_rdiv_Bt, Bidiagonal, cond, conv2, det, diag, diagind, diagm, diff, eig, eigvals, eigvecs, expm, eye, full, inv, isdiag, ishermitian, isposdef, isposdef!, issym, istril, istriu, logabsdet, logdet, lyap, norm, qrfact, rank, repmat, rot180, rotl90, rotr90, sortrows, sqrtm, SymTridiagonal, trace, Tridiagonal, tril, tril!, triu, triu!, writedlm,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: