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 missing tests for diagonal and uniformscaling #17921

Merged
merged 3 commits into from
Aug 17, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
13 changes: 13 additions & 0 deletions test/linalg/diagonal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ for relty in (Float32, Float64, BigFloat), elty in (relty, Complex{relty})
@test D[1,1] == d[1]
@test D[1,2] == 0

@test issymmetric(D)
@test istriu(D)
@test istril(D)
if elty <: Real
@test ishermitian(D)
end

debug && println("Simple unary functions")
for op in (-,)
@test op(D)==op(DM)
Expand Down Expand Up @@ -116,6 +123,12 @@ for relty in (Float32, Float64, BigFloat), elty in (relty, Complex{relty})
@test Ac_mul_B!(copy(D), copy(b)) ≈ full(D)'*full(b)
end

#a few missing mults
bd = Bidiagonal(D2)
Copy link
Contributor

Choose a reason for hiding this comment

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

did you want to use bd for anything?

@test A_mul_Bt(D,D2) ≈ full(D)*full(D2).'
Copy link
Member

Choose a reason for hiding this comment

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

Why not just D*D2.'?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to make sure I would get this method. Is there a way to use @which to see what (*) will call?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you want me to change it, @andreasnoack, or is this ok as is?

Copy link
Member

Choose a reason for hiding this comment

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

Is there a way to use @which to see what (*) will call?

It used to work but then #17469

I think it would be good to change this. Ax_mul_Bx are not really meant to be used.

@test A_mul_Bt(D2,D) ≈ full(D2)*full(D).'
@test A_mul_Bc(D2,D) ≈ full(D2)*full(D)'

@test U.'*D ≈ U.'*full(D)
@test U'*D ≈ U'*full(D)

Expand Down
2 changes: 2 additions & 0 deletions test/linalg/uniformscaling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ srand(123)
@test I[1,1] == 1 # getindex
@test I[1,2] == 0 # getindex
@test I === I' # transpose
@test ndims(I) == 2
@test one(UniformScaling{Float32}) == UniformScaling(one(Float32))
@test zero(UniformScaling{Float32}) == UniformScaling(zero(Float32))
@test eltype(one(UniformScaling{Float32})) == Float32
@test zero(UniformScaling(rand(Complex128))) == zero(UniformScaling{Complex128})
@test one(UniformScaling(rand(Complex128))) == one(UniformScaling{Complex128})
@test eltype(one(UniformScaling(rand(Complex128)))) == Complex128
Expand Down