Skip to content

Commit

Permalink
Various misc. linalg tests (#24318)
Browse files Browse the repository at this point in the history
* Tests for converting to Array (and Matrix) for SVD

* Tests for converting to Array (and Matrix) from Schur

* Few missing symmetric tests

* Tests for converting to Array (and Matrix) from Hessenberg

* Tests for converting to Array (and Matrix) from LU
  • Loading branch information
kshyatt authored and Sacha0 committed Oct 27, 2017
1 parent 4bbec3d commit c4558e3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion test/linalg/hessenberg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let n = 10
@test size(H[:Q], 2) == size(A, 2)
@test size(H[:Q]) == size(A)
@test_throws KeyError H[:Z]
@test AbstractArray(H) A
@test convert(Array, H) A
@test (H[:Q] * H[:H]) * H[:Q]' A
@test (H[:Q]' *A) * H[:Q] H[:H]
#getindex for HessenbergQ
Expand Down
2 changes: 1 addition & 1 deletion test/linalg/lu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dimg = randn(n)/2
@testset "LU factorization for Number" begin
num = rand(eltya)
@test lu(num) == (one(eltya),num,1)
@test AbstractArray(lufact(num)) eltya[num]
@test convert(Array, lufact(num)) eltya[num]
end
@testset "Balancing in eigenvector calculations" begin
A = convert(Matrix{eltya}, [ 3.0 -2.0 -0.9 2*eps(real(one(eltya)));
Expand Down
2 changes: 1 addition & 1 deletion test/linalg/schur.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ aimg = randn(n,n)/2
@test sort(real(f[:values])) sort(real(d))
@test sort(imag(f[:values])) sort(imag(d))
@test istriu(f[:Schur]) || eltype(a)<:Real
@test AbstractArray(f) a
@test convert(Array, f) a
@test_throws KeyError f[:A]

sch, vecs, vals = schur(UpperTriangular(triu(a)))
Expand Down
2 changes: 1 addition & 1 deletion test/linalg/svd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ a2img = randn(n,n)/2
@testset "singular value decomposition" begin
@test usv[:S] === svdvals(usv)
@test usv[:U] * (Diagonal(usv[:S]) * usv[:Vt]) a
@test AbstractArray(usv) a
@test convert(Array, usv) a
@test usv[:Vt]' usv[:V]
@test_throws KeyError usv[:Z]
b = rand(eltya,n)
Expand Down
7 changes: 7 additions & 0 deletions test/linalg/symmetric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ end
@test ishermitian(Hermitian(aherm))
if eltya <: Real
@test ishermitian(Symmetric(asym))
@test issymmetric(Hermitian(asym))
elseif eltya <: Complex
# test that zero imaginary component is
# handled properly
Expand Down Expand Up @@ -288,10 +289,16 @@ end
@testset "linalg binary ops" begin
@testset "mat * vec" begin
@test Symmetric(asym)*x+y asym*x+y
# testing fallbacks for RowVector * SymHerm.'
xadj = x.'
@test xadj * Symmetric(asym).' xadj * asym
@test x' * Symmetric(asym) x' * asym

@test Hermitian(aherm)*x+y aherm*x+y
# testing fallbacks for RowVector * SymHerm'
xadj = x'
@test x' * Hermitian(aherm) x' * aherm
@test xadj * Hermitian(aherm)' xadj * aherm
end

@testset "mat * mat" begin
Expand Down

1 comment on commit c4558e3

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

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

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

Please sign in to comment.