Skip to content

Commit

Permalink
add test for complex matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreySarnoff authored Feb 24, 2019
1 parent 0d3ebef commit 9fb7dcb
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions test/matmul.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,24 @@


#Test multiplications with ComplexD64
C1 = [1.0+2*im 3 4*im; 5 6 7-im]
C2 = [im; 0; 5-7*im]
C1 = [1.0+2*im 3 4*im; 5 6 7-im]
C1T = transpose(C1)
C2 = [im; 0; 5-7*im]
C1C2 = C1*C2
DC1DC2 = ComplexD64.(C1)*ComplexD64.(C2)
DC1FC2 = ComplexD64.(C1)*C2
FC1DC2 = C1*ComplexD64.(C2)

@test DC1DC2 == ComplexD64.(C1C2)
@test DC1FC2 == ComplexD64.(C1C2)
@test FC1DC2 == ComplexD64.(C1C2)
C1C1T = C1*C1T
DC1DC2 = ComplexD64.(C1)*ComplexD64.(C2)
DC1DC1T = ComplexD64.(C1)*ComplexD64.(C1T)
DC1FC2 = ComplexD64.(C1)*C2
FC1DC2 = C1*ComplexD64.(C2)

@test DC1DC2 == ComplexD64.(C1C2)
@test DC1DC1T == ComplexD64.(C1C1T)
@test DC1FC2 == ComplexD64.(C1C2)
@test FC1DC2 == ComplexD64.(C1C2)
# ComplexD64 is not a type, it is a constructor function
@test DC1DC2 isa Array{Complex{DoubleFloat{Float64}},2}
@test DC1FC2 isa Array{Complex{DoubleFloat{Float64}},2}
@test FC1DC2 isa Array{Complex{DoubleFloat{Float64}},2}
@test DC1DC2 isa Array{Complex{DoubleFloat{Float64}},1}
@test DC1DC1T isa Array{Complex{DoubleFloat{Float64}},2}
@test DC1FC2 isa Array{Complex{DoubleFloat{Float64}},1}
@test FC1DC2 isa Array{Complex{DoubleFloat{Float64}},1}

end

0 comments on commit 9fb7dcb

Please sign in to comment.