betaFeedback

WorksPhysics and Astronomy

QuantumInputOutput.jl: A Julia framework for input-output theory with quantum pulses and the SLH formalism

Abstract

The interaction of traveling photonic pulses with quantum systems is a fundamental process for many quantum technologies such as quantum communication, control, and measurement protocols. The so-called SLH formalism, named for the triple of operators that parametrize the dynamics, in combination with virtual emission and absorption cavities provides a general toolbox to describe such processes. However, modeling open quantum systems driven by propagating quantum pulses becomes cumbersome once several components, channels, and temporal modes are involved. Here we present QuantumInputOutput.jl, an open-source framework that automates this derivation process: first, symbolic expressions for the Hamiltonian and Lindblad operators are derived using predefined SLH rules and symbolic quantum algebra. Next, the obtained operators are converted to (time-dependent) numerical matrices or are used to obtain higher-order mean-field equations. The numerical expressions are presented in a form immediately suitable for solving the time evolution of the master equation and analyzing the output modes via correlation functions. Besides its usefulness for numerical simulations, the framework also provides a convenient tool to derive symbolic expressions for one-dimensional quantum systems such as multilevel emitters in cavities or waveguides.

Introduction

The input–output theory is a cornerstone of quantum optics [1]. It links the internal dynamics of a localized quantum system to the fields that enter and leave it. Experimentally accessible quantities, such as transmitted, reflected, or emitted radiation, thereby become computable directly from the system operators. The framework of cascaded systems shows how the output field from one open quantum system can coherently drive another, establishing a master-equation description for directional quantum networks [2, 3, 4]. This viewpoint has shaped the theory of open quantum systems, chiral light–matter interfaces [5, 6, 7], waveguide QED and quantum networks [8]. These ideas have been used to describe several systems, e.g. collective emission in cascaded many-body systems [9, 10, 11, 12, 13], giant-atom interactions [14, 15, 16], strongly interacting propagating photons [17, 18, 19, 20, 21], coherent-feedback measurement of squeezing [22], and photon–atom gate [23, 24, 25]. A particularly useful tool to build more complex input–output networks is the SLH framework, where algebraic composition rules connect components represented by a scattering matrix, Lindblad operators, and a Hamiltonian [7, 26, 27].

An important class of input–output problems for modern quantum technologies concerns propagating quantum pulses. Photons are natural carriers of quantum information because they travel over long distances with weak decoherence [28, 29]. The ability to generate, shape, scatter, interfere, detect, and analyze such photonic modes is therefore essential for quantum communication, sensing, and distributed quantum processing [30, 31, 32]. For a traveling quantum pulse, the temporal mode of a photon is part of the quantum state itself. The physically relevant object is not only an integrated photon number or a local system observable, but the quantum state distributed over one or several temporal modes of the emitted field. This description has found applications in a variety of systems, e.g. Dicke superradiance [33], information extraction from superradiant bursts [34], nonlinear splitting and merging of few-photon wave packets [35, 36], the generation of photonic states from collective atomic states [37, 38], the two-color SUPER excitation of quantum dots [39], and the relation between the Jaynes–Cummings model and traveling light pulses [40].

Several frameworks address related waveguide-QED problems from complementary perspectives. Packages such as WaveguideQED.jl [41] and QuantumMPES [42] use time-bin discretization or matrix product states to represent the propagating field explicitly. These approaches are powerful, in particular for non-Markovian feedback and spatially extended field states. However, the discretization of the continuum usually restricts them to smaller systems. The input–output theory with quantum pulses provides a finite-mode route through this problem [43, 44]. Instead of discretizing the propagating field, selected temporal wave packets are represented by virtual cavities with time-dependent couplings. A virtual cavity emits a prescribed temporal input mode, downstream virtual cavities absorb chosen output modes, and the physical system is placed between them in a cascaded master equation, see Figure 1. This construction keeps the Markovian continuum implicit while retaining a full quantum-state description of the system and the relevant pulse modes.

Input–output model with one virtual input cavity, a physical system, and two virtual output cavities

Figure 1. Input–output model with one virtual input cavity, a physical system, and two virtual output cavities. The field propagates along the cascade from left to right. The input cavity emits the mode u1(t)u_1(t), while the output cavities capture the modes v1(t)v_1(t) and v2(t)v_2(t), respectively.

Even in this finite-mode representation, deriving the effective Hamiltonian and Lindblad operators becomes laborious as components, channels, and temporal modes are added. The practical difficulty is not only algebraic: the network connectivity, the temporal modes used to represent the field, and the numerical treatment must be combined consistently. Other software packages address parts of this problem. QNET [45, 46] composes general SLH networks symbolically but does not represent quantum pulse modes. The scattering module of QuTiP [47, 48] computes the photons scattered into a waveguide by a system driven with classical pulses.

In this paper we present QuantumInputOutput.jl [49], a Julia [50] package for constructing quantum input–output networks with propagating pulse modes. It derives symbolic time-dependent Hamiltonians and Lindblad operators from user-defined SLH components and temporal pulse modes, converts them into numerical operators for master-equation simulations [51, 52], or generates higher-order mean-field equations [53]. The symbolic results can be inspected, simplified, and used directly for analytic calculations. Because the derived models have Lindblad form, they can be passed to standard numerical master-equation solvers. In addition, the package provides tools for determining and analyzing relevant temporal output modes from correlation functions, transforming models to efficient interaction pictures [54], and incorporating propagation delays [55].

The structure of this article is as follows. In Sec. II we review the virtual-cavity pulse formalism, the SLH rules used throughout the package and additional theoretical concepts of the package such as the correlation functions to determine the output modes, the interaction picture and pulse delay. In § 1.2 we describe the implementation and the basic workflow, illustrated with a simple cavity-scattering tutorial. In Sec. IV we show several examples to emphasize the most important features of the package. Many further examples are available in the GitHub repository [49] and the documentation [56].

Theoretical background

This section summarizes the theory behind the package. We begin with the input–output theory for quantum pulses, where the virtual-cavity construction represents wave packets as discrete oscillator modes [43, 44]. Then the SLH formalism [7] is introduced, which supplies algebraic rules for composing individual elements into cascaded networks. Next, we show how temporal output-mode bases follow from two-time correlation functions [43, 44]. Finally, we cover two extensions: interaction-picture transformations for efficient simulations [54], and virtual delay cavities for delayed propagation [55].

Input–output theory with quantum pulses and virtual cavities

The central goal of the input–output theory with quantum pulses [43, 44] is to describe the dynamics of a photon pulse interacting with a localized quantum system [57, 58, 59]. In such a problem one is usually interested not only in the state of the system, but also in the temporal mode and quantum state of the incoming and outgoing radiation.

We consider a local quantum system with Hamiltonian H^\hat{H} coupled to a traveling bosonic field b^in(t)\hat{b}_{\mathrm{in}}(t) through a system operator c^\hat{c} at rate κ\kappa. Under standard Markov and dispersionless-propagation assumptions [1, 4], the interaction can be written as

V^SB(t)=iκ(c^b^in†(t)−c^†b^in(t)),(1)\hat{V}_{\mathrm{SB}}(t)=\mathrm{i}\sqrt{\kappa}\left(\hat{c}\hat{b}_{\mathrm{in}}^\dagger(t)-\hat{c}^\dagger\hat{b}_{\mathrm{in}}(t)\right), \tag*{(1)}

and the outgoing field satisfies the input–output relation

b^out(t)=Sb^in(t)+L^(t),(2)\hat{b}_{\mathrm{out}}(t)=S\hat{b}_{\mathrm{in}}(t)+\hat{L}(t), \tag*{(2)}

where the coupling operator L^\hat{L} is the field radiated by the system and the scattering matrix SS routes the incoming field directly into the outgoing one. For the single system considered here, L^=κc^\hat{L}=\sqrt{\kappa}\hat{c} and there is no direct scattering, S=1S=1, so that b^out(t)=b^in(t)+κc^(t)\hat{b}_{\mathrm{out}}(t)=\hat{b}_{\mathrm{in}}(t)+\sqrt{\kappa}\hat{c}(t). Together with the system Hamiltonian H^\hat{H}, these form the triple (S,L^,H^)(S,\hat{L},\hat{H}) that the SLH formalism of the QIB package composes into networks. The fields b^in(t)\hat{b}_{\mathrm{in}}(t) and b^out(t)\hat{b}_{\mathrm{out}}(t) carry one bosonic mode per time instant and thus span a continuum. A quantum pulse is a wave packet built from this continuum, its shape fixed by a normalized temporal mode u(t)u(t) with ∫dt ∣u(t)∣2=1\int\mathrm{d}t\,|u(t)|^2=1. This mode collects the continuum operators into a single bosonic mode, with creation operator

b^u†=∫dt u(t)b^†(t).(3)\hat{b}_u^\dagger=\int\mathrm{d}t\,u(t)\hat{b}^\dagger(t). \tag*{(3)}

Even for a single incident mode, the interaction typically scatters the pulse into many outgoing modes, so the output field is spread over many modes. The aim is therefore to describe the full system–field dynamics in a tractable way, without explicitly discretizing the entire continuum.

The key idea is to replace the selected traveling input and output pulses by virtual cavities and to place the physical system between them, forming a cascade, a directional chain in which the output field of one element drives the input of the next with no back-action from the elements downstream [2, 3]. This network is sketched in Figure 1, with one input cavity and two output cavities surrounding the physical system. Because the coupling runs in one direction only, the ordering of the elements along the chain is physically meaningful. Throughout this article, ui(t)u_i(t) denotes an input temporal mode and vi(t)v_i(t) an output temporal mode; the corresponding virtual-cavity annihilation operators are a^ui\hat{a}_{u_i} and a^vi\hat{a}_{v_i}, respectively. Each virtual cavity is a discrete oscillator mode coupled to the continuum with a time-dependent, generally complex coupling determined by the desired temporal mode. For a normalized input mode u(t)u(t), the coupling is [43, 44]

gu(t)=u∗(t)1−∫0tdt′∣u(t′)∣2.(4)g_u(t) = \frac{u^*(t)}{\sqrt{1-\int_0^t \mathrm{d}t' \lvert u(t')\rvert^2}}. \tag*{(4)}

The coupling emits the initial intracavity state into the traveling mode u(t)u(t). Conversely, for a chosen output mode v(t)v(t), the coupling is [43, 44]

gv(t)=−v∗(t)∫0tdt′∣v(t′)∣2.(5)g_v(t) = -\frac{v^*(t)}{\sqrt{\int_0^t \mathrm{d}t' \lvert v(t')\rvert^2}}. \tag*{(5)}

This coupling absorbs the mode into a virtual output cavity. These expressions make it possible to treat selected input and output pulses as single oscillator modes in a cascaded network. The couplings gu(t)g_u(t) and gv(t)g_v(t) can be intuitively understood by noting that the squared denominators in Eq. (4) and Eq. (5) give the fractions of the pulse residing inside the emitting and absorbing virtual cavities, respectively [55]. The numerators specify the desired temporal envelopes, while the denominators account for the instantaneous intracavity photon populations during emission and absorption.

For multiple input or output modes, the presence of the other virtual cavities distorts the mode seen by a given cavity, which needs to be taken into account [43, 44]. One therefore first constructs effective modes uieff(t)u_i^{\mathrm{eff}}(t) and vieff(t)v_i^{\mathrm{eff}}(t). For input modes, the recursive construction for j<ij<i is

α˙ui(j)(t)=−guj(t)ui(j−1)(t)+12∣guj(t)∣2αui(j)(t),(6)\dot{\alpha}_{u_i}^{(j)}(t)=-g_{u_j}(t)u_i^{(j-1)}(t)+\frac{1}{2}\lvert g_{u_j}(t)\rvert^2\alpha_{u_i}^{(j)}(t), \tag*{(6)}
ui(j)(t)=ui(j−1)(t)−guj∗(t)αui(j)(t).(7)u_i^{(j)}(t)=u_i^{(j-1)}(t)-g_{u_j}^*(t)\alpha_{u_i}^{(j)}(t). \tag*{(7)}

For output modes, the corresponding recursion is

α˙vi(j)(t)=−gvj(t)vi(j−1)(t)−12∣gvj(t)∣2αvi(j)(t),(8)\dot{\alpha}_{v_i}^{(j)}(t)=-g_{v_j}(t)v_i^{(j-1)}(t)-\frac{1}{2}\lvert g_{v_j}(t)\rvert^2\alpha_{v_i}^{(j)}(t), \tag*{(8)}
vi(j)(t)=vi(j−1)(t)+gvj∗(t)αvi(j)(t).(9)v_i^{(j)}(t)=v_i^{(j-1)}(t)+g_{v_j}^*(t)\alpha_{v_i}^{(j)}(t). \tag*{(9)}

With ui(0)(t)=ui(t)u_i^{(0)}(t)=u_i(t), vi(0)(t)=vi(t)v_i^{(0)}(t)=v_i(t), and αui(j)(0)=αvi(j)(0)=0\alpha_{u_i}^{(j)}(0)=\alpha_{v_i}^{(j)}(0)=0, the effective modes are uieff(t)=ui(i−1)(t)u_i^{\mathrm{eff}}(t)=u_i^{(i-1)}(t) and vieff(t)=vi(i−1)(t)v_i^{\mathrm{eff}}(t)=v_i^{(i-1)}(t). The corresponding couplings follow from the single-mode expressions,

guieff(t)=(uieff(t))∗1−∫0tdt′∣uieff(t′)∣2,(10)g_{u_i}^{\mathrm{eff}}(t)=\frac{\left(u_i^{\mathrm{eff}}(t)\right)^*}{\sqrt{1-\int_0^t \mathrm{d}t' \lvert u_i^{\mathrm{eff}}(t')\rvert^2}}, \tag*{(10)}
gvieff(t)=−(vieff(t))∗∫0tdt′∣vieff(t′)∣2.(11)g_{v_i}^{\mathrm{eff}}(t)=-\frac{\left(v_i^{\mathrm{eff}}(t)\right)^*}{\sqrt{\int_0^t \mathrm{d}t' \lvert v_i^{\mathrm{eff}}(t')\rvert^2}}. \tag*{(11)}

This recursive construction gives the effective temporal modes that determine the virtual-cavity couplings in a multimode description. We note that the dynamics of the effective couplings can be precalculated independently of the system dynamics.

SLH networks for cascaded pulses

The virtual-cavity construction of the previous subsection turns the pulse problem into a small collection of open components: input cavities that emit the incident modes, the physical system, and one output cavity per captured mode. These components form a cascade, but the dynamics follow from the master equation of the full chain, not of each part on its own. Deriving it by hand is tedious and must be redone for every new arrangement of components. The SLH formalism [7, 27] removes this bookkeeping: each open component is encoded in a triple G=(S,L^,H)G=(S,\hat{L},H), and a few algebraic rules combine these building blocks into a single triple for the whole network, which maps directly onto a Lindblad master equation.

The input–output relation Eq. (2) already introduced these objects for a single system, with coupling operator

L^=κc^\hat{L} = \sqrt{\kappa}\hat{c} and scattering matrix S=1S = 1. An SLH component generalizes them to several ports, or field channels: the coupling vector L^=(L^1,…,L^n)T\hat{L} = (\hat{L}_1,\ldots,\hat{L}_n)^{\mathsf{T}} carries one jump operator L^j\hat{L}_j per port, the scattering matrix SS becomes an n×nn \times n unitary that routes the incoming fields directly to the outgoing ports, and H^\hat{H} is its internal Hamiltonian. Given a triple, the state ρ\rho evolves under the Lindblad master equation

ρ˙=−i[H^,ρ]+∑j(L^jρL^j†−12{L^j†L^j,ρ})(12)\dot{\rho} = -i[\hat{H},\rho] + \sum_j \left(\hat{L}_j\rho\hat{L}_j^\dagger- \frac{1}{2}\{\hat{L}_j^\dagger\hat{L}_j,\rho\}\right) \tag*{(12)}

set entirely by H^\hat{H} and L^\hat{L}. The scattering matrix SS does not enter here; it fixes how the fields scatter between ports through the input–output relation Eq. (2), and how components combine into a network. A component that only emits or absorbs keeps S=1S = 1: a one-sided cavity with decay rate κ\kappa, detuning Δ\Delta, and mode operator c^\hat{c} has the SLH triple (1,κc^,−Δc^†c^)(1,\sqrt{\kappa}\hat{c},-\Delta\hat{c}^{\dagger}\hat{c}), while an input cavity emitting the mode u(t)u(t) is (1,gu∗(t)a^u,0)(1,g_u^*(t)\hat{a}_u,0) with its coupling set by the time-dependent gu(t)g_u(t) of Eq. (4). In Appendix § 1.1.1, we provide a list of common SLH elements, see also the appendix of Ref. [7]. Throughout, we denote the cavity decay rate by κ\kappa and that of an emitter by γ\gamma.

Three composition rules, illustrated in Figure 2, assemble these components into a network. The cascade product G1▹G2G_1 \triangleright G_2 connects the output of G1G_1 to the input of G2G_2 and gives the combined triple

Figure 2. SLH composition rules. Cascade (G1▹G2G_1\triangleright G_2) feeds output into input; concatenate (G1⊞G2G_1\boxplus G_2) stacks components without interaction; feedback reduction ([(G)]x→y[(G)]_{x\to y}) closes a loop from output xx to input yy. The feedback panel is the bidirectional waveguide of Sec. IV B (Code sample 11): input coupler GinG_{\mathrm{in}}, emitters G1G_1, G2G_2, and propagation phase GϕG_{\phi}. The numbers label the ports of the concatenated network Gin⊞G1⊞G2⊞GϕG_{\mathrm{in}}\boxplus G_1\boxplus G_2\boxplus G_{\phi}, each marking both the input and the output of that port. Red and orange lines mark the right- and left-moving channels.

G1▹G2=(S2S1,L^2+S2L^1,H^1+H^2+12i(L^2†S2L^1−L^1†S2†L^2))(13)G_1 \triangleright G_2 = \left(S_2S_1,\hat{L}_2 + S_2\hat{L}_1,\hat{H}_1+\hat{H}_2+\frac{1}{2i}(\hat{L}_2^\dagger S_2\hat{L}_1-\hat{L}_1^\dagger S_2^\dagger\hat{L}_2)\right) \tag*{(13)}

Note that we use the convention of cascading elements from left to right, G1▹G2G_1 \triangleright G_2, which differs from the convention in Ref. [7], where G2◃G1G_2 \triangleleft G_1 is used. Next, the concatenation product G1⊞G2G_1 \boxplus G_2 stacks channels side by side without interaction,

G1⊞G2=([S100S2],[L^1L^2],H^1+H^2).(14)G_1 \boxplus G_2 = \left(\begin{bmatrix} S_1 & 0 \\ 0 & S_2 \end{bmatrix},\begin{bmatrix} \hat{L}_1 \\ \hat{L}_2 \end{bmatrix},\hat{H}_1+\hat{H}_2\right). \tag*{(14)}

A third rule, feedback reduction, connects output port xx back into input port yy of an nn-port component. The reduced (n−1)(n-1)-port model [(G)]x→y=(S~,L~,H~)[(G)]_{x\to y} = (\tilde{S},\tilde{L},\tilde{H}) is

S~=Sxˉ,yˉ+Sxˉ,y(1−Sx,y)−1Sx,yˉ,(15)\tilde{S} = S_{\bar{x},\bar{y}} + S_{\bar{x},y}(1-S_{x,y})^{-1}S_{x,\bar{y}}, \tag*{(15)}
L~=L^xˉ+Sxˉ,y(1−Sx,y)−1L^x,(16)\tilde{L} = \hat{L}_{\bar{x}} + S_{\bar{x},y}(1-S_{x,y})^{-1}\hat{L}_x, \tag*{(16)}
H~=H^−i2[(∑j=1nL^j†Sj,y)(1−Sx,y)−1L^x−h.c.].(17)\tilde{H} = \hat{H} - \frac{i}{2}\left[\left(\sum_{j=1}^{n}\hat{L}_j^\dagger S_{j,y}\right)(1-S_{x,y})^{-1}\hat{L}_x-\mathrm{h.c.}\right]. \tag*{(17)}

Here xˉ\bar{x} and yˉ\bar{y} denote the remaining output and input ports after removing xx and yy. This rule closes internal loops in an SLH network and is used whenever it contains a direct coherent feedback path. The feedback reduction in combination with the concatenation rule is sufficient to describe any SLH network. However, in many cases the cascade product is simpler and more efficient to implement.

By modeling input and output pulses as virtual cavities and cascading them with the physical system, we obtain an effective SLH triple for the full pulse–interaction problem. Its Hamiltonian H^\hat{H} and coupling operators L^\hat{L} then determine the dynamics of the joint state of the system and the auxiliary pulse modes through Eq. (12), which can be solved with standard Lindblad solvers [47, 51, 52, 60].

Output modes and the correlation function

Solving Eq. (12) yields the joint state of the system and the pulse modes, but in many cases the quantity of interest is the emitted field. It is generally spread across a continuum of temporal modes, so before it can be captured by a finite set of output cavities we must identify which ones it occupies. These modes are singled out by the first-order correlation function

g(1)(t1,t2)=⟨L^s†(t1)L^s(t2)⟩,(18)g^{(1)}(t_1,t_2) = \langle\hat{L}_s^\dagger(t_1)\hat{L}_s(t_2)\rangle, \tag*{(18)}

obtained from the master-equation solution through the quantum regression theorem. Here L^s\hat{L}_s is the coupling operator of the source, obtained by cascading the input cavity with the system and evaluated without the output cavities. For a one-sided cavity with annihilation operator c^\hat{c} and decay rate κ\kappa driven by a pulse u(t)u(t), this gives L^s(t)=gu∗(t)a^u+κc^\hat{L}_s(t) = g_u^*(t)\hat{a}_u + \sqrt{\kappa}\hat{c}: the system term κc^\sqrt{\kappa}\hat{c} plus the input-cavity term gu∗(t)a^ug_u^*(t)\hat{a}_u added by the cascade.

Diagonalizing the correlation function,

g(1)(t1,t2)=∑inivi∗(t1)vi(t2),(19)g^{(1)}(t_1,t_2) = \sum_i n_i v_i^*(t_1)v_i(t_2), \tag*{(19)}

yields an orthonormal set of temporal modes vi(t)v_i(t) ranked by their mean occupation nin_i.

For many applications, the few most populated modes may contain the quantum states of our primary interest, and are hence the modes the output cavities are set to absorb, with couplings built from the vi(t)v_i(t) through Eq. (5). This gives the working recipe used throughout the examples: a first propagation without output cavities provides g(1)g^{(1)} and its modes, and a second propagation, with cavities tuned to the leading vi(t)v_i(t), turns the output field into explicit quantum degrees of freedom (see § 1.2).

Interaction picture for traveling pulses

For pulse-scattering problems, especially with large photon numbers, it is often advantageous to transform to an interaction picture that treats the pure mode-transfer dynamics analytically between the input and output modes [54]. To this end, one splits the Hamiltonian into the system part and a coupling part that only exchanges excitations between upstream and downstream virtual modes. For the two-mode case this mode-transfer Hamiltonian is

H^uv(t)=i2[gu(t)gv∗(t)a^u†a^v−gv(t)gu∗(t)a^v†a^u].(20)\hat{H}_{uv}(t)=\frac{i}{2}\left[g_u(t)g_v^*(t)\hat{a}_u^\dagger\hat{a}_v-g_v(t)g_u^*(t)\hat{a}_v^\dagger\hat{a}_u\right]. \tag*{(20)}

The transformation acts only on the field-mode operators,

\begin{pmatrix}\hat{a}_u(t)\\\hat{a}_v(t)\end{pmatrix}=M(t)\begin{pmatrix}\hat{a}_u(0)\\\hat{a}_v(0)\end{pmatrix}, \tag*{(21)}\end{pmatrix}

and the coefficient matrix solves

ddtM(t)=A(t)M(t),(22)\frac{d}{dt}M(t)=A(t)M(t), \tag*{(22)}
A(t)=12(0gu(t)gv∗(t)−gu∗(t)gv(t)0),(23)A(t)=\frac{1}{2}\begin{pmatrix}0 & g_u(t)g_v^*(t)\\-g_u^*(t)g_v(t) & 0\end{pmatrix}, \tag*{(23)}

with M(0)=IM(0)=I. The generator A(t)A(t) is the one induced by the mode-transfer Hamiltonian H^uv\hat{H}_{uv}. In this picture, H^uv\hat{H}_{uv} is subtracted before the transformed mode operators are substituted into the remaining Hamiltonian. The same substitution transforms the Lindblad coupling operators. When the scatterer exchanges only a limited number of excitations with the transformed modes, their occupations remain within narrow Fock-state bands, allowing smaller Hilbert-space truncations.

For NN cascaded modes the interaction-picture transformation is generated by the matrix

A(t)=12(0g1g2∗⋯g1gN∗−g1∗g20⋱⋮⋮⋱0gN−1gN∗−g1∗gN⋯−gN−1∗gN0),(24)A(t)=\frac{1}{2}\begin{pmatrix} 0 & g_1g_2^* & \cdots& g_1g_N^*\\ -g_1^*g_2 & 0 & \ddots& \vdots\\ \vdots& \ddots& 0 & g_{N-1}g_N^*\\ -g_1^*g_N & \cdots& -g_{N-1}^*g_N & 0 \end{pmatrix}, \tag*{(24)}

which corresponds to the interaction Hamiltonian obtained from G1▹⋯▹GNG_1\triangleright\cdots\triangleright G_N, where Gi=(1,gi∗a^i,0)G_i=(1,g_i^*\hat{a}_i,0).

Pulse delay

Propagation delays must be accounted for when pulses traverse paths of different lengths, as in interferometric networks, where only the relative delay between paths is physically relevant. Resolving such a delay directly would require discretizing the field along its propagation direction, that is, the full continuum. Instead, a single virtual delay cavity captures the pulse and re-emits it later, adding the delay with one extra mode [55].

When the delay is long, the capture and emission windows do not overlap: the delay cavity first absorbs the incoming pulse v(t)v(t) through an absorbing coupling as in Eq. (5), then releases it as u(t)u(t) through an emitting coupling as in Eq. (4). When the delay is short, the two windows overlap, and the delay cavity absorbs and emits at the same time. We therefore model it as a two-sided cavity: the pulse v(t)v(t) enters through an input mirror, while the delayed pulse u(t)u(t) leaves through a separate output mirror. The two mirrors have the time-dependent couplings

g~out,u,v(t)=u∗(t)∫0tdt′∣v(t′)∣2−∫0tdt′∣u(t′)∣2,(25)\tilde{g}_{\mathrm{out},u,v}(t)=\frac{u^*(t)}{\sqrt{\int_0^t dt'\lvert v(t')\rvert^2-\int_0^t dt'\lvert u(t')\rvert^2}}, \tag*{(25)}
g~in,v,u(t)=−v∗(t)∫0tdt′∣v(t′)∣2−∫0tdt′∣u(t′)∣2,(26)\tilde{g}_{\mathrm{in},v,u}(t)=-\frac{v^*(t)}{\sqrt{\int_0^t dt'\lvert v(t')\rvert^2-\int_0^t dt'\lvert u(t')\rvert^2}}, \tag*{(26)}

for the output and input mirrors, respectively. The shared denominator, the captured norm minus the released norm, is the fraction of the pulse stored in the cavity at time tt. Interferometric settings then follow by placing one delay cavity per path and tuning the relative delays.

Framework and implementation

The central object is the SLH struct, representing the triple (S,L^,H^)(S,\hat{L},\hat{H}). It supports the network operations cascade (▹\triangleright) [Eq. (13)], concatenate (⊞\boxplus) [Eq. (14)], and feedback [Eqs. (15)–(17)], introduced in § 1.2 B and illustrated in Figure 2. The entries of an SLH object may be symbolic expressions, numerical operators, or operator-valued functions, so the same composition rules are used in both workflows. From a composite SLH object, the effective operators are extracted with the functions hamiltonian, jump_operator, and scattering.

In the symbolic workflow, the SLH rules produce symbolic Hamiltonian and Lindblad coupling operators. These expressions can then be represented numerically for a full master-equation simulation with QuantumOptics.jl [51], or used directly to derive higher-order mean-field equations for operator averages with QuantumCumulants.jl [53]. The symbolic expressions can also be inspected, simplified, or further manipulated before a numerical representation is chosen. Alternatively, numerical functions and operators can be provided directly, bypassing the symbolic derivation, as demonstrated for the Λ\Lambda-emitter in Code sample 9 of Sec. IV A.

The five stages of this workflow are summarized in Figure 3. Stages 1 and 2 define the symbolic operators and compose the SLH network. Stage 3 maps the resulting operators to a numerical representation or derives cumulant equations. Stage 4 solves the dynamics and identifies the relevant output modes. Stage 5 repeats the propagation with virtual cavities that capture these modes. The symbolic translation in stage 3 can instead be bypassed by defining the SLH components with numerical operators from the outset.

Workflow sketch for QuantumInputOutput.jl

Figure 3. Workflow sketch for QuantumInputOutput.jl. The symbolic operators are defined to build an SLH network before translating them to numeric operators or deriving higher-order mean-field equations. The resulting Hamiltonian and Lindblad operators are then used to simulate the dynamics and determine the output modes. Finally, the full dynamics with output cavities are solved. The translation can be avoided by directly defining the numeric operators.

In the following, we illustrate the main concept in more detail using a simple cavity-scattering example. A virtual cavity emits a single input pulse, which is scattered by a one-sided cavity and recaptured by a virtual output cavity [43]. First, we solve the dynamics of the input pulse and the system to extract the dominant outgoing temporal mode from the two-time correlation function. We then represent this mode explicitly by an output cavity with coupling gv(t)g_{\mathrm{v}}(t). This two-stage procedure is typical of the virtual-cavity formalism for analyzing output modes.

For this tutorial, we use the symbolic route provided by SecondQuantizedAlgebra.jl, which defines noncommuting operators and symbolic parameters and manipulates the resulting expressions. In Code sample 1 we construct three bosonic modes on separate FockSpace factors: the virtual input-cavity mode a^u\hat{a}_{\mathrm{u}}, the physical system-cavity mode c^\hat{c}, and the virtual output-cavity mode a^v\hat{a}_{\mathrm{v}}. We encode these components as SLH elements and cascade them to derive the symbolic Hamiltonian and Lindblad coupling operator of the complete pulse-scattering model. The same procedure generalizes directly to larger networks: one combines local elements with cascade and concatenation rules, or applies feedback reduction when internal loops are present.

using QuantumInputOutput
using SecondQuantizedAlgebra

# Hilbert space
hu = FockSpace(:u)
hs = FockSpace(:s)
hv = FockSpace(:v)
h = hu ⊗ hs ⊗ hv

# symbolic operators
au = Destroy(h, :au, 1)
c = Destroy(h, :c, 2)
av = Destroy(h, :av, 3)
# symbolic parameters
@variables gu::Number gv::Number Δ::Real κ::Real

# SLH elements
Gu = SLH(1, gu'*au, 0)
Gs = SLH(1, √κ*c, -Δ*c'*c)
Gv = SLH(1, gv'*av, 0)

# cascade network
G = Gu ▷ Gs ▷ Gv
H = hamiltonian(G)
L = jump_operator(G)[1]

Code sample 1. Defining the symbolic operators and parameters for the SLH construction of a single input mode, one cavity, and one output mode.

The above code sample creates the symbolic expressions

H^=−Δc^†c^+i2[κgua^u†c^+gugv∗a^v†a^u+κgv∗c^†a^v]+h.c.,\hat{H}=-\Delta\hat{c}^{\dagger}\hat{c}+\frac{i}{2}\left[\sqrt{\kappa}g_{\mathrm{u}}\hat{a}_{\mathrm{u}}^{\dagger}\hat{c}+g_{\mathrm{u}}g_{\mathrm{v}}^{*}\hat{a}_{\mathrm{v}}^{\dagger}\hat{a}_{\mathrm{u}}+\sqrt{\kappa}g_{\mathrm{v}}^{*}\hat{c}^{\dagger}\hat{a}_{\mathrm{v}}\right]+\mathrm{h.c.},
L^=gu∗a^u+κc^+gv∗a^v.(27)\hat{L}=g_{\mathrm{u}}^{*}\hat{a}_{\mathrm{u}}+\sqrt{\kappa}\hat{c}+g_{\mathrm{v}}^{*}\hat{a}_{\mathrm{v}}. \tag*{(27)}

The three interaction terms in H^\hat{H} are generated by the successive cascade products and describe the directional couplings from the input cavity to the system, from the input cavity to the output cavity, and from the system to the output cavity. The coupling operator L^\hat{L} collects the amplitudes with which the three components couple to the shared traveling field. Because the network has one field channel, it produces one Lindblad coupling operator.

We now use to_numeric to represent the symbolic Hamiltonian and coupling operator on a QuantumOptics.jl basis. The parameter dictionary supplies constant values, whereas time_parameter supplies functions of time. Since the input coupling gu(t)g_{\mathrm{u}}(t) is time dependent, the translated Hamiltonian and coupling operator are callable objects that are evaluated at the current time by the solver callback.

The network contains a single excitation, so a FockBasis with a cutoff of one is sufficient for each of the three modes. For the first propagation, we place gv=0g_{\mathrm{v}}=0 in the constant-parameter dictionary so that the output cavity remains in the numerical Hilbert space but is dynamically decoupled. The function coupling_input constructs gu(t)g_{\mathrm{u}}(t) from the Gaussian input mode according to Eq. (4).

using QuantumOptics

# numeric basis
bu = FockBasis(1)
bs = FockBasis(1)
bv = FockBasis(1)
b = bu ⊗ bs ⊗ bv

# input coupling
T = [0.0:0.002:12.0;]
u(t) = 1/√π*(1/4)exp(-0.5*(t - 4)^2)
gu_0 = coupling_input(u, T)

# constant and time-dependent parameters
parameter = Dict(κ => 1.0, Δ => 0.0, gv => 0.0)
time_parameter = Dict(gᵤ => gᵤ-qo)

# numeric time-dependent H and jump operator
H_qo = to_numeric(H, b; parameter, time_parameter)
L_qo = to_numeric(L, b; parameter, time_parameter)

Code sample 2. Translation to numerical operators with a time-dependent Gaussian input coupling.

The time-dependent operators returned by to_numeric can now be used with the QuantumOptics.jl function timeevolution.master_dynamic. At each integration step, the solver calls fio(t,ρ)f_{\mathrm{io}}(t,\rho), which evaluates the translated Hamiltonian and coupling operators and returns the Hamiltonian, the vector of Lindblad coupling operators, and their adjoints. In Code sample 3 we use this callback to propagate the single-photon pulse.

# input-output function
function f_io(t, ρ)
    Ht = H_qo(t)
    Lt = [L_qo(t)]
    return Ht, Lt, dagger.(Lt)
end

# initial state
ψ₀ =
    fockstate(bᵤ, 1) ⊗ fockstate(bₛ, 0) ⊗ fockstate(bᵥ, 0)

# time evolution
t, ρt = timeevolution.master_dynamic(T, ψ₀, f_io)

Code sample 3. Solving the time-dependent master equation for the cavity-scattering example.

The source coupling operator L^s(t)=gu∗(t)a^u+κ c^\hat{L}_{s}(t) = g_{u}^{*}(t)\hat{a}_{u} + \sqrt{\kappa}\,\hat{c} of Eq. (18) describes the field emitted by the input and system cavities. The function correlation_matrix uses this operator and the trajectory ρ(t)\rho(t) to construct the first-order correlation matrix shown in Figure 4(a).

Figure 4. Empty cavity scattering. Panel (a) shows the two-time correlation function of the emitted field. Its dominant eigenvector defines the temporal output mode used in the second propagation step. Panel (b) shows the temporal input and output modes with their virtual-cavity couplings (dashed), and (c) depicts the dynamics of the occupations of the input cavity, system cavity, and captured output mode.

Diagonalizing the time-grid-discretized matrix g(1)(t1,t2)g^{(1)}(t_{1},t_{2}) yields the orthogonal output modes and their occupations. The dominant eigenvector defines the mode function v(t)v(t), from which coupling_output constructs the absorption coupling gv(t)g_{v}(t) according to Eq. (5), as shown in Code sample 4. The eigenvalues and corresponding eigenvectors are sorted in ascending order.

using LinearAlgebra

# two-time correlation function
Lₛ(t) = dense(static_operator(L_qo(t)))
g⁽¹⁾ = correlation_matrix(T, ρt, f_io, Lₛ)

# diagonalize the correlation function
F = eigen(g⁽¹⁾)
ΔT = T[2] - T[1]

# eigenvectors (temporal modes)
v_mode = F.vectors[:, end] / √ΔT
# corresponding mean photon occupation
n_mode = real(F.values[end]) * ΔT

Code sample 4. Extracting the dominant temporal output mode from the two-time correlation matrix.

In the simple linear scattering of an empty cavity, all population ends up in a single dominant mode. Retranslating the same symbolic Hamiltonian and Lindblad term with both gu(t)g_{u}(t) and gv(t)g_{v}(t) then produces the full effective model in which the output mode is an explicit quantum degree of freedom. This second propagation step is shown in Code sample 5.

# coupling of the output mode
gᵥ-qo = coupling_output(v_mode, T)

# translate again, with input and output coupling
parameter = Dict(r => 1.0, Δ => 0.0)
time_parameter = Dict(gᵤ => gᵤ-qo, gᵥ => gᵥ-qo)
H_qo = to_numeric(H, b; parameter, time_parameter)
L_qo = to_numeric(L, b; parameter, time_parameter)

# f_io reads the reassigned operators
t, ρt = timeevolution.master_dynamic(T, ψ0, f_io)

# numeric operators and expectation values
au_qo = to_numeric(au, b)
c_qo = to_numeric(c, b)
av_qo = to_numeric(av, b)

nu = real.(expect(au_qo'*au_qo, ρt))
ns = real.(expect(c_qo'*c_qo, ρt))
nv = real.(expect(av_qo'*av_qo, ρt))

Code sample 5. Time evolution with the output mode.

In Figure 4(b) we plot the temporal input and output modes together with their corresponding couplings. Figure 4(c) shows their excitations calculated in the preceding code sample, see also Ref. [43]. We can see that the virtual output cavity captures the dominant temporal mode identified from the correlation matrix.

Examples

The above tutorial demonstrated the main workflow of the package. In the following, we show several examples that emphasize additional features of the package. In particular, Sec. IV A covers multilevel systems, multiple captured output modes, user-defined operator translations via the operators keyword, and a fully numerical workflow without symbolic derivation. Section IV B demonstrates bidirectional channels, the concatenate and feedback rules, and coherent driving with a time-dependent pulse envelope. Finally, Sec. IV C shows the interaction-picture treatment for highly occupied quantum pulses and a cumulant-expansion approach.

Photon number and emitter–mode entanglement with a Lambda emitter

As a first example, we consider the decay of a three-level Λ\Lambda emitter through a cavity into two dominant temporal output modes [44]. The emitted field is multimode. We determine the dominant modes from the first-order correlation function and retain the two most populated ones as explicit output cavities. This gives direct access to correlations and entanglement between the emitter and the selected propagating modes.

The symbolic model consists of one cavity mode, one three-level atom, and two cascaded virtual output cavities. There is no input cavity, because the emitter begins in ∣e⟩\lvert e\rangle and the physical cavity in vacuum. Levels 1, 2, and 3 represent ∣g1⟩\lvert g_1\rangle, ∣g2⟩\lvert g_2\rangle, and ∣e⟩\lvert e\rangle, respectively. Here the transitions ∣g1⟩↔∣e⟩\lvert g_1\rangle\leftrightarrow\lvert e\rangle and ∣g2⟩↔∣e⟩\lvert g_2\rangle\leftrightarrow\lvert e\rangle are both coupled to the cavity with strength gg, while the second ground state is shifted by ω12\omega_{12}. The two virtual cavities later absorb the two dominant temporal output modes. All components couple to the same traveling field channel.

In Code sample 6 we define the symbolic operators and parameters and derive the Hamiltonian and Lindblad operator.

using QuantumInputOutput
using SecondQuantizedAlgebra

# symbolic Hilbert space
hc = FockSpace(:c)
ha = NLevelSpace(:atom, 3)
hv1 = FockSpace(:v1)
hv2 = FockSpace(:v2)
h = hc ⊗ ha ⊗ hv1 ⊗ hv2

# symbolic operators
c = Destroy(h, :c, 1)
σ(i, j) = Transition(h, :σ, i, j, 2)
av₁ = Destroy(h, :av₁, 3)
av₂ = Destroy(h, :av₂, 4)

# symbolic parameters
@variables κ::Real g::Real ω₁₂::Real
@variables gv1::Number gv2::Number

# Hamiltonian and SLH elements
Hₛ =
    g*(c'*σ(1, 3) + c*σ(3, 1) + c'*σ(2, 3) + c*σ(3, 2)) +
    ω₁₂*σ(2, 2)
Gₛ = SLH(1, √κ*c, Hₛ)
Gᵥ₁ = SLH(1, gv1'*av₁, 0)
Gᵥ₂ = SLH(1, gv2'*av₂, 0)

# SLH network
G = cascade(Gₛ, Gᵥ₁, Gᵥ₂)
H = hamiltonian(G)
L = jump_operator(G)[1]

Code sample 6. Symbolic SLH model for a three-level emitter coupled to a cavity with two output modes.

We first determine the two dominant output modes from the emitter–cavity trajectory. Since the output cavities are downstream, they cannot affect the upstream emitter–cavity dynamics. We therefore omit them from the first propagation and retain only the physical cavity and the emitter. The operators dictionary maps the symbolic system operators onto this reduced numerical basis. The resulting Hamiltonian and coupling operator are time independent and are propagated with timeevolution.master. Diagonalizing the first-order correlation matrix then yields the temporal modes and their mean occupations. Since only the two most populated modes are needed, we compute only the five dominant eigenvectors, rather than the full spectrum.

using QuantumOptics

# numerical parameters
κ_qo = 1.0
g_qo = 0.1*κ_qo
ω₁₂_qo = 0.5*κ_qo
T = 0:0.005:1 .* 100/κ_qo
ΔT = T[2] - T[1]

# system basis: cavity and three-level atom
bc = FockBasis(1)
ba = NLevelBasis(3)
bs = bc ⊗ ba
# full basis
bᵥ₁ = FockBasis(1)
bᵥ₂ = FockBasis(1)
b = bₛ ⊗ bᵥ₁ ⊗ bᵥ₂

# operators on the system basis
cₛ = destroy(b꜀) ⊗ one(bₐ)
σₛ(i, j) = one(b꜀) ⊗ transition(bₐ, i, j)

# parameter and operator dictionaries
parameter = Dict(κ => κ_qo, g => g_qo,
ω₁₂ => ω₁₂_qo, gᵥ₁ => 0.0, gᵥ₂ => 0.0)
operators = Dict(c => cₛ, σ(1, 3) => σₛ(1, 3),
σ(2, 3) => σₛ(2, 3), σ(2, 2) => σₛ(2, 2))

# numeric (static) operators on the system basis
Hₛ_qo = to_numeric(Hₛ, bₛ; parameter, operators)
Lₛ_qo = to_numeric(
κ*c, bₛ; parameter, operators)

# system time evolution
ψ₀ₛ = fockstate(b꜀, 0) ⊗ nlevelstate(bₐ, 3)
t₁, ρₜ₁ = timeevolution.master(T, ψ₀ₛ, Hₛ_qo, [Lₛ_qo])

# correlation function and output modes
g⁽¹⁾ = correlation_matrix(T, ρₜ₁, Hₛ_qo, [Lₛ_qo], Lₛ_qo)
n = size(g⁽¹⁾, 1)
F = eigen(g⁽¹⁾, (n - 4):n)
n_avg = real.(F.values) * ΔT
v₁_mode = F.vectors[:, end] / √ΔT
v₂_mode = F.vectors[:, end-1] / √ΔT
n₁ = n_avg[end]
n₂ = n_avg[end-1]

Code sample 7. System time evolution with a reduced numerical Hilbert space using the operators dictionary to determine the output modes.

For serial capture, the first absorbing cavity modifies the field seen by the second. The function effective_output_mode therefore transforms v2(t)v_2(t) into an effective mode that compensates for this distortion. We then complete the example in the same way as in the tutorial: retranslate the full symbolic Hamiltonian and Lindblad operator with both output couplings included, and solve the second propagation step with the two explicit output modes:

# output coupling for two modes
gᵥ₁_qo = coupling_output(v₁_mode, T)
v₂_eff = effective_output_mode([v₁_mode, v₂_mode], T, 2)
gᵥ₂_qo = coupling_output(v₂_eff, T)

parameter = Dict(κ => κ_qo, g => g_qo, ω₁₂ => ω₁₂_qo)
time_parameter = Dict(gᵥ₁ => gᵥ₁_qo, gᵥ₂ => gᵥ₂_qo)

# full Hamiltonian and jump operator, now on b
H_qo = to_numeric(H, b; parameter, time_parameter)
L_qo = to_numeric(L, b; parameter, time_parameter)

function f_io(t, ρ)
    Lₜ = [L_qo(t)]
    return H_qo(t), Lₜ, dagger.(Lₜ)
end

# initial state and time evolution
ψ₀ = ψ₀ₛ ⊗ fockstate(bᵥ₁, 0) ⊗ fockstate(bᵥ₂, 0)
t₂, ρₜ₂ = timeevolution.master_dynamic(T, ψ₀, f_io)

# expectation values
c_qo = to_numeric(c, b)
σ_qo(i, j) = to_numeric(σ(i, j), b)
av₁_qo = to_numeric(av₁, b)
av₂_qo = to_numeric(av₂, b)

Pₑ = real.(expect(σ_qo(3, 3), ρₜ₂))
n꜀ = real.(expect(c_qo'*c_qo, ρₜ₂))
n₁ₜ = real.(expect(av₁_qo'*av₁_qo, ρₜ₂))
n₂ₜ = real.(expect(av₂_qo'*av₂_qo, ρₜ₂))

# emitter--mode entanglement at the final time
ρ_atom_modes = ptrace(ρₜ₂[end], 1)
N_at_modes = negativity(ρ_atom_modes, 1)

Code sample 8. Time evolution including the output cavities with the standard symbolic-to-numerical translation.

The resulting observables are shown in Figure 5, see also [44]. The first panel shows the two-time correlation function of the emitted field. The second panel shows the temporal envelopes of the two dominant modes, and the third panel demonstrates how the initial atomic excitation is transferred into the cavity and finally into the two captured output modes. The agreement n1≈n1t(T)n_1 \approx n_{1t}(T) and n2≈n2t(T)n_2 \approx n_{2t}(T) confirms that both modes identified from the correlation matrix are captured by the virtual cavities. The final density operator retains the joint state of the emitter and the captured temporal modes, from which photon-number correlations and emitter–mode entanglement can be evaluated. Since the open-system state can be mixed, we quantify this entanglement with the negativity N(ρ)=(∥ρTA∥1−1)/2\mathcal{N}(\rho) = (\lVert\rho^{T_A} \rVert_1 - 1)/2 [61, 62]. After tracing out the physical cavity, a partial transposition of the emitter subsystem gives N=0.533\mathcal{N} = 0.533 at the final time. Its positive value certifies entanglement between the emitter and the two captured modes.

Photon number and emitter–mode entanglement for a three-level $\Lambda$ emitter

Figure 5. Photon number and emitter–mode entanglement for a three-level Λ\Lambda emitter. The left panel shows the first-order correlation matrix of the emitted field obtained from the reduced cavity–atom simulation. The middle panel shows the real parts of the two dominant output modes extracted from the two eigenvectors with the largest eigenvalues of the correlation matrix. These modes are complex, and their eigenvectors are defined only up to a global phase, so each is rotated by the phase that maximizes its real part. The right panel shows the time evolution of the cavity population, the excited-state population, the occupations of the two captured output modes, and the emitter–mode negativity N\mathcal{N} during the second propagation step.

The preceding simulation can also be performed without the symbolic derivation, i.e., by directly using the numerical operators and functions. This is shown in Code sample 9. We use the numerical operators and functions already defined in Code sample 8 to create the SLH struct. The remaining procedure is unchanged.

# numeric Hamiltonian
Hₛ_slh = g_qo*(c_qo'*σ_qo(1, 3) + c_qo*σ_qo(3, 1) +
c_qo'*σ_qo(2, 3) + c_qo*σ_qo(3, 2)) + ω₁₂_qo*σ_qo(2, 2)

# numeric SLH triples with time-dependent couplings
Gᵥ₁_slh = SLH(1, t -> conj(gᵥ₁_qo(t))*av₁_qo, 0*one(b))
Gᵥ₂_slh = SLH(1, t -> conj(gᵥ₂_qo(t))*av₂_qo, 0*one(b))

# full Hamiltonian and jump operator
G_slh = cascade(Gₛ_slh, Gᵥ₁_slh, Gᵥ₂_slh)
H_slh = hamiltonian(G_slh)
L_slh = jump_operator(G_slh)[1]

Code sample 9. The same two-mode simulation written directly with numerical operators.

Quantum dots in a bidirectional waveguide with a coherent input pulse

As a second example, we consider two two-level emitters coupled to a bidirectional waveguide driven by a coherent input pulse [63]. Here the challenge is the network itself: the two propagation directions and the phase accumulated between the emitters generate coherent and dissipative couplings that depend on how the ports are connected. We construct the same physical network in two ways, first as explicit right- and left-moving cascades and then by closing the corresponding multiport network with feedback reduction.

We start by building the right- and left-moving channels explicitly and concatenate them. Emitter ii has detuning Δi\Delta_i and directional waveguide coupling rates γR(i)\gamma_R^{(i)} and γL(i)\gamma_L^{(i)}, with σ^mni=∣m⟩i⟨n∣i\hat{\sigma}_{mn}^{i} = |m\rangle_i\langle n|_i, and propagation between the emitters contributes the phase ϕij\phi_{ij}. Unlike the preceding quantum-pulse examples, the input is represented by the coherent amplitude Ein(t)E_{\mathrm{in}}(t) rather than a virtual input cavity. It enters through the right-moving channel, and the two output coupling operators describe transmission and reflection. For N=2N = 2 emitters the symbolic construction reads:

using QuantumInputOutput
using SecondQuantizedAlgebra
using Symbolics: variable

# symbolic Hilbert space and operators
N = 2
ha(i) = NLevelSpace(Symbol("a$(i)"), 2)
h = tensor([ha(i) for i = 1:N]...)
σ(α, i, j) = Transition(h, Symbol("σ_$(α)"), i, j, α)

# symbolic parameters
γR(i) = variable(Symbol("γ^{($(i))}_R"); T = Real)
γL(i) = variable(Symbol("γ^{($(i))}_L"); T = Real)
∆(i) = variable(Symbol("∆_{$(i)}"); T = Real)
ϕ(i, j) = variable(Symbol("ϕ_{$(i)$(j)}"); T = Real)
Ein = variable(Symbol("E_{in}"); T = Real)

# drive, phase shift and QD SLH elements
Gin = SLH(1, Ein, 0)
G_ϕ(i, j) = SLH(exp(1im*ϕ(i, j)), 0, 0)
GR(i) = SLH(1, √γR(i)*σ(i, 1, 2), -∆(i)*σ(i, 2, 2))
GL(i) = SLH(1, √γL(i)*σ(i, 1, 2), 0)
# cascade right- and left-moving modes
GR_tot = Gin ▷ GR(1) ▷ G_ϕ(1, 2) ▷ GR(2)
GL_tot = GL(2) ▷ G_ϕ(1, 2) ▷ GL(1)
# concatenate both channels
G_tot = GR_tot ⊞ GL_tot

# full Hamiltonian and jump operators
H = hamiltonian(G_tot)
L = jump_operator(G_tot)
L_R = L[1]
L_L = L[2]

Code sample 10. Bidirectional waveguide constructed from cascades and concatenation.

The key structural point is that the right-moving propagation is built as a cascade in the physical propagation direction, while the left-moving propagation is constructed in reverse order. The triple Gtot=GR_tot⊞GL_totG_{\mathrm{tot}} = G_{R\_\mathrm{tot}} \boxplus G_{L\_\mathrm{tot}} then collects both channels into one two-port SLH model. The resulting coupling vector contains one operator for each propagation direction.

The same physical model can also be constructed with the SLH feedback reduction rule (Sec. II B). Here one first concatenates the unconnected two-port components, keeps all waveguide links explicit as external ports, and then removes the internal connections symbolically with a sequence of feedback reductions. The feedback procedure applied in Code sample 11 corresponds to the one depicted in Figure 2.

using LinearAlgebra

# individual SLH elements
I₂ = Matrix{Int}(I, 2, 2)
Gin = SLH(I₂, [Ein, 0], 0)
G_qd(i) = SLH(
    I₂, [√γR(i)*σ(i, 1, 2), √γL(i)*σ(i, 1, 2)],
    -∆(i)*σ(i, 2, 2))
G_ϕ(i, j) = SLH(
    [exp(1im*ϕ(i, j)) 0; 0 exp(1im*ϕ(i, j))], [0, 0], 0)

# feedback reduction
G_unc = Gin ⊞ G_qd(1) ⊞ G_ϕ(1, 2) ⊞ G_qd(2)
G_red = feedback(G_unc,
1 => 3, 3 => 5, 5 => 7, 8 => 6, 6 => 4, 4 => 2)

# full Hamiltonian and jump operators
H_red = hamiltonian(G_red)
L_red = jump_operator(G_red)
LL_red = L_red[1]
LR_red = L_red[2]

Code sample 11. Deriving the same effective model via concatenation and feedback reduction.

The port numbers in Figure 2 and Code sample 11 follow from the concatenation. Each component has two ports, the first for the right-moving and the second for the left-moving channel. A pair x⇒yx \Rightarrow y feeds output xx back into input yy [Eqs. (15)–(17)]. The right-moving links are therefore 1⇒31 \Rightarrow3, 3⇒53 \Rightarrow5, 5⇒75 \Rightarrow7, while the left-moving links run backwards, 8⇒68 \Rightarrow6, 6⇒46 \Rightarrow4, 4⇒24 \Rightarrow2. All numbers refer to the unreduced network GuncG_{\mathrm{unc}}, and feedback keeps track of how the remaining ports are renumbered after each reduction. The ports left open are input 1, which carries the drive, output 7 (transmission), input 8, and output 2 (reflection). The open outputs keep their original order, so L_red[1] is the reflected and L_red[2] the transmitted field, opposite to Code sample 10.

Feedback reduction is useful for networks whose internal connections are not naturally expressed as independent cascades. For this network, it gives the same Hamiltonian and coupling operators as the direct construction. For two emitters with separation phase ϕ\phi, the resulting Hamiltonian is

H^wg=−∑i=12Δiσ^ii+12i[Ein(γR(1)σ^121+eiϕγR(2)σ^221)−h.c.]+12i[eiϕ(γR(1)γR(2)σ^221σ^112+γL(1)γL(2)σ^121σ^212)−h.c.].(28)\hat{H}_{\mathrm{wg}} = -\sum_{i=1}^{2}\Delta_i\hat{\sigma}_{ii} + \frac{1}{2i}\left[E_{\mathrm{in}}\left(\sqrt{\gamma_{R}^{(1)}}\hat{\sigma}_{1}^{21} + e^{i\phi}\sqrt{\gamma_{R}^{(2)}}\hat{\sigma}_{2}^{21}\right) - \mathrm{h.c.}\right] + \frac{1}{2i}\left[e^{i\phi}\left(\sqrt{\gamma_{R}^{(1)}\gamma_{R}^{(2)}}\hat{\sigma}_{2}^{21}\hat{\sigma}_{1}^{12} + \sqrt{\gamma_{L}^{(1)}\gamma_{L}^{(2)}}\hat{\sigma}_{1}^{21}\hat{\sigma}_{2}^{12}\right) - \mathrm{h.c.}\right]. \tag*{(28)}

The first bracket contains the coherent input pulse arriving at the two emitters with the correct propagation phase, while the second bracket contains the direction-dependent dipole–dipole exchange generated by the waveguide [63, 64, 65, 66, 67]. This illustrates that the SLH network rules used here are not merely bookkeeping devices; they are also a compact way to derive the effective Hamiltonian and Lindblad operators for one-dimensional quantum systems.

For the numerical simulation we choose a Gaussian input envelope, translate the symbolic operators to QuantumOptics.jl, and compute the transmitted and reflected intensities.

using QuantumOptics

# numeric parameters
γ = 1.0
β = 0.9
γR_qo = fill(γ*β/2, N)
γL_qo = fill(γ*β/2, N)
γ_add = fill(γ*(1 - β), N)
∆_qo = fill(0.0, N)
ϕ_qo = fill(pi/10, max(N - 1, 0))

# Gaussian input pulse
σt = 0.8
α0 = √0.1
t0 = 4σt
T_end = 3t0
u(t) = 1/(√σt*pi^(1/4)) * exp(-(t - t0)^2 / (2*σt^2))
Ein_qo(t) = α0*u(t)

# constant and time-dependent parameters
p = [[γR(i) for i = 1:N]; [γL(i) for i = 1:N];
     [∆(i) for i = 1:N]; [ϕ(i, i + 1) for i = 1:(N-1)]]
p_qo = [γR_qo; γL_qo; ∆_qo; ϕ_qo]
parameter = Dict(p => p_qo)
time_parameter = Dict(Ein => Ein_qo)

# translate to numerics
ba = NLevelBasis(2)
b = tensor([ba for _ = 1:N]...)
H_qo = to_numeric(H, b; parameter, time_parameter)
LR_qo = to_numeric(LR, b; parameter, time_parameter)
LL_qo = to_numeric(LL, b; parameter, time_parameter)
# additional free-space decay
σ_qo(α, i, j) = to_numeric(σ(α, i, j), b)
L_add = [√γ_add[i]*σ_qo(i, 1, 2) for i = 1:N]

function f_io(t, ρ)
    Ht = H_qo(t)
    Lt = [LR_qo(t), LL_qo(t), L_add...]
    return Ht, Lt, dagger.(Lt)
end

# time evolution
T = [0:0.005:1] .* T_end
ψ0 = tensor([nlevelstate(ba, 1) for _ = 1:N]...)
t, ρt = timeevolution.master_dynamic(T, ψ0, f_io)

# transmitted and reflected intensity
IR = zeros(length(t))
IL = zeros(length(t))
for (i, ti) in enumerate(t)
    lR = LR_qo(ti)
    lL = LL_qo(ti)
    IR[i] = real(expect(lR'*lR, ρt[i]))
    IL[i] = real(expect(lL'*lL, ρt[i]))
end

Code sample 12. Translation and numerical simulation of the output intensities for the bidirectional quantum-dot waveguide system.

The resulting intensities are shown in Figure 6. The dashed curve is the input pulse intensity ∣Ein(t)∣2|E_{\mathrm{in}}(t)|^2, while the solid curves show the reflected field and the corresponding reshaping of the transmitted pulse by the two-emitter system. In Appendix B, we additionally provide a code sample to simulate the two-time intensity correlation functions in transmission and reflection.

Transmitted and reflected intensities for the bidirectional waveguide

Figure 6. Transmitted and reflected intensities for the bidirectional waveguide with two quantum dots driven by a coherent input pulse from the left. The dashed curve shows the input intensity ∣Ein(t)∣2|E_{\mathrm{in}}(t)|^2.

Interaction-picture scattering with a quantum pulse

As a third example, we consider pulse scattering from a resonant two-level system in a regime where the direct virtual-cavity representation becomes inefficient. For a highly occupied pulse, the laboratory-frame basis must resolve the transfer of the full occupation from the input cavity to the output cavity, even though the scatterer changes only a small number of excitations. The interaction picture of Sec. II D removes these direct mode-transfer dynamics, so the truncated basis need only resolve the photons modified by the scattering. We take the input mode uu to be prepared in a Fock state with n=100n = 100 photons and choose the selected virtual output mode to have the same Gaussian profile, v=uv = u.

We build the cascaded triple GutrianglerightGstrianglerightGvG_u \\triangleright G_s \\triangleright G_v, subtract the direct virtual-cavity Hamiltonian H^uv\hat{H}_{uv}, and substitute the transformed mode operators obtained from the matrix solution M(t)M(t) of the interaction-picture evolution with substitute. This symbolic construction is shown in Code sample 13. The numerical translation to QuantumOptics.jl is shown separately in Code sample 14, where we initialize the state ∣100⟩u∣g⟩∣0⟩v|100\rangle_u |g\rangle|0\rangle_v, solve the master equation, and evaluate the interaction-picture uu- and vv-mode occupations ⟨n^u⟩\langle\hat{n}_u\rangle and ⟨n^v⟩\langle\hat{n}_v\rangle, and the atomic excitation ⟨σ^22⟩\langle\hat{\sigma}_{22}\rangle.

using QuantumInputOutput
using SecondQuantizedAlgebra
using Symbolics: variable

# symbolic Hilbert space and operators
h = FockSpace(:u) ⊗ NLevelSpace(:s, 2) ⊗ FockSpace(:v)
au = Destroy(h, :au, 1)
av = Destroy(h, :av, 3)
σ(i, j) = Transition(h, :σ, i, j, 2)
@variables gu::Number gv::Number γ::Real

# SLH elements, Hamiltonian and jump operator
Gu = SLH(1, gu'*au, 0)
Gs = SLH(1, √γ*σ(1, 2), 0)
Gv = SLH(1, gv'*av, 0)
G_cas = Gu ▷ Gs ▷ Gv
H = hamiltonian(G_cas)
L = jump_operator(G_cas)[1]

# interaction picture transformation
M(i, j) = variable(Symbol("M_{$(i)$(j)}");
    T = Complex{Real})
a0 = [au, av]
a_int = [sum(M(i, j)*a0[j] for j = 1:2) for i = 1:2]
int_dict = Dict(a0 .=> a_int)
Huv = hamiltonian(Gu ▷ Gv)
H_int = substitute(H - Huv, int_dict)
L_int = substitute(L, int_dict)

Code sample 13. Symbolic interaction-picture construction for an n=100n = 100 Fock-state pulse scattering on a two-level system.

We choose the parameters such that the atom reaches approximately 50% excitation, using a Gaussian pulse u(t)∝exp⁡[−(t−tp)2/2σp2]u(t) \propto\exp[-(t - t_p)^2/2\sigma_p^2] centered at tp=4σpt_p = 4\sigma_p with a width of σp=θ2/(8nγπ)\sigma_p = \theta^2/(8n\gamma\sqrt{\pi}), where θ=π/2\theta= \pi/2 is the pulse area for the Rabi frequency Ω(t)=2γu(t)\Omega(t) = 2\sqrt{\gamma}u(t). In that case the atom and the pulse mode become entangled.

In Figure 7, we plot the dynamics of the mean photon number (top) and the two-level system (bottom). The interaction-picture uu-mode occupation (blue solid line) is reduced by approximately one half of a photon after the interaction. The coherence of the two-level system vanishes at all times (⟨σ^12⟩=0\langle\hat{\sigma}^{12}\rangle= 0), due to the phase symmetry of the master equation. The atom and the field are entangled, which we quantify by the negativity across the atom–field bipartition of N=0.497\mathcal{N} = 0.497 at the end of the pulse, close to its maximum value of 1/21/2 for an effective two-level bipartition.

Interaction picture and cumulant expansion

Figure 7. Interaction picture and cumulant expansion. The top panel shows the mean photon number of the traveling light pulse in the temporal input mode for an initial Fock state and a coherent state, simulated with the interaction-picture master equation and a second-order cumulant expansion approach, respectively. The bottom panel shows the excited-state population and coherence. For the initial Fock state, the two-level system coherence vanishes for all times, as imposed by the phase symmetry of the master equation.

using QuantumOptics

# numerical parameters
γ_qo = 1.0
n_ph = 100
σ_p = (π/2)^2 / (8*n_ph*γ_qo*√π)
t_p = 4σ_p
T = [0.005:1] * 0.015
u(t) = 1/(√σ_p*π^(1/4)) * exp(-0.5*((t - t_p)/σ_p)^2)
gu_qo = coupling_input(u, T)
gv_qo = coupling_output(u, T)

# numerical interaction-picture coupling matrix
A_uv = coupling_matrix([gu_qo, gv_qo])
M_qo = solve_mode_evolution(A_uv, T)

parameter = Dict(γ => γ_qo)
Ms = [M(i, j) for i = 1:2 for j = 1:2]
Ms_qo = [t -> M_qo(t)[i, j] for i = 1:2 for j = 1:2]
time_parameter =
    Dict([gu, gv, Ms...] => [gu_qo, gv_qo, Ms_qo...])

# operator basis and translation to numerics
b_u = FockBasis(n_ph + 1)
b_a = NLevelBasis(2)
b_v = FockBasis(2)
b = b_u ⊗ b_a ⊗ b_v
H_qo = to_numeric(H_int, b; parameter, time_parameter)
L_qo = to_numeric(L_int, b; parameter, time_parameter)
# time evolution
function f_io(t, ρ)
    Ht = H_qo(t)
    Lt = [L_qo(t)]
    return Ht, Lt, dagger.(Lt)
end
ψ₀ = fockstate(b_u, n_ph) ⊗ nlevelstate(b_a, 1) ⊗
fockstate(bᵥ, 0)
_, ρt = timeevolution.master_dynamic(T, ψ₀, f_io)

# expectation values
aᵤ_qo = destroy(bᵤ) ⊗ one(bₐ) ⊗ one(bᵥ)
aᵥ_qo = one(bᵤ) ⊗ one(bₐ) ⊗ destroy(bᵥ)
σee_qo = one(bᵤ) ⊗ transition(bₐ, 2, 2) ⊗ one(bᵥ)
σge_qo = one(bᵤ) ⊗ transition(bₐ, 1, 2) ⊗ one(bᵥ)

nᵤ = real.(expect(aᵤ_qo'*aᵤ_qo, ρt))
nᵥ = real.(expect(aᵥ_qo'*aᵥ_qo, ρt))
Pₑ = real.(expect(σee_qo, ρt))
s_ge = abs.(expect(σge_qo, ρt))

# entanglement between the atom and both field modes
N_atom_field = negativity(ρt[end], 2)

Code sample 14. Numerical interaction-picture simulation for an n=100n = 100 Fock-state pulse.

The symbolic SLH network constructed above can also be used without a Fock-space representation of the field. To illustrate this, we keep the same network but replace the Fock input by a coherent state with the same mean photon number nˉ=∣α∣2=100\bar{n} = \lvert\alpha\rvert^2 = 100 and use a second-order cumulant expansion [53]. A cumulant expansion truncates the hierarchy of operator averages, so the Fock-space cutoff of the previous example plays no role and we can stay in the laboratory frame. The interaction-picture transformation could be applied here as well. We keep the symbolic SLH model, derive the second-order mean-field equations, complete the set of equations, and then integrate the resulting set of ODEs numerically. There is one subtle derivation difference compared to the previous example. Since we do not translate the symbolic expressions to numerical operators, we must register the time-dependent pulse couplings as symbolic functions of the independent variable of the mean-field equations. To avoid repeating the SLH derivation, we substitute these registered functions directly into the already derived Hamiltonian and Lindblad operator. To obtain the initial average values for the time evolution we define the state first in QuantumOptics.jl as a LazyKet to keep the state vector small and then calculate the values with the function initial_values.

using QuantumCumulants
using ModelingToolkitBase
using OrdinaryDiffEq

# time variable of the mean-field equations
@independent_variables t

# register the pulse couplings as functions of time
@register_symbolic gᵤ_reg(tt)
@register_symbolic gᵥ_reg(tt)
subs = Dict(gᵤ => gᵤ_reg(t), gᵥ => gᵥ_reg(t))
H_mf = substitute(H, subs)
L_mf = substitute(L, subs)
gᵤ_reg(tt) = gᵤ_qo(tt)
gᵥ_reg(tt) = gᵥ_qo(tt)

# derive and complete the mean-field equations
ops = [aᵤ, aᵤ'*aᵤ, σ(2, 2), aᵤ'*σ(1, 2),
σ(1, 2), aᵥ, aᵥ'*aᵥ]
eqs = meanfield(ops, H_mf, [L_mf]; order = 2)
eqs_comp = complete(eqs)
sys = mtkcompile(System(eqs_comp; name = :sys))

# initial state
α₀ = √nₚₕ
bᵤ₂ = FockBasis(2*nₚₕ)
bₐ₂ = NLevelBasis(2)
bᵥ₂ = FockBasis(1)
b₂ = bᵤ₂ ⊗ bₐ₂ ⊗ bᵥ₂
ψ₀_coh = LazyKet(b₂, (coherentstate(bᵤ₂, α₀),
    nlevelstate(bₐ₂, 1), fockstate(bᵥ₂, 0)))

# define and solve the ODE problem
p₀ = merge(Dict(γ => γ_qo),
    initial_values(eqs_comp, ψ₀_coh))
prob = ODEProblem(sys, p₀, (0.0, T[end]))
sol = solve(prob, Tsit5(); saveat = T,
    abstol = 1e-10, reltol = 1e-10)

# expectation values
nᵤ₂ = real.(get_solution(sol, aᵤ'*aᵤ, eqs_comp).(T))
nᵥ₂ = real.(get_solution(sol, aᵥ'*aᵥ, eqs_comp).(T))
Pₑ₂ = real.(get_solution(sol, σ(2, 2), eqs_comp).(T))
s_ge₂ = abs.(get_solution(sol, σ(1, 2), eqs_comp).(T))

Code sample 15. Second-order cumulant treatment for a coherent pulse with mean photon number nˉ=100\bar{n} = 100.

For example, for the excited-state population of the two-level system, the above code provides the mean-field equation

∂t⟨σ22⟩=−γ⟨σ22⟩−gu(t)γ(⟨au†σ12⟩+⟨auσ21⟩)(29)\partial_t\langle\sigma^{22}\rangle= -\gamma\langle\sigma^{22}\rangle- g_u(t)\sqrt{\gamma}\left(\langle a_u^\dagger\sigma^{12}\rangle+ \langle a_u\sigma^{21}\rangle\right) \tag*{(29)}

where we used that the mode functions, and hence the virtual-cavity couplings, are real for the Gaussian pulse considered here. The dashed lines in Figure 7 show the dynamics for the initial coherent state. We see that the mean photon number in the pulse is also reduced by approximately one half of a photon. Note, however, that because we are not operating in the interaction picture in this case, the change in the pulse is given by the sum of the input- and output-pulse virtual-cavity occupations, where we choose the temporal output mode to be equal to the input mode. The crucial difference for the coherent-state pulse is that the atom retains coherence after the interaction. An additional exact master-equation calculation gives an atom-field negativity of only N=0.0135N = 0.0135, so the coherent pulse acts almost as a classical drive. This value cannot be obtained from the second-order cumulant averages alone.

Conclusion and outlook

QuantumInputOutput.jl combines SLH network composition with the virtual-cavity description of propagating quantum pulses in a common computational framework. Together, these tools allow network connectivity to determine the effective open-system model, relevant temporal output modes to be retained as explicit quantum subsystems, and the resulting dynamics to be treated in representations adapted to the problem.

The virtual-cavity approach is most natural when the propagating field is concentrated in a small number of relevant temporal modes. For broad multimode fields or strong temporal entanglement, approaches that represent the propagating field explicitly, including time-bin and matrix-product-state methods [41, 42], provide a complementary description.

Natural extensions include interfaces to other packages solving master equations [52, 68]. Since the virtual-cavity construction yields a standard Lindblad master equation, established approximations [53, 69] and numerical methods [70, 71, 72, 73, 74] can be applied directly. An interface for QuantumToolbox.jl [52] through SecondQuantizedAlgebra.jl has already been created. We expect the framework to be useful for direct numerical simulations, but also for analytic derivations of input–output network equations.

Acknowledgments

The authors thank J. Kerber, H. Ritsch and Z. Aqua for testing the framework. C.H. was supported by the Carlsberg Foundation through the “Semper Ardens” Research Project QCooL. This research was funded in whole or in part by the Austrian Science Fund (FWF) 10.55776/J4865. For the purpose of open access, the authors have applied a CC BY public copyright license to any Author Accepted Manuscript (AAM) version arising from this submission. The source code of QuantumInputOutput.jl used in this article is archived on Zenodo [75].

Common SLH elements

In this section, we summarize the most frequently used SLH elements in QuantumInputOutput.jl, see also Appendix 1 of Ref. [7]. Throughout, σ^mn=∣m⟩⟨n∣\hat{\sigma}^{mn} = |m\rangle\langle n| denotes a transition operator, with the level labels given for each element.

  • Input (output) cavity for a traveling pulse with temporal input mode u(t)u(t) (output mode v(t)v(t)):

Gu=(1,gu∗(t)a^u,0)(30)G_u = (1, g_u^*(t)\hat{a}_u, 0) \tag*{(30)}
Gv=(1,gv∗(t)a^v,0)(31)G_v = (1, g_v^*(t)\hat{a}_v, 0) \tag*{(31)}
  • Single-port phase shifter with phase ϕ\phi:

GPS=(eiϕ,0,0)(32)G_{\mathrm{PS}} = (e^{i\phi}, 0, 0) \tag*{(32)}
  • Two-port beam splitter:

GBS=((r11t12t21r22),0,0)(33)G_{\mathrm{BS}} = \left(\begin{pmatrix} r_{11} & t_{12} \\ t_{21} & r_{22} \end{pmatrix}, 0, 0\right) \tag*{(33)}
  • Coherent drive that displaces the input field by a generally time-dependent amplitude α(t)\alpha(t):

Gcoh=(1,α(t),0)(34)G_{\mathrm{coh}} = (1, \alpha(t), 0) \tag*{(34)}
  • One-sided cavity with decay rate κ\kappa, detuning Δ\Delta, and bosonic mode operator c^\hat{c}:

G1s=(1,κc^,−Δc^†c^)(35)G_{\mathrm{1s}} = (1, \sqrt{\kappa}\hat{c}, -\Delta\hat{c}^{\dagger}\hat{c}) \tag*{(35)}
  • Two-sided cavity (Fabry–Pérot resonator) with detuning Δ\Delta and mirror decay rates κ1\kappa_1 and κ2\kappa_2:

G2s=(I2,[κ1c^κ2c^],−Δc^†c^)(36)G_{\mathrm{2s}} = \left(I_2, \begin{bmatrix} \sqrt{\kappa_1}\hat{c} \\ \sqrt{\kappa_2}\hat{c} \end{bmatrix}, -\Delta\hat{c}^{\dagger}\hat{c}\right) \tag*{(36)}
  • Two-level system with ground state ∣g⟩|g\rangle, excited state ∣e⟩|e\rangle, and coupling to a chiral waveguide with guided decay rate γg\gamma_g, unguided decay rate γ⊥\gamma_\perp, and transition frequency ω\omega:

GTLS=(I2,[γgσ^geγ⊥σ^ge],ωσ^ee)(37)G_{\mathrm{TLS}} = \left(I_2, \begin{bmatrix} \sqrt{\gamma_g}\hat{\sigma}^{ge} \\ \sqrt{\gamma_\perp}\hat{\sigma}^{ge} \end{bmatrix}, \omega\hat{\sigma}^{ee}\right) \tag*{(37)}

Quantum regression theorem for the bidirectional waveguide

In this section, we compute the two-time intensity correlations G(2)(t1,t2)=⟨L^†(t1)L^†(t2)L^(t2)L^(t1)⟩G^{(2)}(t_1,t_2) = \langle\hat{L}^{\dagger}(t_1)\hat{L}^{\dagger}(t_2)\hat{L}(t_2)\hat{L}(t_1)\rangle, (B1) via the quantum regression theorem for the coherent-pulse waveguide example in Sec. IV B, with L^\hat{L} the coupling operator of the transmitted or the reflected channel. For each time point t1t_1, one propagates the conditional state L^(t1)ρ(t1)L^†(t1)\hat{L}(t_1)\rho(t_1)\hat{L}^{\dagger}(t_1) forward in time and evaluates the corresponding output intensity at later times t2t_2.

The function correlation_matrix, which provides g(1)g^{(1)} of Eq. (18) in Code sample 4, has the same structure. For each t1t_1, it acts with L^s(t1)\hat{L}_s(t_1) on ρ(t1)\rho(t_1) from one side, propagates this operator forward in time, and evaluates L^s†\hat{L}_s^{\dagger} at the later times t2t_2. The two calculations thus differ only in the conditional operator that starts the second propagation and in the operator measured at t2t_2. Since G(2)G^{(2)} requires the two-sided conditional state L^ρL^†\hat{L}\rho\hat{L}^{\dagger}, we write out the loop explicitly in Code sample 16.

# time grid
nT = length(T)
G⁽²⁾ = zeros(nT, nT)
G⁽²⁾_ref = zeros(nT, nT)

# output field operators, materialized at each time
L₀(t) = dense(static_operator(Lᴿ_qu̇(t)))
L₀_dag(t) = dagger(L₀(t))
L₀_ref(t) = dense(static_operator(Lᴸ_qu̇(t)))
L₀_ref_dag(t) = dagger(L₀_ref(t))

for it₁ = 1:(nT-1)
    ρt₁ = ρt[it₁]

    # second time-evolution for transmission
    t₂, ρ₂ =
        timeevolution.master_dynamic(T[it₁:end],
            L₀(T[it₁]) * ρt₁ * L₀_dag(T[it₁]), f_io)

    # transmission two-time correlation
    G⁽²⁾_row = real.([
        expect(L₀_dag(t₂[j])*L₀(t₂[j]),
            ρ₂[j]) for j = 1:length(t₂)
    ])
    G⁽²⁾[it₁, it₁:end] = G⁽²⁾_row
    G⁽²⁾[it₁:end, it₁] = G⁽²⁾_row

    # second time-evolution for reflection
    t₂_ref, ρ₂_ref =
        timeevolution.master_dynamic(T[it₁:end],
            L₀_ref(T[it₁]) * ρt₁ * L₀_ref_dag(T[it₁]), f_io)

    # reflection two-time correlation
    G⁽²⁾_row_ref = real.([
        expect(L₀_ref_dag(t₂_ref[j])*L₀_ref(t₂_ref[j]),
            ρ₂_ref[j]) for j = 1:length(t₂_ref)
    ])
    G⁽²⁾_ref[it₁, it₁:end] = G⁽²⁾_row_ref
    G⁽²⁾_ref[it₁:end, it₁] = G⁽²⁾_row_ref
end

Code sample 16. Second-order output correlations from the quantum regression theorem.

The resulting correlation functions for the reflection and transmission are shown in Figure 8. In transmission, we see the characteristic bird shape [76, 77].

Second-order correlation functions for the reflected and transmitted fields

Figure 8. Second-order correlation functions G(2)(t1,t2)G^{(2)}(t_1,t_2) for the reflected and transmitted fields of the bidirectional waveguide example, obtained via the quantum regression theorem. Each panel is scaled by its own maximum for display.

Software versions

All code samples in this paper run with Julia 1.13.2 and the package versions listed in Table I.

SoftwareVersion
Julia1.13.2
QuantumInputOutput.jl0.6.0
SecondQuantizedAlgebra.jl0.15.0
QuantumCumulants.jl0.8.0
QuantumOptics.jl1.2.10
QuantumOpticsBase.jl0.5.16
ModelingToolkitBase.jl1.80.0
OrdinaryDiffEq.jl7.8.1
Symbolics.jl7.48.0

Table I. Julia and package versions used for the code samples.

References

References

  1. [1]C. W. Gardiner and M. J. Collett, Physical Review A 31, 3761 (1985).
  2. [2]C. W. Gardiner, Physical Review Letters 70, 2269 (1993).
  3. [3]H. J. Carmichael, Physical Review Letters 70, 2273 (1993).
  4. [4]C. Gardiner and P. Zoller, Quantum noise: a handbook of Markovian and non-Markovian quantum stochastic methods with applications to quantum optics (Springer Science & Business Media, 2004).
  5. [5]H. Pichler, T. Ramos, A. J. Daley, and P. Zoller, Physical Review A 91, 042116 (2015).
  6. [6]P. Lodahl, S. Mahmoodian, S. Stobbe, A. Rauschenbeutel, P. Schneeweiss, J. Volz, H. Pichler, and P. Zoller, Nature 541, 473–480 (2017).
  7. [7]J. Combes, J. Kerckhoff, and M. Sarovar, Advances in Physics: X 2, 784 (2017).
  8. [8]A. S. Shuker, M. I. Petrov, I. V. Iorsh, A. V. Poshakinskiy, and A. N. Poddubny, Reviews of Modern Physics 95, 015002 (2023).
  9. [9]K. Stannigel, P. Rabl, and P. Zoller, New Journal of Physics 14, 063014 (2012).
  10. [10]S. Cardenas-Lopez, S. J. Masson, K. Zager, and A. Asenjo-Garcia, Physical Review Letters 131, 033605 (2023).
  11. [11]K. J. Kusmierek, S. Mahmoodian, M. Cordier, J. Hinney, A. Rauschenbeutel, M. Schemmner, P. Schneeweiss, J. Volz, and K. Hammerer, SciPost Physics Core 6, 041 (2023).
  12. [12]C. Liedl, F. Tebbenjohanns, C. Bach, S. Pucher, A. Rauschenbeutel, and P. Schneeweiss, Physical Review X 14, 011020 (2024).
  13. [13]M. Maffei, D. Pomarico, P. Facchi, G. Magnifico, S. Pascazio, and F. V. Pepe, Physical Review Research 6, L032017 (2024).
  14. [14]A. Frisk Kockum, P. Delsing, and G. Johansson, Physical Review A 90, 013837 (2014).
  15. [15]A. F. Kockum, G. Johansson, and F. Nori, Physical Review Letters 120, 140404 (2018).
  16. [16]B. Kannan, M. J. Ruckriegel, D. L. Campbell, A. Frisk Kockum, J. Braumüller, D. K. Kim, M. Kjaergaard, P. Krantz, A. Melville, B. M. Niedzielski, A. Vepsäläinen, R. Winik, J. L. Yoder, F. Nori, T. P. Orlando, S. Gustavsson, and W. D. Oliver, Nature 583, 775–779 (2020).
  17. [17]M. Fleischhauer, A. Imamoglu, and J. P. Marangos, Rev. Mod. Phys. 77, 633 (2005).
  18. [18]G. Nikoghosyan and M. Fleischhauer, Physical Review Letters 105, 013601 (2010).
  19. [19]D. Witthaut, M. D. Lukin, and A. S. Sørensen, EPL (Europhysics Letters) 97, 50007 (2012).
  20. [20]D. E. Chang, V. Vuletić, and M. D. Lukin, Nature Photonics 8, 685 (2014).
  21. [21]T. Caneva, M. T. Manzoni, T. Shi, J. S. Douglas, J. I. Cirac, and D. E. Chang, New Journal of Physics 17, 113001 (2015).
  22. [22]J. E. Gough and S. Wildfeuer, Physical Review A 80, 042107 (2009).
  23. [23]L.-M. Duan and H. J. Kimble, Phys. Rev. Lett. 92, 127902 (2004).
  24. [24]M. L. Chan, Z. Aqua, A. Tiranov, B. Dayan, P. Lodahl, and A. S. Sørensen, Phys. Rev. A 105, 062445 (2022).
  25. [25]Z. Aqua and B. Dayan, PRX Quantum 6, 010340 (2025).
  26. [26]J. Gough and M. R. James, IEEE Transactions on Automatic Control 54, 2530 (2009).
  27. [27]J. Gough and M. R. James, Communications in Mathematical Physics 287, 1109 (2009).
  28. [28]H. J. Kimble, Nature 453, 1023–1030 (2008).
  29. [29]K. Azuma, S. E. Economou, D. Elkouss, P. Hilaire, L. Jiang, H.-K. Lo, and I. Tzitrin, Rev. Mod. Phys. 95, 045006 (2023).
  30. [30]B. Brecht, D. V. Reddy, C. Silberhorn, and M. G. Raymer, Physical Review X 5, 041017 (2015).
  31. [31]M. G. Raymer and I. A. Walmsley, Physica Scripta 95, 064002 (2020).
  32. [32]C. Fabre and N. Treps, Reviews of Modern Physics 92, 035005 (2020).
  33. [33]B. Lemberger and K. Mølmer, Physical Review A 103, 033713 (2021).
  34. [34]F. Belliardo, A. Chu, M. Koppenhöfer, and A. A. Clerk, PRX Quantum (2026).
  35. [35]F. Yang, M. M. Lund, T. Pohl, P. Lodahl, and K. Mølmer, Physical Review Letters 128, 213603 (2022).
  36. [36]M. M. Lund, F. Yang, and K. Mølmer, Physical Review A 107, 023715 (2023).
  37. [37]N. Gutman, A. Gorlach, O. Tziperman, R. Ruimy, and I. Kaminer, Physical Review Letters 132, 153601 (2024).
  38. [38]O. Tziperman, G. Baranes, A. Gorlach, R. Ruimy, C. Mechel, M. Faran, N. Gutman, A. Pizzi, and I. Kaminer, ACS Nano 19, 21260 (2025).
  39. [39]J. Kerber, C. Hotter, H. Ritsch, and K. Mølmer, Input-output analysis of quantum dot SUPER excitation (2026), arXiv:2608.28470 [quant-ph].
  40. [40]V. R. Christiansen, M. M. Lund, F. Yang, and K. Mølmer, Journal of the Optical Society of America B 41, 10.1364/JOSAB.523292 (2024).
  41. [41]N. Bungaard-Nielsen, D. Englund, M. Heuck, and S. Krastanov, Quantum 9, 1698 (2025).
  42. [42]S. Arranz Regidor, M. Kozma, and S. Hughes, Quantum 10, 2258 (2026).
  43. [43]A. H. Kiilerich and K. Mølmer, Physical Review Letters 123, 123604 (2019).
  44. [44]A. H. Kiilerich and K. Mølmer, Physical Review A 102, 023717 (2020).
  45. [45]N. Tezak, A. Niederberger, D. S. Pavlichin, G. Sarma, and H. Mabuchi, Philosophical Transactions of the Royal Society A 370, 5270 (2012).
  46. [46]GitHub repository of QNET, https://github.com/machulab/QNET (2026), accessed: November 16, 2026.
  47. [47]J. Johansson, P. Nation, and F. Nori, Computer Physics Communications 184, 1234–1240 (2013).
  48. [48]K. A. Fischer, R. Trivedi, R. Ramasesh, I. Siddiqi, and J. Vučković, Quantum 2, 69 (2018).
  49. [49]GitHub repository of QuantumInputOutput.jl, https://github.com/qojulia/QuantumInputOutput.jl (2026), accessed: November 16, 2026.
  50. [50]J. Bezanson, A. Edelman, S. Karpinski, and V. B. Shah, SIAM Rev. 59, 65 (2017).
  51. [51]S. Krämer, D. Plankensteiner, L. Ostermann, and H. Ritsch, Computer Physics Communications 227, 109–116 (2018).
  52. [52]A. Mercurio, Y.-T. Huang, L.-X. Cai, Y.-N. Chen, V. Savona, and F. Nori, Quantum 9, 1866 (2025).
  53. [53]D. Plankensteiner, C. Hotter, and H. Ritsch, Quantum 6, 617 (2022).
  54. [54]V. R. Christiansen, A. H. Kiilerich, and K. Mølmer, Physical Review A 107, 013706 (2023).
  55. [55]V. R. Christiansen and K. Mølmer, Physical Review A 113, 013730 (2026).
  56. [56]Documentation of QuantumInputOutput.jl, https://qojulia.github.io/QuantumInputOutput.jl/dev/ (2026), accessed: November 16, 2026.
  57. [57]K. M. Gheri, K. Ellinger, T. Pellizzari, and P. Zoller, Fortschritte der Physik 46, 401 (1998).
  58. [58]J. E. Gough, M. R. James, H. I. Nurdin, and J. Combes, Physical Review A 86, 043819 (2012).
  59. [59]B. Q. Baragiola, R. L. Cook, A. M. Brańczyk, and J. Combes, Physical Review A 86, 013811 (2012).
  60. [60]J. Johansson, P. Nation, and F. Nori, Computer Physics Communications 183, 1760–1772 (2012).
  61. [61]K. Życzkowski, P. Horodecki, A. Sanpera, and M. Lewenstein, Physical Review A 58, 883 (1998).
  62. [62]G. Vidal and R. F. Werner, Physical Review A 65, 032314 (2002).
  63. [63]L. M. Hansen, C. Henke, C. Hotter, O. A. D. Sandberg, T. W. Sandø, V. Angelopoulou, A. Tiranov, C. B. Møller, Z. Liu, L. Midolo, N. Bart, A. Ludwig, P. Walther, C. J. van Diepen, P. Lodahl, and A. S. Sørensen, (2026), arXiv:2605.18525 [quant-ph].
  64. [64]L. Ostermann, C. Meignant, C. Genes, and H. Ritsch, New Journal of Physics 21, 025004 (2019).
  65. [65]R. Holzinger, R. Gutiérrez-Jáuregui, T. Hönigl-Decrinis, G. Kirchmair, A. Asenjo-Garcia, and H. Ritsch, Physical Review Letters 129, 253601 (2022).
  66. [66]M. Fasser, L. Ostermann, H. Ritsch, and C. Hotter, Optica Quantum 2, 397 (2024).
  67. [67]A. Tiranov, V. Angelopoulou, C. J. van Diepen, B. Schrinski, O. A. D. Sandberg, Y. Wang, L. Midolo, S. Scholz, A. D. Wieck, A. Ludwig, A. S. Sørensen, and P. Lodahl, Science 379, 389–393 (2023).
  68. [68]M. Fishman, S. White, and E. Stoudenmire, SciPost Phys. Codebases 4 (2022).
  69. [69]F. Reiter and A. S. Sørensen, Phys. Rev. A 85, 032111 (2012).
  70. [70]J. Dalibard, Y. Castin, and K. Mølmer, Phys. Rev. Lett. 68, 580 (1992).
  71. [71]R. Dum, P. Zoller, and H. Ritsch, Phys. Rev. A 45, 4879 (1992).
  72. [72]S. R. White, Phys. Rev. Lett. 69, 2863 (1992).
  73. [73]F. Verstraete, V. Murg, and J. Cirac, Advances in Physics 57, 143–224 (2008).
  74. [74]R. Orús, Annals of Physics 349, 117–158 (2014).
  75. [75]C. Hotter, O. Ameyé, and K. Mølmer, QuantumInputOutput.jl: A Julia framework for input–output theory with quantum pulses and the SLH formalism, Zenodo 10.5281/zenodo.24171715 (2026).
  76. [76]H. Le Jeannic, A. Tiranov, J. Carolan, T. Ramos, Y. Wang, M. H. Appel, S. Scholz, A. D. Wieck, A. Ludwig, N. Rotenberg, L. Midolo, J. J. García-Ripoll, A. S. Sørensen, and P. Lodahl, Nature Physics 18, 1191–1195 (2022).
  77. [77]S. Arranz Regidor, M. Kozma, and S. Hughes, Physical Review Research 8, 033260 (2026).

Paper details

vlnc:W_2wmgeshp
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Physics and Astronomy

Not recorded for this paper

View statement
Looking for related papers…
Contents