diff --git a/base/linalg/symmetric.jl b/base/linalg/symmetric.jl index 40898a9aa2789..dead41a2b93c3 100644 --- a/base/linalg/symmetric.jl +++ b/base/linalg/symmetric.jl @@ -114,6 +114,9 @@ end ctranspose(A::Hermitian) = A trace(A::Hermitian) = real(trace(A.data)) +Base.conj(A::HermOrSym) = typeof(A)(conj(A.data), A.uplo) +Base.conj!(A::HermOrSym) = typeof(A)(conj!(A.data), A.uplo) + #tril/triu function tril(A::Hermitian, k::Integer=0) if A.uplo == 'U' && k <= 0 diff --git a/test/linalg/symmetric.jl b/test/linalg/symmetric.jl index 3a33105b5372f..55f815f500fcb 100644 --- a/test/linalg/symmetric.jl +++ b/test/linalg/symmetric.jl @@ -236,3 +236,17 @@ let A = Symmetric(randn(5,5)) B = -A @test A + B ≈ zeros(5,5) end + +# 17780 +let a = randn(2,2) + a = a'a + b = complex(a,a) + c = Symmetric(b) + @test conj(c) == conj(Array(c)) + cc = copy(c) + @test conj!(c) == conj(Array(cc)) + c = Hermitian(b + b') + @test conj(c) == conj(Array(c)) + cc = copy(c) + @test conj!(c) == conj(Array(c)) +end