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
4 changes: 2 additions & 2 deletions src/symmetric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ function copyto!(dest::Symmetric, src::Symmetric)
elseif src.uplo == dest.uplo
copytrito!(dest.data, src.data, src.uplo)
else
transpose!(dest.data, Base.unalias(dest.data, src.data))
copytrito!(dest.data, transpose(Base.unalias(dest.data, src.data)), dest.uplo)
end
return dest
end
Expand All @@ -363,7 +363,7 @@ function copyto!(dest::Hermitian, src::Hermitian)
elseif src.uplo == dest.uplo
copytrito!(dest.data, src.data, src.uplo)
else
adjoint!(dest.data, Base.unalias(dest.data, src.data))
copytrito!(dest.data, adjoint(Base.unalias(dest.data, src.data)), dest.uplo)
end
return dest
end
Expand Down
15 changes: 15 additions & 0 deletions test/symmetric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1163,4 +1163,19 @@ end
end
end

@testset "copyto! with mismatched uplo" begin
for (S,tf) in ((Symmetric, transpose), (Hermitian, adjoint))
for (uplo1,uplo2) in [(:U,:L), (:L, :U)]
M = Matrix{Complex{BigFloat}}(undef, 2, 2)
M[1,1] = M[2,2] = 3
isupper = uplo1 == :U
M[1+!isupper, 1+isupper] = 4+3im
H1 = S(M, uplo1)
H2 = 2 * S(tf(M), uplo2)
copyto!(H2, H1)
@test H2 == H1
end
end
end

end # module TestSymmetric