Skip to content

Commit

Permalink
Remove version condition of runtest
Browse files Browse the repository at this point in the history
  • Loading branch information
albertomercurio committed Sep 9, 2024
1 parent 4591551 commit c7d6732
Showing 1 changed file with 37 additions and 39 deletions.
76 changes: 37 additions & 39 deletions test/quantum_objects.jl
Original file line number Diff line number Diff line change
Expand Up @@ -271,48 +271,46 @@
end

@testset "Type Inference (QuantumObject)" begin
if VERSION >= v"1.10"
for T in [ComplexF32, ComplexF64]
N = 4
a = rand(T, N)
@inferred QuantumObject{typeof(a),KetQuantumObject} Qobj(a)
for type in [Ket, OperatorKet]
@inferred Qobj(a, type = type)
end

UnionType =
Union{QuantumObject{Matrix{T},BraQuantumObject,1},QuantumObject{Matrix{T},OperatorQuantumObject,1}}
a = rand(T, 1, N)
@inferred UnionType Qobj(a)
for type in [Bra, OperatorBra]
@inferred Qobj(a, type = type)
end

a = rand(T, N, N)
@inferred UnionType Qobj(a)
for type in [Operator, SuperOperator]
@inferred Qobj(a, type = type)
end
for T in [ComplexF32, ComplexF64]
N = 4
a = rand(T, N)
@inferred QuantumObject{typeof(a),KetQuantumObject} Qobj(a)
for type in [Ket, OperatorKet]
@inferred Qobj(a, type = type)
end

@testset "Math Operation" begin
a = destroy(20)
σx = sigmax()
@inferred a + a
@inferred a + a'
@inferred a + 2
@inferred 2 * a
@inferred a / 2
@inferred a^2
@inferred a .+ 2
@inferred a .* 2
@inferred a ./ 2
@inferred a .^ 2
@inferred a * a
@inferred a * a'
@inferred kron(a, σx)
@inferred kron(a, eye(2))
UnionType =
Union{QuantumObject{Matrix{T},BraQuantumObject,1},QuantumObject{Matrix{T},OperatorQuantumObject,1}}
a = rand(T, 1, N)
@inferred UnionType Qobj(a)
for type in [Bra, OperatorBra]
@inferred Qobj(a, type = type)
end

a = rand(T, N, N)
@inferred UnionType Qobj(a)
for type in [Operator, SuperOperator]
@inferred Qobj(a, type = type)
end
end

@testset "Math Operation" begin
a = destroy(20)
σx = sigmax()
@inferred a + a
@inferred a + a'
@inferred a + 2
@inferred 2 * a
@inferred a / 2
@inferred a^2
@inferred a .+ 2
@inferred a .* 2
@inferred a ./ 2
@inferred a .^ 2
@inferred a * a
@inferred a * a'
@inferred kron(a, σx)
@inferred kron(a, eye(2))
end
end

Expand Down

0 comments on commit c7d6732

Please sign in to comment.