From 38520e134d16f0ec98231970df810f26cded281c Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Fri, 25 Aug 2023 23:45:43 +0400 Subject: [PATCH] Docs: add examples to `istril`/`istriu` docstrings (#49853) Also, simplify some of the examples to focus on the structure of the matrices --- stdlib/LinearAlgebra/src/generic.jl | 34 +++++++++++++++-------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/stdlib/LinearAlgebra/src/generic.jl b/stdlib/LinearAlgebra/src/generic.jl index 77799ea888d91..a17fc49abf8b6 100644 --- a/stdlib/LinearAlgebra/src/generic.jl +++ b/stdlib/LinearAlgebra/src/generic.jl @@ -1284,16 +1284,17 @@ false julia> istriu(a, -1) true -julia> b = [1 im; 0 -1] -2×2 Matrix{Complex{Int64}}: - 1+0im 0+1im - 0+0im -1+0im - -julia> istriu(b) -true +julia> c = [1 1 1; 1 1 1; 0 1 1] +3×3 Matrix{Int64}: + 1 1 1 + 1 1 1 + 0 1 1 -julia> istriu(b, 1) +julia> istriu(c) false + +julia> istriu(c, -1) +true ``` """ function istriu(A::AbstractMatrix, k::Integer = 0) @@ -1328,16 +1329,17 @@ false julia> istril(a, 1) true -julia> b = [1 0; -im -1] -2×2 Matrix{Complex{Int64}}: - 1+0im 0+0im - 0-1im -1+0im - -julia> istril(b) -true +julia> c = [1 1 0; 1 1 1; 1 1 1] +3×3 Matrix{Int64}: + 1 1 0 + 1 1 1 + 1 1 1 -julia> istril(b, -1) +julia> istril(c) false + +julia> istril(c, 1) +true ``` """ function istril(A::AbstractMatrix, k::Integer = 0)