Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a missing method for transpose(A::Hermitian{<:Real}) #22280

Merged
merged 1 commit into from
Jun 8, 2017
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 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