QuBase.jl icon indicating copy to clipboard operation
QuBase.jl copied to clipboard

Problem with QuArray type promotion

Open acroy opened this issue 8 years ago • 2 comments

There is a problem with our type promotion for QuArrays:

julia> sigmax
2x2 QuMatrix in FiniteBasis{Orthonormal}:
...coefficients: Array{Float64,2}
[0.0 1.0
 1.0 0.0]

julia> sigmay
2x2 QuMatrix in FiniteBasis{Orthonormal}:
...coefficients: Array{Complex{Float64},2}
Complex{Float64}[0.0 + 0.0im -0.0 - 1.0im
                 0.0 + 1.0im 0.0 + 0.0im]

julia> promote(sigmax,sigmay)
(2x2 QuMatrix in FiniteBasis{Orthonormal}:
...coefficients: Array{Float64,2}
[0.0 1.0
 1.0 0.0],2x2 QuMatrix in FiniteBasis{Orthonormal}:
...coefficients: Array{Complex{Float64},2}
Complex{Float64}[0.0 + 0.0im -0.0 - 1.0im
                 0.0 + 1.0im 0.0 + 0.0im])

The issue seems to be that (with Julia 0.3)

julia> promote_type(Array{Float64,2},Array{Complex128,2})
Array{T,N} (constructor with 9 methods)

So maybe this is actually an issue of Julia Base (0.3)? Any ideas?

acroy avatar Aug 13 '15 12:08 acroy