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
1 change: 1 addition & 0 deletions stdlib/LinearAlgebra/src/generic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2012,6 +2012,7 @@ function copytrito!(B::AbstractMatrix, A::AbstractMatrix, uplo::AbstractChar)
m,n = size(A)
m1,n1 = size(B)
(m1 < m || n1 < n) && throw(DimensionMismatch(lazy"B of size ($m1,$n1) should have at least the same number of rows and columns than A of size ($m,$n)"))
A = Base.unalias(B, A)
if uplo == 'U'
for j=1:n
for i=1:min(j,m)
Expand Down
8 changes: 8 additions & 0 deletions stdlib/LinearAlgebra/test/generic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,14 @@ end
C = uplo == 'L' ? tril(A) : triu(A)
@test B ≈ C
end
@testset "aliasing" begin
M = Matrix(reshape(1:36, 6, 6))
A = view(M, 1:5, 1:5)
A2 = Matrix(A)
B = view(M, 2:6, 2:6)
copytrito!(B, A, 'U')
@test UpperTriangular(B) == UpperTriangular(A2)
end
end

@testset "immutable arrays" begin
Expand Down