istriu

istriu(A) -> Bool

Test whether a matrix is upper triangular.

Examples

  1. Check if a matrix is upper triangular:

    julia> A = [1 2 3; 0 4 5; 0 0 6];
    julia> istriu(A)
    true

    This example checks if the matrix A is upper triangular and returns true.

  2. Handle non-upper triangular matrix:

    julia> B = [1 2 3; 4 5 6; 7 8 9];
    julia> istriu(B)
    false

    It returns false since the matrix B is not upper triangular.

  3. Identify upper triangular property in a sparse matrix:
    julia> using SparseArrays
    julia> C = sparse([1 0 0; 4 5 6; 0 0 9]);
    julia> istriu(C)
    true

    In this example, istriu correctly identifies the upper triangular property in the sparse matrix C.

Common mistake example:

julia> D = [1 2 3; 0 4 5; 6 7 8];
julia> istriu(D)
ERROR: MethodError: no method matching istriu(::Array{Int64,2})

In this example, the input matrix D is not a square matrix. The istriu function expects a square matrix as input. Make sure to provide a square matrix to avoid such errors.

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: