Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ It combines a symbolic layer for the SLH formalism based on [SecondQuantizedAlge
## Development status

[![Tests](https://github.com/qojulia/QuantumInputOutput.jl/actions/workflows/Tests.yml/badge.svg)](https://github.com/qojulia/QuantumInputOutput.jl/actions/workflows/Tests.yml)
[![codecov](https://codecov.io/gh/qojulia/QuantumInputOutput.jl/graph/badge.svg)](https://codecov.io/gh/qojulia/QuantumInputOutput.jl)
[![Documentation dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://qojulia.github.io/QuantumInputOutput.jl/dev/)

Note that **QuantumInputOutput.jl** is still at an early stage of development.
Expand Down
17 changes: 8 additions & 9 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,16 @@
- [ ] create more tests (cov +80%)
- [x] simple full example
- [ ] QC.jl: comparison cavity drive with full quantum (example)
- [ ] translate.jl
- [ ] utils.jl
- [ ] codecov
- [x] translate.jl
- [x] utils.jl
- [x] codecov
- [ ] interaction picture: test general A(t)
- [ ] cumulants: comparison example 04-1 and 04-2
- [ ] u_Gaussian, v_Gaussian; slower?

- [ ] more functionalities
- [ ] pulse delay
- [ ] better method for u_eff and v_eff (Victor)

- [] docu
- [x] u_eff and v_eff theory
- [ ] development status

## Additional TODOs

- [x] u_eff and v_eff equation (PRA 2020, appendix) theory, API, implementation
Expand Down Expand Up @@ -90,4 +85,8 @@

- [x] Formatter/SpellCheck
- [x] JET
- [x] Aqua
- [x] Aqua

- [x] docu
- [x] u_eff and v_eff theory
- [x] development status
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ names = [
"test_SLH.jl",
"test_feedback.jl",
"test_translate.jl",
"test_correlations.jl",
"test_example_cavity_scattering.jl",
"test_compare_example_05_1_05_2.jl",
"test_interaction_picture.jl",
Expand Down
2 changes: 1 addition & 1 deletion test/test_SLH.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using QuantumOptics
using SymbolicUtils
using FunctionWrappers: FunctionWrapper
using StaticArrays
using Test
using Test

@testset "SLH" begin
hu1 = FockSpace(:u1)
Expand Down
47 changes: 47 additions & 0 deletions test/test_correlations.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using QuantumInputOutput
using QuantumOptics
using LinearAlgebra
using Test

@testset "correlations_single_tls_decay" begin
γ = 1.0
ba = NLevelBasis(2)
σm = transition(ba, 1, 2)
ψ0 = nlevelstate(ba, 2) # initially excited

H = 0.0 * one(ba)
J = [sqrt(γ) * σm]
Ls = J[1]

T_end = 10 / γ
T = collect(0.0:0.01:T_end)
ΔT = T[2] - T[1]

function f_const(t, ρ)
return H, J, dagger.(J)
end

_, ρt_dyn = timeevolution.master_dynamic(T, ψ0, f_const)
g1_dyn = correlation_matrix(T, ρt_dyn, f_const, Ls)

_, ρt_static = timeevolution.master(T, ψ0, H, J)
g1_static = correlation_matrix(T, ρt_static, H, J, Ls)

@test maximum(abs.(g1_dyn .- g1_static)) < 1e-8

F = eigen(Hermitian((g1_static + g1_static') / 2))
n_modes = real.(F.values) * ΔT

expected_n = 1 - exp(-γ * T_end)
@test abs(n_modes[end] - expected_n) < 1e-2
@test abs(n_modes[end-1]) < 1e-2

mode_num = F.vectors[:, end] / sqrt(ΔT)
mode_exp = sqrt.(γ) .* exp.(-0.5 * γ .* T)
mode_exp ./= sqrt(sum(abs2.(mode_exp)) * ΔT)

overlap = sum(conj.(mode_exp) .* mode_num) * ΔT
mode_num_aligned = mode_num * exp(-1im * angle(overlap))
overlap_aligned = abs(sum(conj.(mode_exp) .* mode_num_aligned) * ΔT)
@test overlap_aligned > 0.99
end
35 changes: 35 additions & 0 deletions test/test_translate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,39 @@ using Test
@test sum(abs.((F_multi(0.4) - expected).data)) < 1e-8
end

@testset "translate_qo vector overload" begin
ops = [a, Δ, a * E]
translated_ops = translate_qo(
ops,
bc1;
parameter = dict_p1,
time_parameter = dict_p_t2,
operators = ops_dict,
)
@test length(translated_ops) == length(ops)
@test all(op -> op isa Function, translated_ops)
@test isequal(translated_ops[1](0.3), a_QO)
@test isequal(translated_ops[2](0.3), one(bc1) * Δn)
@test isequal(translated_ops[3](0.3), a_QO * E_t(0.3))
end

@testset "translate_qo SLH overload" begin
G_sym = SLH(1, [sqrt(κ_R) * a * E], Δ * a' * a)
H_QO, L_QO = translate_qo(
G_sym,
bc1;
parameter = dict_p1,
time_parameter = dict_p_t2,
operators = ops_dict,
)

@test H_QO isa Function
@test length(L_QO) == 1
@test L_QO[1] isa Function
@test sum(abs.((H_QO(0.4) - dense(Δn * dagger(a_QO) * a_QO)).data)) < 1e-8
@test sum(abs.((L_QO[1](0.4) - dense(sqrt(κ_Rn) * a_QO * E_t(0.4))).data)) < 1e-8
end

@testset "substitute_operators_qmul" begin
h2 = FockSpace(:h2)
a = Destroy(h2, :a, 1)
Expand All @@ -151,6 +184,8 @@ using Test

@test isequal(simplify(y - (a_1*a_1*c1 + a_1*c3)), 0)
@test isequal(simplify(y2 - (a_2*a_2*c1 + a_2*c3)), 0)

@test substitute_operators(5, dict_sub) == 5
end

@testset "substitute_operators adjoint in args_nc" begin
Expand Down
Loading