diff --git a/benchmarks/correlations.jl b/benchmarks/correlations.jl index 8a6c5979..17a44b6b 100644 --- a/benchmarks/correlations.jl +++ b/benchmarks/correlations.jl @@ -23,7 +23,7 @@ function benchmark_correlations!(SUITE) G_cas = ▷(G_u, G_c, G_v) H_sym = hamiltonian(G_cas) - L_sym = lindblad(G_cas)[1] + L_sym = jump_operator(G_cas)[1] γ_ = 1.0 σ_pulse = 1 / γ_ diff --git a/benchmarks/interaction_picture.jl b/benchmarks/interaction_picture.jl index cb743bef..c4833c9a 100644 --- a/benchmarks/interaction_picture.jl +++ b/benchmarks/interaction_picture.jl @@ -67,7 +67,7 @@ function benchmark_interaction_picture!(SUITE) G_cas = ▷(G_u, G_s, G_v) H = hamiltonian(G_cas) - L = lindblad(G_cas)[1] + L = jump_operator(G_cas)[1] H_uv = hamiltonian(▷(G_u, G_v)) H_int_ = simplify(H - H_uv) diff --git a/benchmarks/slh_algebra.jl b/benchmarks/slh_algebra.jl index 0a4e4ed0..384427d5 100644 --- a/benchmarks/slh_algebra.jl +++ b/benchmarks/slh_algebra.jl @@ -26,7 +26,7 @@ function benchmark_slh_algebra!(SUITE) SUITE["SLH Algebra"]["symbolic"]["3-cavity cascade"] = @benchmarkable begin G_cas = ▷($G_u, $G_c, $G_v) hamiltonian(G_cas) - lindblad(G_cas) + jump_operator(G_cas) end SUITE["SLH Algebra"]["symbolic"]["concatenate + cascade"] = @benchmarkable begin @@ -87,7 +87,7 @@ function benchmark_slh_algebra!(SUITE) G_L_t = $G_L2 ▷ $G_ϕ_12 ▷ $G_L1 G_t = G_R_t ⊞ G_L_t hamiltonian(G_t) - lindblad(G_t) + jump_operator(G_t) end ## --- Time-dependent closure evaluation (the ODE hot loop) --- @@ -99,7 +99,7 @@ function benchmark_slh_algebra!(SUITE) G_t = G_R_t ⊞ G_L_t H_f = hamiltonian(G_t) - L_f = lindblad(G_t) + L_f = jump_operator(G_t) t_mid = T[length(T)÷2] diff --git a/benchmarks/translation.jl b/benchmarks/translation.jl index 4e5db477..ffae277f 100644 --- a/benchmarks/translation.jl +++ b/benchmarks/translation.jl @@ -30,7 +30,7 @@ function benchmark_translation!(SUITE) G_v = SLH(1, gv_sym * av_, 0) G_cas = ▷(G_u, G_c, G_v) H_sym = hamiltonian(G_cas) - L_sym = lindblad(G_cas)[1] + L_sym = jump_operator(G_cas)[1] ## --- Static translation (no time dependence) --- diff --git a/docs/src/api.md b/docs/src/api.md index d6475011..b723a189 100644 --- a/docs/src/api.md +++ b/docs/src/api.md @@ -11,6 +11,7 @@ scattering ``` ```@docs +jump_operator lindblad ``` diff --git a/docs/src/implementation.md b/docs/src/implementation.md index 0f2f89d9..51809215 100644 --- a/docs/src/implementation.md +++ b/docs/src/implementation.md @@ -21,13 +21,13 @@ av = Destroy(h, :a_v, 3) An SLH component is represented as `(S, L, H)` by the [`SLH`](@ref) type. The cascade [`▷`](@ref), concatenation [`⊞`](@ref), and feedback reduction [`feedback`](@ref) rules implement the standard network composition from the SLH framework. -The resulting effective operators are accessed by [`hamiltonian`](@ref) and [`lindblad`](@ref) and remain symbolic until translation. This is especially useful when you want to further manipulate the expressions, e.g. to transform into the interaction picture. +The resulting effective operators are accessed by [`hamiltonian`](@ref) and [`jump_operator`](@ref) and remain symbolic until translation. This is especially useful when you want to further manipulate the expressions, e.g. to transform into the interaction picture. ```julia G_cas = ▷(G_u, G_s, G_v) H = hamiltonian(G_cas) -L = lindblad(G_cas) +L = jump_operator(G_cas) ``` For networks with internal loops, the symbolic model can be reduced directly with [`feedback`](@ref), which applies the SLH feedback reduction rule before translation. This keeps the symbolic workflow consistent: build a network from cascades and concatenations, eliminate internal connections symbolically, and only then translate the reduced Hamiltonian and Lindblad operators to numerics. diff --git a/docs/src/tutorial.md b/docs/src/tutorial.md index 94f64f09..9e6b9eb5 100644 --- a/docs/src/tutorial.md +++ b/docs/src/tutorial.md @@ -52,7 +52,7 @@ H = hamiltonian(G_cas) ``` ```@example tutorial -L = lindblad(G_cas)[1] +L = jump_operator(G_cas)[1] ``` ## 2. Numerical parameters and input pulse diff --git a/examples/01-1_cavity-scattering__PRL2019_123-123604_fig2-fig3.jl b/examples/01-1_cavity-scattering__PRL2019_123-123604_fig2-fig3.jl index 982c46a6..26c558b2 100644 --- a/examples/01-1_cavity-scattering__PRL2019_123-123604_fig2-fig3.jl +++ b/examples/01-1_cavity-scattering__PRL2019_123-123604_fig2-fig3.jl @@ -44,7 +44,7 @@ H = hamiltonian(G_cas) # -L = lindblad(G_cas)[1] # only one Lindblad term in this example +L = jump_operator(G_cas)[1] # only one Lindblad term in this example # To solve the dynamics of the system we translate the symbolic expressions into numeric operators (matrices) of QuantumOptics.jl. To do so, we define the numerical parameters and operator basis. diff --git a/examples/01-2_stimulated-emission__PRL2019_123-123604_fig4.jl b/examples/01-2_stimulated-emission__PRL2019_123-123604_fig4.jl index ca752a47..d9af02d1 100644 --- a/examples/01-2_stimulated-emission__PRL2019_123-123604_fig4.jl +++ b/examples/01-2_stimulated-emission__PRL2019_123-123604_fig4.jl @@ -43,7 +43,7 @@ H = G_cas.hamiltonian # -L = G_cas.lindblad[1] # only one Lindblad in this example +L = G_cas.jump_operator[1] # only one Lindblad in this example # diff --git a/examples/02-1_cavity-phase-noise__PRA2020_102- 023717_fig2.jl b/examples/02-1_cavity-phase-noise__PRA2020_102- 023717_fig2.jl index 686f0d06..4f9daf75 100644 --- a/examples/02-1_cavity-phase-noise__PRA2020_102- 023717_fig2.jl +++ b/examples/02-1_cavity-phase-noise__PRA2020_102- 023717_fig2.jl @@ -41,7 +41,7 @@ H = hamiltonian(G_cas) # -L = lindblad(G_cas)[1] # only one Lindblad in this example +L = jump_operator(G_cas)[1] # only one jump operator in this example # diff --git a/examples/02-3_mode-entanglement__PRA2020_102-023717_fig4.jl b/examples/02-3_mode-entanglement__PRA2020_102-023717_fig4.jl index 08eec901..92c5188f 100644 --- a/examples/02-3_mode-entanglement__PRA2020_102-023717_fig4.jl +++ b/examples/02-3_mode-entanglement__PRA2020_102-023717_fig4.jl @@ -48,7 +48,7 @@ G_v2 = SLH(1, g_v2' * av2, 0) G = cascade(G_s, G_v1, G_v2) H = hamiltonian(G) -L = lindblad(G)[1] +L = jump_operator(G)[1] nothing # hide # We use the parameters quoted in the paper and initialize the emitter in the excited state. diff --git a/examples/03-1_beam-combiner__PRA2023_107-023715_fig2-fig3.jl b/examples/03-1_beam-combiner__PRA2023_107-023715_fig2-fig3.jl index 2f5c4760..709befb4 100644 --- a/examples/03-1_beam-combiner__PRA2023_107-023715_fig2-fig3.jl +++ b/examples/03-1_beam-combiner__PRA2023_107-023715_fig2-fig3.jl @@ -49,7 +49,7 @@ H = hamiltonian(G_cas) # -L = lindblad(G_cas)[1] # only one Lindblad in this example +L = jump_operator(G_cas)[1] # only one Lindblad in this example # Next, the numerical parameters and functions of the system are defined. diff --git a/examples/04-1_two-sided-cavity_with-atom_coh-drive.jl b/examples/04-1_two-sided-cavity_with-atom_coh-drive.jl index 9d344340..673a9df6 100644 --- a/examples/04-1_two-sided-cavity_with-atom_coh-drive.jl +++ b/examples/04-1_two-sided-cavity_with-atom_coh-drive.jl @@ -46,11 +46,11 @@ H1 = hamiltonian(G_cav_L_R_drive) # -L1_L = lindblad(G_cav_L_R_drive)[1] +L1_L = jump_operator(G_cav_L_R_drive)[1] # -L1_R = lindblad(G_cav_L_R_drive)[2] +L1_R = jump_operator(G_cav_L_R_drive)[2] # Here, the usual classical cavity drive-term $\sqrt{\kappa_L} E (a^\dagger + a)$ appears as a combination of Hamiltonian and Lindblad term. # To solve the dynamics of the system we translate the symbolic expressions into numeric operators (matrices) of [QuantumOptics.jl](https://github.com/qojulia/QuantumOptics.jl). Since we do not want to include the basis of the atoms, we provide a dictionary of operators with the kwarg `operators` in the function [`to_numeric`](@ref). @@ -140,11 +140,11 @@ H2 = G_ac_drive.hamiltonian # -L2_L = G_ac_drive.lindblad[1] +L2_L = G_ac_drive.jump_operator[1] # -L2_R = G_ac_drive.lindblad[2] +L2_R = G_ac_drive.jump_operator[2] # diff --git a/examples/04-2_two-sided-cavity_with-atom_coh-drive__cumulants.jl b/examples/04-2_two-sided-cavity_with-atom_coh-drive__cumulants.jl index 72e581b0..59bfbc04 100644 --- a/examples/04-2_two-sided-cavity_with-atom_coh-drive__cumulants.jl +++ b/examples/04-2_two-sided-cavity_with-atom_coh-drive__cumulants.jl @@ -45,11 +45,11 @@ H1 = hamiltonian(G_cav_L_R_drive) # -L1_L = lindblad(G_cav_L_R_drive)[1] +L1_L = jump_operator(G_cav_L_R_drive)[1] # -L1_R = lindblad(G_cav_L_R_drive)[2] +L1_R = jump_operator(G_cav_L_R_drive)[2] # The typical cavity drive-term $\sqrt{\kappa_L} E (a^\dagger + a)$ is a combination of Hamiltonian term and Lindblad. # We use the function `meanfield` to obtain the equation for the intra-cavity field, which leads to a closed set of equations in this particular case. @@ -153,11 +153,11 @@ H2 = G_ac_drive.hamiltonian # -L2_L = G_ac_drive.lindblad[1] +L2_L = G_ac_drive.jump_operator[1] # -L2_R = G_ac_drive.lindblad[2] +L2_R = G_ac_drive.jump_operator[2] # We derive the equations of motion for system with a second-order mean-field approximation. diff --git a/examples/05-1_N-QDs_bidirectional-waveguide_coherent-pulse.jl b/examples/05-1_N-QDs_bidirectional-waveguide_coherent-pulse.jl index 910fc103..2a2c5c00 100644 --- a/examples/05-1_N-QDs_bidirectional-waveguide_coherent-pulse.jl +++ b/examples/05-1_N-QDs_bidirectional-waveguide_coherent-pulse.jl @@ -55,7 +55,7 @@ H = hamiltonian(G_t) # -L = lindblad(G_t) +L = jump_operator(G_t) L_R = L[1] # diff --git a/examples/05-2_N-QDs_bidirectional-waveguide_quantum-pulse_qo.jl b/examples/05-2_N-QDs_bidirectional-waveguide_quantum-pulse_qo.jl index d9a7b63e..4ed14413 100644 --- a/examples/05-2_N-QDs_bidirectional-waveguide_quantum-pulse_qo.jl +++ b/examples/05-2_N-QDs_bidirectional-waveguide_quantum-pulse_qo.jl @@ -68,7 +68,7 @@ nothing # hide # The full Hamiltonian and Lindblad terms are extracted from the final SLH element. Note that as soon as one time-dependent function is involved in a cascade or concatenate, the returned $H$ and $L$ will also be time-dependent. H = hamiltonian(G_t) -L = lindblad(G_t) +L = jump_operator(G_t) L_R = L[1] L_L = L[2] diff --git a/examples/05-3_N-QDs_bidirectional-waveguide_feedback-reduction.jl b/examples/05-3_N-QDs_bidirectional-waveguide_feedback-reduction.jl index f8726984..e2db6850 100644 --- a/examples/05-3_N-QDs_bidirectional-waveguide_feedback-reduction.jl +++ b/examples/05-3_N-QDs_bidirectional-waveguide_feedback-reduction.jl @@ -51,7 +51,7 @@ nothing # hide # second one to the transmitted right-moving output. H = hamiltonian(G_t) -L = lindblad(G_t) +L = jump_operator(G_t) L_L = L[1] L_R = L[2] nothing # hide diff --git a/examples/06-1_interaction-picture__PRA2023_107-013706_fig2.jl b/examples/06-1_interaction-picture__PRA2023_107-013706_fig2.jl index 63a37137..da518eb4 100644 --- a/examples/06-1_interaction-picture__PRA2023_107-013706_fig2.jl +++ b/examples/06-1_interaction-picture__PRA2023_107-013706_fig2.jl @@ -42,7 +42,7 @@ H = hamiltonian(G_cas) # -L = lindblad(G_cas)[1] +L = jump_operator(G_cas)[1] # Usually we deal with the above derived Hamiltonian and Lindblad. In this example, however, we transform the system into the interaction picture of the virtual cavity-cavity interaction Hamiltonian $H_{uv}$. diff --git a/examples/07-1_beamsplitter_loss__quantum-pulse.jl b/examples/07-1_beamsplitter_loss__quantum-pulse.jl index b87131d3..85eeaf9f 100644 --- a/examples/07-1_beamsplitter_loss__quantum-pulse.jl +++ b/examples/07-1_beamsplitter_loss__quantum-pulse.jl @@ -51,7 +51,7 @@ H = hamiltonian(G) # -L = lindblad(G) +L = jump_operator(G) L[1] # diff --git a/examples/07-2_hong-ou-mandel__quantum-pulse.jl b/examples/07-2_hong-ou-mandel__quantum-pulse.jl index 013ffa12..03dbae19 100644 --- a/examples/07-2_hong-ou-mandel__quantum-pulse.jl +++ b/examples/07-2_hong-ou-mandel__quantum-pulse.jl @@ -50,7 +50,7 @@ H = hamiltonian(G) # -L = lindblad(G) +L = jump_operator(G) L[1] # diff --git a/examples/08-1_pulse-delay__simple.jl b/examples/08-1_pulse-delay__simple.jl index 16715be0..a8ae33c9 100644 --- a/examples/08-1_pulse-delay__simple.jl +++ b/examples/08-1_pulse-delay__simple.jl @@ -49,7 +49,7 @@ G_v2 = concatenate(SLH(1, 0, 0), G_v) G_cas = cascade(G_u2, G_d, G_v2) H = hamiltonian(G_cas) -L = lindblad(G_cas) +L = jump_operator(G_cas) nothing # hide # diff --git a/examples/09-1_coherent-feedback-squeezing__Gough-Wildfeuer-2009.jl b/examples/09-1_coherent-feedback-squeezing__Gough-Wildfeuer-2009.jl index fe8eceed..fa308860 100644 --- a/examples/09-1_coherent-feedback-squeezing__Gough-Wildfeuer-2009.jl +++ b/examples/09-1_coherent-feedback-squeezing__Gough-Wildfeuer-2009.jl @@ -36,7 +36,7 @@ nothing # hide # S_loop = scattering(G_loop) -L_loop = lindblad(G_loop)[1] +L_loop = jump_operator(G_loop)[1] # diff --git a/examples/10-1_SUPER_excitation.jl b/examples/10-1_SUPER_excitation.jl index 3a11a44e..4c1b9f9f 100644 --- a/examples/10-1_SUPER_excitation.jl +++ b/examples/10-1_SUPER_excitation.jl @@ -50,7 +50,7 @@ nothing # hide ## Hamiltonian and Lindbladian Hcas = hamiltonian(G_cas) -Lcas = lindblad(G_cas)[1] +Lcas = jump_operator(G_cas)[1] Lcasd = adjoint(Lcas) nothing # hide diff --git a/examples/drafts/02-2_traveling-cat-state__PRA2020_102-023717_fig3b.jl b/examples/drafts/02-2_traveling-cat-state__PRA2020_102-023717_fig3b.jl index f16f70b2..a11db69b 100644 --- a/examples/drafts/02-2_traveling-cat-state__PRA2020_102-023717_fig3b.jl +++ b/examples/drafts/02-2_traveling-cat-state__PRA2020_102-023717_fig3b.jl @@ -38,7 +38,7 @@ H_s = p / 2 * (a'^2 + a^2) - K / 2 * (a'^2) * (a^2) + Δ * a' * a G_s = SLH(1, √(γ) * a, H_s) H = hamiltonian(G_s) -L = lindblad(G_s)[1] +L = jump_operator(G_s)[1] nothing # hide # Next, we define the numerical parameters from Sec. II.D. The classical pump @@ -127,7 +127,7 @@ G_v = SLH(1, g_v * av, 0) G = G_s2 ▷ G_v H_2 = hamiltonian(G) -L_2 = lindblad(G)[1] +L_2 = jump_operator(G)[1] gv_t = coupling_output(v_mode, T) dict_p_t_2 = Dict(p => p_t, g_v => gv_t) diff --git a/examples/drafts/08-2_pulse-propagation-delay__PRA2026_113-013730_fig4.jl b/examples/drafts/08-2_pulse-propagation-delay__PRA2026_113-013730_fig4.jl index 40dcca0f..3aa4d771 100644 --- a/examples/drafts/08-2_pulse-propagation-delay__PRA2026_113-013730_fig4.jl +++ b/examples/drafts/08-2_pulse-propagation-delay__PRA2026_113-013730_fig4.jl @@ -66,7 +66,7 @@ G_atom = SLH(I4, L_atom, Δ*σ(2, 2)) G_u_bs_d1_d2_atom = G_u_bs_d1_d2 ▷ G_atom H = hamiltonian(G_u_bs_d1_d2_atom) -L = lindblad(G_u_bs_d1_d2_atom) +L = jump_operator(G_u_bs_d1_d2_atom) # diff --git a/examples/drafts/10-1_SUPER_excitation.jl b/examples/drafts/10-1_SUPER_excitation.jl index 4c9fb140..4f764184 100644 --- a/examples/drafts/10-1_SUPER_excitation.jl +++ b/examples/drafts/10-1_SUPER_excitation.jl @@ -184,7 +184,7 @@ G_cas = ▷(G_u2, G_u1, G_2lvl, G_v1, G_v2) # cascade # Hamiltonian and Lindbladian Hcas = hamiltonian(G_cas) -Lcas = lindblad(G_cas)[1] +Lcas = jump_operator(G_cas)[1] Lcasd = adjoint(Lcas) # Time-dependent couplings @@ -577,8 +577,8 @@ Gcon = ⊞(G_ch1, G_ch2) # concatenation # Hamiltonian and Lindblad operators (two channels) Hcon = hamiltonian(Gcon) -Lch1g = lindblad(Gcon)[1] -Lch2g = lindblad(Gcon)[2] +Lch1g = jump_operator(Gcon)[1] +Lch2g = jump_operator(Gcon)[2] Ldch1g = adjoint(Lch1g) Ldch2g = adjoint(Lch2g) @@ -734,7 +734,7 @@ G_cas_1m = ▷(G_u, G_2lvls, G_v) # Hamiltonian and Lindbladian Hcas_1m = hamiltonian(G_cas_1m) -Lcas_1m = lindblad(G_cas_1m)[1] +Lcas_1m = jump_operator(G_cas_1m)[1] Lcas_1md = adjoint(Lcas_1m) # Time-dependent couplings @@ -869,7 +869,7 @@ T = [dt:dt:Tend;] G_cas_1m0 = ▷(G_u, G_2lvls, G_v) Hcas_1m0 = hamiltonian(G_cas_1m0) -Lcas_1m0 = lindblad(G_cas_1m0)[1] +Lcas_1m0 = jump_operator(G_cas_1m0)[1] Lcas_1m0d = adjoint(Lcas_1m0) # Set v-coupling to zero (collect only input-system correlations) @@ -1201,7 +1201,7 @@ G_cas_1m = ▷(G_u, G_2lvls, G_v) # Hamiltonian and Lindbladian Hcas_1m = hamiltonian(G_cas_1m) -Lcas_1m = lindblad(G_cas_1m)[1] +Lcas_1m = jump_operator(G_cas_1m)[1] Lcas_1md = adjoint(Lcas_1m) # Time-dependent couplings diff --git a/examples/drafts/11-1_two-level-system_spontaneous-emission.jl b/examples/drafts/11-1_two-level-system_spontaneous-emission.jl index b43b51bb..af631c51 100644 --- a/examples/drafts/11-1_two-level-system_spontaneous-emission.jl +++ b/examples/drafts/11-1_two-level-system_spontaneous-emission.jl @@ -36,7 +36,7 @@ G_v = SLH(1, g_v' * av, 0) G = cascade(G_s, G_v) H = hamiltonian(G) -L = lindblad(G)[1] +L = jump_operator(G)[1] nothing # hide # We use the spontaneous-emission rate as the frequency unit. At diff --git a/src/QuantumInputOutput.jl b/src/QuantumInputOutput.jl index 3f6e7b05..58412d9d 100644 --- a/src/QuantumInputOutput.jl +++ b/src/QuantumInputOutput.jl @@ -18,6 +18,7 @@ const SQA = SecondQuantizedAlgebra export SLH, Gaussian, scattering, + jump_operator, lindblad, hamiltonian, # Composition diff --git a/src/SLH.jl b/src/SLH.jl index 34bc2d0b..4ab6bccb 100644 --- a/src/SLH.jl +++ b/src/SLH.jl @@ -68,7 +68,7 @@ end _fw_return_type(::Type{FunctionWrapper{R,A}}) where {R,A} = R -function _maybe_wrap_lindblad(L::SVector{N}, ::Type{OpType}) where {N,OpType} +function _maybe_wrap_jump_operators(L::SVector{N}, ::Type{OpType}) where {N,OpType} if any(_is_time_dep, L) fw_type = FunctionWrapper{OpType,Tuple{Float64}} return SVector{N,fw_type}(ntuple(i -> fw_type(_to_func(L[i])), Val(N))) @@ -90,21 +90,21 @@ end """ SLH{N, ST, LT, HT} -SLH triple with scattering matrix `S`, Lindblad vector `L`, and Hamiltonian `H`. -`S` and `L` can also be vectors of scattering matrices and Lindblad terms. +SLH triple with scattering matrix `S`, jump-operator vector `L`, and Hamiltonian `H`. +`S` and `L` can also be vectors of scattering matrices and jump operators. See also [`▷`](@ref), [`⊞`](@ref), [`feedback`](@ref) """ struct SLH{N,ST,LT,HT,L} scattering::SMatrix{N,N,ST,L} - lindblad::SVector{N,LT} + jump_operator::SVector{N,LT} hamiltonian::HT function SLH{N,ST,LT,HT}( S::SMatrix{N,N,ST,L}, - lindblad::SVector{N,LT}, + jump_operator::SVector{N,LT}, H::HT, ) where {N,ST,LT,HT,L} - return new{N,ST,LT,HT,L}(S, lindblad, H) + return new{N,ST,LT,HT,L}(S, jump_operator, H) end end @@ -138,7 +138,7 @@ end function _build_slh(S::SMatrix{N,N}, L::SVector{N}, H, ::Type{OpType}) where {N,OpType} has_td = any(_is_time_dep, L) || _is_time_dep(H) if has_td - L_w = _maybe_wrap_lindblad(L, OpType) + L_w = _maybe_wrap_jump_operators(L, OpType) H_w = _maybe_wrap_hamiltonian(H, true, OpType) return SLH{N,eltype(S),eltype(L_w),typeof(H_w)}(S, L_w, H_w) end @@ -187,12 +187,22 @@ Return the scattering matrix `S` of an SLH object. """ scattering(G::SLH) = G.scattering +""" + jump_operator(G::SLH) + +Return the jump-operator vector `L` of an SLH object. +""" +jump_operator(G::SLH) = G.jump_operator + """ lindblad(G::SLH) -Return the Lindblad vector `L` of an SLH object. +Deprecated alias for [`jump_operator`](@ref). """ -lindblad(G::SLH) = G.lindblad +Base.@noinline function lindblad(G::SLH) + Base.depwarn("`lindblad` is deprecated; use `jump_operator` instead.", :lindblad) + return jump_operator(G) +end """ hamiltonian(G::SLH) @@ -208,7 +218,7 @@ hamiltonian(G::SLH) = G.hamiltonian function Base.isequal(G1::SLH, G2::SLH) isequal(scattering(G1), scattering(G2)) && - isequal(lindblad(G1), lindblad(G2)) && + isequal(jump_operator(G1), jump_operator(G2)) && isequal(hamiltonian(G1), hamiltonian(G2)) end @@ -260,8 +270,8 @@ Cascade two SLH triples: Unicode `\\triangleright`. See also [`cascade`](@ref). """ function ▷(G1::SLH{N}, G2::SLH{N}) where {N} - S1, L1, H1 = scattering(G1), lindblad(G1), hamiltonian(G1) - S2, L2, H2 = scattering(G2), lindblad(G2), hamiltonian(G2) + S1, L1, H1 = scattering(G1), jump_operator(G1), hamiltonian(G1) + S2, L2, H2 = scattering(G2), jump_operator(G2), hamiltonian(G2) S_t = _post.(S2 * S1) S2L1 = _slh_matvec(S2, L1) @@ -315,8 +325,8 @@ Unicode `\\boxplus`. See also [`concatenate`](@ref). end quote - S1, L1, H1 = scattering(G1), lindblad(G1), hamiltonian(G1) - S2, L2, H2 = scattering(G2), lindblad(G2), hamiltonian(G2) + S1, L1, H1 = scattering(G1), jump_operator(G1), hamiltonian(G1) + S2, L2, H2 = scattering(G2), jump_operator(G2), hamiltonian(G2) S_t = SMatrix{$N,$N}($(s_exprs...)) L_t = vcat(L1, L2) H_t = _add(H1, H2) @@ -386,7 +396,7 @@ end function _feedback_impl(G::SLH{N}, x::Int, y::Int, ::Val{M}) where {N,M} S = scattering(G) - L = lindblad(G) + L = jump_operator(G) H = hamiltonian(G) @assert 1 <= x <= N && 1 <= y <= N @@ -463,12 +473,12 @@ end Translate the Hamiltonian and Lindblad operators of an SLH object `G` into numeric [QuantumOptics.jl](https://github.com/qojulia/QuantumOptics.jl) operators on the basis `b`. Returns the tuple `(H_QO, L_QO)`, where `L_QO` is a vector holding one translated operator -per jump operator in `lindblad(G)`. All keyword arguments (`parameter`, `time_parameter`, +per jump operator in `jump_operator(G)`. All keyword arguments (`parameter`, `time_parameter`, `operators`, `adjoint_ops`, `op_type`) are forwarded to [`SecondQuantizedAlgebra.to_numeric`](@ref). """ function SQA.to_numeric(G::SLH, b::QuantumOpticsBase.Basis; kwargs...) H_QO = SQA.to_numeric(hamiltonian(G), b; kwargs...) - L_QO = [SQA.to_numeric(L_, b; kwargs...) for L_ in lindblad(G)] + L_QO = [SQA.to_numeric(L_, b; kwargs...) for L_ in jump_operator(G)] return H_QO, L_QO end diff --git a/test/test_SLH.jl b/test/test_SLH.jl index b4792b78..dbf43ee5 100644 --- a/test/test_SLH.jl +++ b/test/test_SLH.jl @@ -25,12 +25,13 @@ using Test G_v = SLH(1, gv'*av, 0) # output cavity G_c_S = scattering(G_c) - G_c_L = lindblad(G_c) + G_c_L = jump_operator(G_c) G_c_H = hamiltonian(G_c) @test G_c_S == G_c.scattering - @test G_c_L == G_c.lindblad + @test G_c_L == G_c.jump_operator @test G_c_H == G_c.hamiltonian + @test_deprecated lindblad(G_c) @test G_c_S isa SMatrix{1,1} @test G_c_L isa SVector{1} @@ -41,7 +42,7 @@ using Test @testset "simple_cascade" begin G1 = G_u ▷ G_c @test scattering(G1) isa SMatrix{1,1} - @test iszero(simplify(lindblad(G1)[1] - simplify(gu'*au + √(γ)*c))) + @test iszero(simplify(jump_operator(G1)[1] - simplify(gu'*au + √(γ)*c))) expected_H = simplify( hamiltonian(G_c) - 1im/2*((√(γ)*c)'*(1)*gu'*au - (gu'*au)'*(1)*(√(γ)*c)), ) @@ -54,7 +55,7 @@ using Test @test isequal(G2, ▷(G1, G_v)) @test isequal(G2, G3) - @test iszero(simplify(lindblad(G2)[1] - (gu'*au + √(γ)*c + gv'*av))) + @test iszero(simplify(jump_operator(G2)[1] - (gu'*au + √(γ)*c + gv'*av))) end @testset "simple_concatenate" begin @@ -65,9 +66,9 @@ using Test @test scattering(Gc) isa SMatrix{2,2} @test size(scattering(Gc)) == (2, 2) - @test length(lindblad(Gc)) == 2 - @test isequal(lindblad(Gc)[1], gu'*au) - @test isequal(lindblad(Gc)[2], √(γ)*c) + @test length(jump_operator(Gc)) == 2 + @test isequal(jump_operator(Gc)[1], gu'*au) + @test isequal(jump_operator(Gc)[2], √(γ)*c) @test isequal(hamiltonian(Gc), Δ*c'c) Gc2 = G1 ⊞ G2 @@ -90,9 +91,9 @@ using Test G_out = SLH(1, gv1' * av1, 0) ⊞ SLH(1, gv2' * av2, 0) G_cas = G_bs ▷ G_out - @test length(lindblad(G_cas)) == 2 - @test iszero(simplify(lindblad(G_cas)[1] - (gv1' * av1))) - @test iszero(simplify(lindblad(G_cas)[2] - (gv2' * av2))) + @test length(jump_operator(G_cas)) == 2 + @test iszero(simplify(jump_operator(G_cas)[1] - (gv1' * av1))) + @test iszero(simplify(jump_operator(G_cas)[2] - (gv2' * av2))) end @testset "numeric type stability" begin @@ -105,13 +106,13 @@ using Test @testset "static SLH concreteness" begin G = SLH(1, L_s, H_s) - @test eltype(lindblad(G)) === typeof(L_s) + @test eltype(jump_operator(G)) === typeof(L_s) @test typeof(hamiltonian(G)) === typeof(H_s) end @testset "time-dep SLH wraps into FunctionWrapper" begin G_td = SLH(1, gu_f, H_s) - @test eltype(lindblad(G_td)) <: FunctionWrapper + @test eltype(jump_operator(G_td)) <: FunctionWrapper @test typeof(hamiltonian(G_td)) <: FunctionWrapper end @@ -119,35 +120,35 @@ using Test G1 = SLH(1, gu_f, H_s) G2 = SLH(1, gv_f, H_s) G_cas = G1 ▷ G2 - @test eltype(lindblad(G_cas)) <: FunctionWrapper + @test eltype(jump_operator(G_cas)) <: FunctionWrapper @test typeof(hamiltonian(G_cas)) <: FunctionWrapper - @inferred lindblad(G_cas)[1](0.5) + @inferred jump_operator(G_cas)[1](0.5) end @testset "cascade mixed static/time-dep wraps uniformly" begin G_cas = SLH(1, L_s, H_s) ▷ SLH(1, gu_f, H_s) - @test eltype(lindblad(G_cas)) <: FunctionWrapper - @test eltype(lindblad(G_cas)) !== Any + @test eltype(jump_operator(G_cas)) <: FunctionWrapper + @test eltype(jump_operator(G_cas)) !== Any end @testset "concatenation mixed static/time-dep wraps uniformly" begin G_cat = SLH(1, L_s, H_s) ⊞ SLH(1, gu_f, H_s) - LT = eltype(lindblad(G_cat)) + LT = eltype(jump_operator(G_cat)) @test LT <: FunctionWrapper @test LT !== Any - @inferred lindblad(G_cat)[1](0.5) - @inferred lindblad(G_cat)[2](0.5) + @inferred jump_operator(G_cat)[1](0.5) + @inferred jump_operator(G_cat)[2](0.5) end @testset "concatenation static stays static" begin G_cat = SLH(1, L_s, H_s) ⊞ SLH(1, L_s, H_s) - @test eltype(lindblad(G_cat)) === typeof(L_s) - @test !(eltype(lindblad(G_cat)) <: FunctionWrapper) + @test eltype(jump_operator(G_cat)) === typeof(L_s) + @test !(eltype(jump_operator(G_cat)) <: FunctionWrapper) end @testset "FunctionWrapper call is inferred" begin G_td = SLH(1, gu_f, H_s) - l = lindblad(G_td)[1] + l = jump_operator(G_td)[1] @inferred l(0.5) end @@ -172,7 +173,7 @@ using Test G2 = SLH(1, gv_f, H_s) G_cat = G1 ⊞ G2 G_fb = feedback(G_cat, 2, 1) - @test eltype(lindblad(G_fb)) <: FunctionWrapper + @test eltype(jump_operator(G_fb)) <: FunctionWrapper @test typeof(hamiltonian(G_fb)) <: FunctionWrapper end end diff --git a/test/test_compare_example_05_1_05_2.jl b/test/test_compare_example_05_1_05_2.jl index bc141d50..d36d5c6a 100644 --- a/test/test_compare_example_05_1_05_2.jl +++ b/test/test_compare_example_05_1_05_2.jl @@ -39,7 +39,7 @@ using Test G_t = G_R_t ⊞ G_L_t H = hamiltonian(G_t) - L = lindblad(G_t) + L = jump_operator(G_t) L_R = L[1] L_L = L[2] @@ -96,7 +96,7 @@ using Test G_t_qo = G_R_t_qo ⊞ G_L_t_qo H_qo = hamiltonian(G_t_qo) - L_qo = lindblad(G_t_qo) + L_qo = jump_operator(G_t_qo) L_R_qo = L_qo[1] L_L_qo = L_qo[2] diff --git a/test/test_example_cavity_scattering.jl b/test/test_example_cavity_scattering.jl index b68ec3fa..d74c61ce 100644 --- a/test/test_example_cavity_scattering.jl +++ b/test/test_example_cavity_scattering.jl @@ -24,7 +24,7 @@ using Test G_cas = ▷(G_u, G_c, G_v) H = hamiltonian(G_cas) - L = lindblad(G_cas)[1] + L = jump_operator(G_cas)[1] γ_ = 1.0 Δ_ = 0.0 diff --git a/test/test_feedback.jl b/test/test_feedback.jl index ce083860..024d73dd 100644 --- a/test/test_feedback.jl +++ b/test/test_feedback.jl @@ -56,7 +56,7 @@ using Test @test scattering(G_red) isa SMatrix{1,1} @test abs(scattering(G_red)[1, 1] - expected_S) < 1e-10 - @test abs(lindblad(G_red)[1] - expected_L) < 1e-10 + @test abs(jump_operator(G_red)[1] - expected_L) < 1e-10 @test abs(hamiltonian(G_red) - expected_H) < 1e-10 @testset "coherent-feedback OPO loop" begin @@ -77,7 +77,7 @@ using Test l = simplify(η / (1 + r)) @test scattering(G_loop) isa SMatrix{1,1} - @test iszero(simplify(lindblad(G_loop)[1] - simplify(l * √(κ) * a))) + @test iszero(simplify(jump_operator(G_loop)[1] - simplify(l * √(κ) * a))) @test iszero(simplify(hamiltonian(G_loop) - hamiltonian(G_opo))) end @@ -109,8 +109,8 @@ using Test G_network = G_in ⊞ G_qd(1) ⊞ G_phase(1, 2) ⊞ G_qd(2) G_feedback = feedback(G_network, 1 => 3, 3 => 5, 5 => 7, 8 => 6, 6 => 4, 4 => 2) - @test isequal(lindblad(G_feedback)[1], lindblad(G_manual)[2]) - @test isequal(lindblad(G_feedback)[2], lindblad(G_manual)[1]) + @test isequal(jump_operator(G_feedback)[1], jump_operator(G_manual)[2]) + @test isequal(jump_operator(G_feedback)[2], jump_operator(G_manual)[1]) @test iszero(simplify(hamiltonian(G_feedback) - hamiltonian(G_manual))) end @@ -125,9 +125,9 @@ using Test G_cat = SLH(1, gu_f, H_s) ⊞ SLH(1, gv_f, H_s) G_fb = feedback(G_cat, 1, 1) - LT = eltype(lindblad(G_fb)) + LT = eltype(jump_operator(G_fb)) @test LT <: FunctionWrapper @test LT !== Any - @inferred lindblad(G_fb)[1](0.5) + @inferred jump_operator(G_fb)[1](0.5) end end diff --git a/test/test_interaction_picture.jl b/test/test_interaction_picture.jl index 5cb3e0be..9db62b54 100644 --- a/test/test_interaction_picture.jl +++ b/test/test_interaction_picture.jl @@ -39,7 +39,7 @@ using Test G_cas = ▷(G_u, G_s, G_v) H = hamiltonian(G_cas) - L = lindblad(G_cas)[1] + L = jump_operator(G_cas)[1] H_uv = hamiltonian(▷(G_u, G_v)) H_int_sym_ = simplify(H - H_uv)