Skip to content

Commit

Permalink
add a missing method for transpose(A::Hermitian{<:Real}) (#22280)
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre authored and ararslan committed Jun 8, 2017
1 parent 0061f2a commit 2d8c0f9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions base/linalg/symmetric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ issymmetric(A::Hermitian{<:Real}) = true
issymmetric(A::Hermitian{<:Complex}) = isreal(A)
issymmetric(A::Symmetric) = true
transpose(A::Symmetric) = A
transpose(A::Hermitian{<:Real}) = A
ctranspose(A::Symmetric{<:Real}) = A
function ctranspose(A::Symmetric)
AC = ctranspose(A.data)
Expand Down
16 changes: 11 additions & 5 deletions test/linalg/symmetric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,20 @@ let n=10
@test ishermitian(Symmetric(b + b'))
end

#transpose, ctranspose
# transpose, ctranspose
S = Symmetric(asym)
H = Hermitian(asym)
if eltya <: Real
@test transpose(Symmetric(asym)) == asym
@test transpose(S) === S == asym
@test ctranspose(S) === S == asym
@test transpose(H) === H == asym
@test ctranspose(H) === H == asym
else
@test transpose(Hermitian(asym)) == transpose(asym)
@test transpose(S) === S
@test ctranspose(S) == Symmetric(conj(asym))
@test transpose(H) == Hermitian(transpose(asym))
@test ctranspose(H) === H == asym
end
@test ctranspose(Symmetric(asym)) == Symmetric(conj(asym))
@test ctranspose(Hermitian(asym)) == asym

#tril/triu
for di in -n:n
Expand Down

0 comments on commit 2d8c0f9

Please sign in to comment.