|
119 | 119 | "Quantum Object Evo.: type=SuperOperator dims=$L_dims size=$L_size ishermitian=$L_isherm isconstant=$L_isconst\n$datastring" |
120 | 120 | end |
121 | 121 |
|
122 | | - @testset "Type Inference (QuantumObject)" begin |
| 122 | + @testset "Type Inference (QobjEvo)" begin |
| 123 | + N = 4 |
123 | 124 | for T in [ComplexF32, ComplexF64] |
124 | | - N = 4 |
125 | 125 | a = MatrixOperator(rand(T, N, N)) |
126 | 126 | @inferred QobjEvo(a) |
127 | 127 | for type in [Operator, SuperOperator] |
128 | 128 | @inferred QobjEvo(a, type = type) |
129 | 129 | end |
130 | 130 | end |
131 | 131 |
|
| 132 | + a = destroy(N) |
| 133 | + coef1(p, t) = exp(-t) |
| 134 | + coef2(p::Vector, t) = sin(p[1] * t) |
| 135 | + coef3(p::NamedTuple, t) = cos(p.ω * t) |
| 136 | + @inferred QobjEvo(a, coef1) |
| 137 | + @inferred QobjEvo((a', coef2)) |
| 138 | + @inferred QobjEvo((a' * a, (a, coef1), (a', coef2), (a + a', coef3))) |
| 139 | + |
132 | 140 | @testset "Math Operation" begin |
133 | 141 | a = QobjEvo(destroy(20)) |
134 | 142 | σx = QobjEvo(sigmax()) |
|
206 | 214 | @test isconstant(L_td) == false |
207 | 215 | @test issuper(L_td) == true |
208 | 216 |
|
209 | | - coef_wrong(t) = exp(-t) |
| 217 | + coef_wrong1(t) = nothing |
| 218 | + coef_wrong2(p, t::ComplexF64) = nothing |
210 | 219 | @test_logs (:warn,) (:warn,) liouvillian(H_td * H_td) # warnings from lazy tensor |
211 | | - @test_throws ArgumentError QobjEvo(a, coef_wrong) |
| 220 | + @test_throws ArgumentError QobjEvo(a, coef_wrong1) |
| 221 | + @test_throws ArgumentError QobjEvo(a, coef_wrong2) |
212 | 222 | @test_throws MethodError QobjEvo([[a, coef1], a' * a, [a', coef2]]) |
213 | 223 | @test_throws ArgumentError H_td(ρvec, p, t) |
214 | 224 | @test_throws ArgumentError cache_operator(H_td, ρvec) |
|
0 commit comments