Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stdlib/LinearAlgebra/src/dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ julia> triu!(M, 1)
function triu!(M::AbstractMatrix, k::Integer)
@assert !has_offset_axes(M)
m, n = size(M)
for j in 1:min(n, n + k)
for j in 1:min(n, m + k)
for i in max(1, j - k + 1):m
M[i,j] = zero(M[i,j])
end
Expand Down
12 changes: 12 additions & 0 deletions stdlib/LinearAlgebra/test/dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,18 @@ end # for eltya
end
end

@testset "triu M > N case bug fix" begin
mat=[1 2;
3 4;
5 6;
7 8]
res=[1 2;
3 4;
0 6;
0 0]
@test triu(mat, -1) == res
end

@testset "Tests norms" begin
nnorm = 10
mmat = 10
Expand Down