Skip to content

eliminate full from test/linalg/symmetric.jl #23896

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

Merged
merged 2 commits into from
Sep 27, 2017
Merged
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
15 changes: 8 additions & 7 deletions test/linalg/symmetric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ end
@test isa(similar(Symmetric(asym), Int, (3,2)), Matrix{Int})
@test isa(similar(Hermitian(aherm), Int, (3,2)), Matrix{Int})
end
@testset "full" begin
Copy link
Member

@fredrikekre fredrikekre Sep 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth keeping in some form? Unless Matrix(S::Symmetric) is tested elsewhere in this file

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't find this explicitly tested so took the liberty to add it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, and thanks for the lovely addition! :)

@test asym == full(Symmetric(asym))
@test aherm == full(Hermitian(aherm))

@testset "Array/Matrix constructor from Symmetric/Hermitian" begin
@test asym == Matrix(Symmetric(asym)) == Array(Symmetric(asym))
@test aherm == Matrix(Hermitian(aherm)) == Array(Hermitian(aherm))
end

@testset "parent" begin
Expand Down Expand Up @@ -209,7 +210,7 @@ end
@test eigvals(Symmetric(asym), 1:2) ≈ d[1:2]
@test eigvals(Symmetric(asym), d[1] - 1, (d[2] + d[3])/2) ≈ d[1:2]
# eigfact doesn't support Symmetric{Complex}
@test full(eigfact(asym)) ≈ asym
@test Matrix(eigfact(asym)) ≈ asym
@test eigvecs(Symmetric(asym)) ≈ eigvecs(asym)
end

Expand All @@ -223,7 +224,7 @@ end
eig(Hermitian(aherm), d[1] - 1, (d[2] + d[3])/2) # same result, but checks that method works
@test eigvals(Hermitian(aherm), 1:2) ≈ d[1:2]
@test eigvals(Hermitian(aherm), d[1] - 1, (d[2] + d[3])/2) ≈ d[1:2]
@test full(eigfact(aherm)) ≈ aherm
@test Matrix(eigfact(aherm)) ≈ aherm
@test eigvecs(Hermitian(aherm)) ≈ eigvecs(aherm)

# relation to svdvals
Expand Down Expand Up @@ -336,7 +337,7 @@ end
@testset "Issue #7933" begin
A7933 = [1 2; 3 4]
B7933 = copy(A7933)
C7933 = full(Symmetric(A7933))
C7933 = Matrix(Symmetric(A7933))
@test A7933 == B7933
end

Expand Down Expand Up @@ -443,6 +444,6 @@ end
A = T[0.650488+0.0im 0.826686+0.667447im; 0.826686-0.667447im 1.81707+0.0im]
H = Hermitian(A)
@test inv(H) ≈ inv(A)
@test ishermitian(full(inv(H)))
@test ishermitian(Matrix(inv(H)))
end
end