Photon-Mediated Quantum Gate between Two Trapped Neutral Atoms in an Optical Cavity

Quantum logic gates are fundamental building blocks of quantum computers. Their integration into quantum networks requires strong qubit coupling to network channels, as can be realized with neutral atoms and optical photons in cavity quantum electrodynamics. Here we demonstrate that the long-range interaction mediated by a flying photon performs a gate between two stationary atoms inside an optical cavity from which the photon is reflected. This single step executes the gate in $2\,\mathrm{\mu s}$. We show an entangling operation between the two atoms by generating a Bell state with 76(2)% fidelity. The gate also operates as a CNOT. We demonstrate 74.1(1.6)% overlap between the observed and the ideal gate output, limited by the state preparation fidelity of 80.2(0.8)%. As the atoms are efficiently connected to a photonic channel, our gate paves the way towards quantum networking with multiqubit nodes and the distribution of entanglement in repeater-based long-distance quantum networks.

Quantum logic gates are basic building blocks of quantum information processing protocols [1,2]. They have been implemented with different qubit carriers like ions [3,4], atoms [5,6], photons [7,8], solid-state spins [9] and superconductors [10]. For the construction of a large-scale quantum network [11], however, interfaces are needed that combine the processing capabilities of these quantum gates with an efficient connection to optical channels. An ideal platform for this is provided by neutral atoms in an optical cavity. The enhanced light-matter interaction in this system allows for a strong coupling of the atomic matter qubits to flying photonic qubits. The implementation of a quantum gate inside such a multiqubit node, as demonstrated here, has been a long-standing goal as it adds the capacity for local quantum information processing to the network nodes.
Our gate demonstrates a functional quantum device that has distinct advantages. First, it employs a flying photon and is thus readily integrated in a distributed quantum network. Second, it requires only one physical step and is thus fast, 2 µs in our case. Third, the reflected photon acts as a herald to recoup experimental losses in the otherwise deterministic protocol [12,13]. Last but not least, it is independent of the type of qubits and could also be implemented with ions, diamond-defect centers, superconducting qubits, or possibly even a combination of these. Our gate might therefore become a valuable tool in a future quantum networking architecture based on any of these platforms. For instance, it could serve as a Bell-state analyzer for swapping and distributing entanglement in a quantum repeater [14] based on memory qubits in optical cavities [15].
Two 87 Rb atoms are trapped at antinodes of the resonant cavity field and are individually observed with a microscope. The relevant cavity QED parameters are (g, κ, γ) = 2π (7.8, 2.5, 3) MHz, where g denotes the single atom-cavity coupling rate, κ the cavity field decay rate and γ the atomic polarization decay rate [16]. These parameters place our atom-cavity system in the strong coupling regime [17]. Each of the atoms carries a qubit encoded in two stable hyperfine states |↑ = 5 2 S 1/2 |F=2, m F =2 and |↓ = 5 2 S 1/2 |F=1, m F =1 . The atomic state |↑ is strongly coupled to the cavity light field via an optical transition |↑ ↔ |e = 5 2 P 3/2 |F =3, m F =3 , whereas |↓ is not. If none of the atoms couples to the light field, a resonant single photon reflected from the atom-cavity system can enter the resonator before leaving through the outcoupling mirror. This induces a πphase shift in the combined atom-photon state [12,13,[18][19][20]. Any strongly coupled atom causes a normal-mode splitting, governed by the Tavis-Cummings Hamiltonian, such that an impinging photon does not fit spectrally into the cavity. In this case, the photon is directly reflected from the outcoupling mirror and the atom-photon state acquires no phase shift. This effect realizes a two-atom controlled-Z gate [1]: Qubit rotations are performed via a pair of Raman lasers which copropagate perpendicular to the cavity axis and illuminate both atoms equally. The Raman lasers are linearly polarized along and perpendicular, respectively, to the cavity axis which serves as a quantization axis. We perform arbitrary global qubit rotations by controlling the pulse duration, detuning and phase. The experimental sequences described hereafter are started after a successful loading of two atoms with distance 2 ≤ d ≤ 12 µm. This allows us to limit the spread of Rabi frequencies for different interatomic distances and thus increases the average fidelity of the gate. The center of mass of the two atoms is actively positioned to overlap with the center of the Raman beams. More details of the experimental setup are given in Appendix A.
Experimentally, we quantify the performance of our twoatom quantum gate with two key operations which demonstrate its functionality: the creation of a maximally entangled output state from a separable input state as well as the controlled-NOT (CNOT) operation on a set of four basis states, in our case the Bell states.
At the start of each experiment, the atomic qubits are initialized through optical pumping and optionally subsequent coherent state rotations and quantum state carving [21,22]. In this way, we initially prepare |↓↓ or one of the four Bell states for our gate characterization measurements. Details of the inherently probabilistic carving technique for the preparation of the Bell states are given in Ref. [22]. To execute the gate, we impinge a weak coherent pulse (mean photon number n = 0.13) and herald the presence of a photon through its detection with a conventional single-photon counter after the reflection.
Following each gate operation, the resulting two-atom state is read out by resonantly probing the cavity transmission and the atomic fluorescence, with a global atomic π rotation in between. This allows us to distinguish between the states |↓↓ , |↑↑ and the set {|↑↓ , |↓↑ } in each experiment. A detailed description of the state detection protocol can be found in Appendix B.
Repeated measurements of identically prepared states yield the state populations P i j as probabilities to find the first atom in the state |i and the second in | j with i, j ∈ {↑, ↓}. They constitute the diagonal elements of the two-atom density matrix ρ as ρ ↑↑,↑↑ = P ↑↑ , ρ ↓↓,↓↓ = P ↓↓ and ρ ↑↓,↑↓ +ρ ↓↑,↓↑ = P ↑↓ +P ↓↑ . Furthermore, the relevant off-diagonal elements of ρ are obtained using the method of parity oscillations [23,24]: To this end, the populationsP i j (φ ) are determined after an additional π/2 pulse of varying phase φ relative to all previous rotation pulses. The parity Π, defined as Π(φ ) :=P ↑↑ (φ )+P ↓↓ (φ ) − [P ↑↓ (φ )+P ↓↑ (φ )], is evaluated for each value of φ . Analytically, Π(φ ) = 2 Re(ρ ↑↓,↓↑ ) + 2 Im(ρ ↑↑,↓↓ ) sin(2φ ) + 2 Re(ρ ↑↑,↓↓ ) cos(2φ ) and, therefore, coherence terms of the density matrix can be extracted from a fit to the measured parity data. This set of parameters gives sufficiently many, linearly independent parameters to determine the fidelities of the produced states with the four states of a FIG. 2. Parity oscillations and populations of the entangled state produced by the gate and a subsequent π/4 rotation. The populations P ↑↑ (blue squares),P ↑↓ +P ↓↑ (red circles) andP ↓↓ (green diamonds) oscillate as a function of the phase of the analysis pulse φ , which is scanned from 0 to 2π. They yield the parity Π(φ ), which we fitted with a sine of variable offset, phase and amplitude. The values for the populations P on the right-hand side come from a measurement without an analysis pulse. The overlap with the maximally entangled state |Φ − inferred from this data is F = 76(2)%. Error bars are statistical standard deviations of the mean within each bin. The slight offset in the phase is due to a residual two-photon Raman-laser detuning of ±3 kHz.
The entangling operation shows that the gate has an entangling capability [26] of C ≤ −0.26(2) (statistical), given by the smallest absolute negativity of any possible state with our determined density matrix entries. An ideal entangling gate has C = −0.5, whereas any nonentangling gate has C = 0.
The fidelity's deviation from unity is well explained by known error sources. To this end, we model the atom-cavity system using input-output theory and treated the two-atom state using its density matrix (see Appendix C). The calculation shows the effect of the different experimental imperfections on the measured fidelity. They are listed in Table I. The biggest error of 6% stems from an imperfect transversal mode matching (92%) of the impinging photon to the cavity mode. In the noncoupling case, the phase flip in the atomatom-photon state does not occur and no entanglement is generated despite the heralding event. The second-most important source of error is the final state detection. The Poissonian distributions of detected photons for coupled and noncoupled atoms, respectively, have an overlap of 2% for the state detection in transmission and 3% for the state detection in fluorescence. With the two required state-detection intervals this error enters twice and causes a 4% reduction in fidelity. The use of coherent pulses instead of single photons creates an 8% chance to have two or more photons reflected despite detecting only one. Then the second photon reverses the gate and reduces the total fidelity by 3%. The cavity itself has only a finite cooperativity, which results in a finite probability of photon scattering from the mirrors or atoms or transmission through the cavity instead of backreflection, thereby leaking information about the atomic state into the environment. This is the most fundamental source of errors, which is given by our choice of atomic states and mirrors. It causes a reduction in fidelity by 3%. Other sources of error such as dark counts, dephasing, state preparation, fluctuating parameters, and inaccuracies are in the 1% range.
The second benchmark measurement is given by the operation as a CNOT logic gate. Such a gate leaves two of the four input basis states unaffected, whereas the other two are interchanged. A conventional choice to perform this measurement is the basis {|↑→ , |↑← , |↓→ , |↓← }, where |→ = 1 √ 2 (|↑ + |↓ ) and |← = 1 √ 2 (|↑ − |↓ ). However, we want to employ a simple addressing scheme that avoids the necessity to discriminate between the two atoms during state preparation and state detection. Therefore, we use the global Bell basis states |Ψ − , |Ψ + , |Φ − , |Φ + as an input. In this basis, the gate operation swaps the states |Φ − and |Φ + : (3) Using the Bell states does not only prove the ability of our gate to act as a CNOT but also demonstrates its capability to accept entangled input states and to preserve their quantum features. Experimentally, we prepare each of the four input Bell states with the method of quantum state carving [21,22] and achieve an average state preparation fidelity of 80.2(0.8)% [ Fig. 3(a)]. To perform the carving operation, we initially pump the atoms into a parallel (|↓↓ ) or an antiparallel configuration (|↓↑ , |↑↓ ). The initial pumping into the parallel configuration allows us to generate the triplet states |Φ + , |Φ − , or |Ψ + while the antiparallel initial states allow us to generate the singlet state |Ψ − . After the pumping stage, both atoms are transferred into an equal superposition state with a π/2 pulse. We then reflect an antidiagonally polarized photon from the cavity, which changes its polarization to diagonal if there is at least one coupling atom in the cavity. A polarization resolved measurement of this photon after the reflection allows us to remove (i.e., carve) the |↓↓ component from the combined atom-atom state. Two of these carving steps enable the generation of all maximally entangled states to be used as an input for our quantum gate operation. Having performed the gate via the reflection of the gatetriggering photon, the output is again characterized in the Bell basis [ Fig. 3(b)] through parity oscillations (Appendix D). The combined sequence for this measurement is described in more detail in Appendix B.
From the experiment, we find an average overlap with an ideal CNOT truth table of 74.1(1.6)%, which is 92.3(2.2)% of the input state fidelity. For |Ψ + and |Ψ − , the output does not differ significantly from the input and the gate behaves as the expected identity operator. In contrast, the gate performs the anticipated NOT operation on |Φ + and |Φ − , which is an exchange of their populations. Similarly to the entangling gate operation, the reduced fidelity after the CNOT operation mainly results from two-photon contributions in the impinging light pulse and from gate photons that did not match the cavity mode.
In 4.2% of all experimental runs, we detect one photon in the reflected weak coherent laser pulse (n = 0.13). The probability to lose a photon in the gate process is determined by the reflectivity of the cavity on resonance. In both the coupling and the noncoupling case, this reflectivity amounts to 67% leading to a loss of 33% of the photons. The reflected photons are detected with an efficiency of 55%. This detection is used to herald the gate operation. The probability to pump an atom into a state outside of the qubit state space can be approximated as 2.4 × 10 −4 and mainly results from polarization imperfections due to cavity birefringence and off- Unity efficiency could be achieved with an external singlephoton source, thus avoiding the need to postselect on a heralding event. For such an ideal input, with all other parameters left the same, we infer from our simulation in Ap-pendix C that the gate would still achieve a fidelity of 68%. Our cavity system is then able to perform deterministic gate operations and create entangled atom pairs on demand. The fidelity reduction by 8% mainly stems from the possibility to lose the photon in the cavity and transport information about the individual atomic states into the environment. On the positive side, the loss of fidelity is mitigated by the absence of zero-and multiphoton events. Thus, if a single-photon source is used together with heralding, the fidelity would get as high as 82% at a heralding efficiency of 32%, much higher than with the weak-coherent input.
To conclude, we demonstrate the quantum functionality of a novel two-atom gate that is mediated by a single optical photon. The gate can be readily extended to implement hybrid atom-atom-photon gates such as the Toffoli, since the photon can carry a polarization qubit with a state-dependent atom-photon interaction strength [17]. The long-range nature of the mediating optical field allows for an extension to onestep multiqubit gates on several atoms simply by placing more atoms into the same cavity mode [13]. This could lead to further applications like an error-correction scheme with three atoms [27]. With an additional single-atom addressing system to shift individual qubits in and out of resonance, our gate could function as a building block for larger quantum circuits within one cavity. Individual atomic qubits from a larger ensemble could further be mapped from and onto flying photons with the scheme of Ref. [28], with one atom tuned into resonance during each reflection.
As the gate is implemented in a system that is ready to serve as a quantum network node [29,30], it provides a way towards distributed quantum computing through photonic links.
Our demonstrated gate mechanism does not rely on the specific platform of neutral 87 Rb, but could equally well be applied to many other types of natural and artificial atoms. For example, it could be implemented with superconducting qubits inside microwave cavities [31] where many of the required techniques are available. This could establish a new protocol for small-scale quantum networks in solid-state systems, with microwave photons released from one node executing gates in potentially several others. Two 87 Rb atoms are trapped at the center of a singlesided, high-finesse (F = 6×10 4 ) cavity of length 0.5 mm and mode waist 30 µm. The atoms are trapped in a threedimensional optical lattice potential [16] and cooled to temperatures of ≈ 100 µK via a Sisyphus cooling technique. Employing a piezo crystal, the cavity is tuned into resonance with the atomic D 2 transition 5 2 S 1/2 |F=2, m F =2 ↔ 5 2 P 3/2 |F =3, m F =3 at 780 nm. We encode the atomic qubits in the hyperfine ground states |↑ = 5 2 S 1/2 |F=2, m F =2 and |↓ = 5 2 S 1/2 |F=1, m F =1 . The two qubits are controlled via a pair of Raman lasers which drive the |↑ ↔ |↓ transition coherently. Both beams impinge from the same direction, orthogonally to the cavity axis. Their beam waist of w 0 = 35 µm is much bigger than the interatomic distance d, such that both atoms are controlled identically.
We have two different projective readout techniques, which are used for state preparation and state detection. Both yield the same information, namely whether at least one atom couples to the cavity, or none (|↓↓ ). One technique is probing the cavity transmission through the high-reflectivity mirror. The transmission of light resonant with the |↑ ↔ |e transition is strongly suppressed if any atom is in the coupling state |↑ compared to |↓ , due to a normal-mode splitting. In the second technique, we illuminate the atoms with a resonant beam impinging orthogonally to the cavity axis. Any atom in |↑ will scatter fluorescence photons into the cavity mode and the light can be collected with single-photon counters. The fluorescence technique yields a readout with higher fidelity, but it can remove atoms in |↑ from the qubit subspace, which prohibits its application at intermediate stages of the sequence. Figure 4 shows a quantum circuit diagram of the full experimental sequence. In order to characterize the gate, which consists of only one experimental step, we need to provide several defined input states and measure the gate output in different bases. Here, we explain the various steps which are part of the experiment, additionally to the gate itself.

Atomic state preparation
87 Rb has several stable 5 2 S 1/2 ground states, which are outside of the qubit space but may be populated at the beginning of an experiment. Therefore, we start with optical pumping of the two atoms into the qubit manifold using resonant, rightcircularly polarized laser light along the cavity axis, which also is our quantization axis defined by a small magnetic guiding field. The state |↑ = |F=2, m F =2 connects only to a cycling transition and thus accumulates the whole population. However, once an atom is in |↑ , it strongly reduces the intracavity pump light via a normal-mode splitting and will ham-per the preparation of a second atom. To realize a state with both atoms in a parallel state |↑↑ nevertheless, we detune the atomic resonance from the cavity, using the dynamical Stark effect of the trapping laser during the optical pumping process. To herald a successful preparation of both atoms, we employ a global π pulse, perform a state detection in fluorescence and postselect on those cases in which no fluorescence photons are detected. This results in an effective preparation of the state |↓↓ . The incoherent mixture of two-atom states with density matrix ρ = 1 2 (|↑↓ ↑↓| + |↓↑ ↓↑|) can be prepared by resonantly pumping a first atom to the strongly coupled state |↑ , followed by a π pulse to |↓ and another resonant pumping sequence for the second atom. The proper preparation of this incoherent mixture is verified by two state detections in transmission with an interleaved π pulse. If a low transmission is observed in both state-detection intervals, the antiparallel state preparation has been successful.

Bell basis generation
The next step in the experiment is the preparation of Bell states, which we use to demonstrate the CNOT operation. Starting from an initial preparation of the state |↓↓ , the triplet Bell states |Ψ + and |Φ ± can be generated by quantum state carving [22]. For this, two antidiagonally polarized photons (state |A ) are subsequently reflected from the cavity with a global π rotation of the atoms in between. A photon polarization change to |D (diagonal) heralds that at least one of the atoms is in |↑ and therefore couples to the cavity. A postselection on the flipped cases carves |Ψ + out of an initially separable coherent spin state. Afterwards, global π/2 pulses around different axes are used to generate |Φ ± states from |Ψ + . When starting with an antiparallel mixture initially, the same sequence generates the |Ψ − singlet state. In contrast to the quasideterministic entangling operation of our demonstrated gate, this preparation of Bell basis states through carving is inherently probabilistic.
After the gate input |Ψ In preparation, the atom-atom gate operation is executed by reflecting a right-circularly polarized photon from the cavity, as explained in the main text. The gate entangles a separable 1 2 (|↑↑ − |↑↓ − |↓↑ + |↓↓ ) input, leaves the |Ψ ± states untouched and interchanges the |Φ ± states.

State analysis rotation
The gate output |Ψ Out needs to be analyzed for populations and coherences. To access the latter, we employ the method of parity oscillations [23,24], as explained in the main text, where an optional analysis pulse of pulse area π/2 with a variable phase of φ is applied on both qubits identically. This rotation turns coherence terms into populationsP i j (φ ), which can be evaluated by fitting of a theoretical model.

State detection
The final readout of the two-atom output state is performed by a sequence of two state detection pulses with an interleaved π-rotation. The first state detection probes the cavity transmission and allows to distinguish |↓↓ from {|↑↓ , |↓↑ , |↑↑ }, as states with at least one coupling atom lead to a strong re-duction of the cavity transmission. Employing a π-rotation, an initial |↑↑ state is subsequently transferred into |↓↓ and can be discriminated from the set of remaining states via the second state detection performed in fluorescence. This double state detection protocol allows to distinguish the states |↓↓ , |↑↑ and the set {|↑↓ , |↓↑ }.
|""i |##i  4. Complete quantum circuit diagram depicting initialization, preparation of Bell basis states, the two-atom gate, analysis state rotation and final state detection. Rotations (R) have a subscript indicating the rotation axis x (|↑ + |↓ ) or y (|↑ + i|↓ ) and a superscript denoting the rotation angle. The two techniques for state detection are labelled transmission and fluorescence, respectively. Whenever the result of an atomic state detection or a photon polarization measurement does not yield the desired result (OK), the protocol is restarted from the beginning. Initialization with parallel states allows to prepare the triplet Bell states |Ψ + and |Φ ± as gate input. The singlet state |Ψ − is prepared after initialization with an incoherent mixture of antiparallel states described by a density matrix 1 2 (|↑↓ ↑↓| + |↓↑ ↓↑|). The photon reflection with an antidiagonal (|A ) polarization realizes a Toffoli gate with an inversion of the photonic qubit. Experimentally, this means that the polarization of the reflected photon is flipped to |D in all cases except the one where both atoms occupy |↓ . The dashed box in the Bell basis generation section is optional and only needed when transforming |Ψ + to |Φ ± . Various two-atom states |Ψ In are prepared as gate input, then processed by the two-atom gate and the result |Ψ Out is characterized by state detection in a two-atom basis set by a preceding analysis rotation. The dashed box in the analysis section is optional. For a measurement of the populations P i, j it is omitted while for a measurement of the populationsP i, j , with i, j ∈ {↓, ↑}, it is applied.

Timing
A π pulse in the experiment has a duration of 8 µs. The photons have a Gaussian intensity profile with a full width at half maximum of 0.9 µs, such that the phase-shift mechanism works reliably (see supplementary material of ref. [28] for details). We work with an average impinging photon number of n = 0.33 for each of the two |A pulses in the state preparation, which was found to lead to high fidelities in the state-preparation [22]. For the right-circularly polarized gate photon |R , we use a lower average photon number of n = 0.13 to further suppress multiphoton contributions. The state-detection intervals have a length of 5 µs and 3 µs for a state detection in fluorescence and a state detection in transmission, respectively (see Fig. 4). We repeat the protocol of length ≈ 70 µs at a rate of 1 kHz with laser cooling intervals of 0.7 ms. The actual time to perform the gate is given by the length of the gate photon whose full width at half maximum is below one microsecond.

APPENDIX C: THEORETICAL CALCULATION OF THE GATE FIDELITY
The gate operation can be modeled using the density matrix formalism. First we describe the effect of one reflected photon on the atomic density matrix and then we add all other imperfections of the experiment.
Generally, this constitutes an atom-atom-photon entangled state, but the photon gets absorbed immediately afterwards.
In the case that a reflected photon is detected in |p r (heralding), the final atomic state is given by ρ herald a,out · N = p r |ρ a,p |p r = ρ a • (( ( (r(2), r(1), r(1), r(0)) ) ) † · ( ( (r(2), r(1), r(1), r(0)) ) )) =: ρ a • G herald where • is the element-wise product and N = Tr(ρ a • G herald ) is the normalization factor. Here the diagonal elements of G herald indicate the probability of a heralding event (for unity detection efficiency), which depends slightly on the atomic state. The persisting minus-signs in the fourth row and column are a characteristic of the controlled-Z gate.
If no heralding is applied and the atomic state is accepted for any final photonic mode, the photonic state has to be traced out: ρ total a,out = Tr p In this case, only off-diagonal elements are reduced, as a result of the decoherence from the photon leaking information into the environment.

Fidelity of the two-atom entangling operation
The initial atomic state for our entangling operation is ρ a,in = |a in a in | with |a in = 1 2 (|↑↑ − |↑↓ − |↓↑ + |↓↓ ). Reflecting a single photon without heralding applies the operator (C9) ρ total a,out = ρ a,in • G total . Without further imperfections the entangled state fidelity would thus be When the reflection of a single photon is heralded, the operator G herald (C8) is applied, and the resulting density matrix must be normalized ρ herald a,out = ρ a,in • G herald / Tr(ρ a,in • G herald ). In this case, the fidelity is close to unity, as the only remaining imperfection is the slightly differing reflection probability for each number of coupling atoms.
In the actual experiment we employed weak coherent pulses with a mean photon numbern = 0.13, which are superpositions of Fock-states |n with a Poissonian distribution P(n) = n n /n! · e −n . To model the evolution of the atomic state, we averaged the density matrix over all possible combinations of cavity-coupled and non-coupled photons as well as detector dark counts. Each case was weighted with the corresponding posterior probability to receive one heralding click in the photon detector. In case of a dark count without impinging photon the atoms remain in the input state having 25% overlap with the anticipated entangled state. If one photon is reflected, the operations (C8) or (C9) apply, depending on whether the photon gets lost in the process. If several photons are reflected, the operators are applied multiple times, leading to an increased decoherence.
Considering our total photon detection efficiency of 46% (including 55% efficiency of the single-photon detector), a dark-count rate of 0.2% per pulse and no additional imperfections apart from the cavity, we obtain an entangled state fidelity of 91.1% for an impinging weak coherent pulse with n = 0.13. In the following we include the known significant sources of errors, which are listed in Table I, in our simulation. The main sources of error are imperfect mode matching of the incoming photons to the cavity (92% overlap) and imperfect state detection of the atoms (3% of all experiments). Multiphoton contributions are present in 8% of all pulses that lead to a heralding event. The error introduced by loosing a photon in the cavity is determined by Eq. (C8) and in case of dark counts by Eq. (C9). We estimate the photon polarization to be accurate to 1%. The atomic state preparation was wrong in around 1% of all cases and their decoherence during 14 µs between preparation and readout is around 1% as well. With these errors the simulation yields an entangled state fidelity of 77%, which is fits well with the measured value of 76(2)%. By switching each source of error on and off in the simulation, we determined its influence onto the fidelity. The results are listed in Table I in the main text.

Expected entangled-state fidelity employing a single-photon source
All presented experiments were performed with weak coherent pulses. This lowers the overall efficiency due to necessary post-selection on single-photon detections and leads to fidelity reductions caused by the admixture of higher photonnumber states and dark count events. As this limitation is not intrinsic to the gate scheme and could be overcome in the foreseeable future, it is worthwhile to estimate the fidelity of the atom-atom gate that could be achieved by employing an ideal external single-photon source.
Replacing the weak coherent pulses by true single photons, the density matrix calculation with the known sources of fidelity reductions (Table I) can be applied in the same way, only without the additional summing over different input photon numbers. With single photons and the heralding still applied, the fidelity would then increase from 76% to 82% and the efficiency would jump from 4.2% to 32%. The latter is the reflection, coupling and detection efficiency of a photon. The main improvement in fidelity would be through the elimination of multiphoton contributions. Fidelity reductions from photon loss in the cavity would play only a negligible role [0.3%, Eq. (C11)] because the heralding ensures that the one impinging photon must have survived. The remaining infidelities are mostly due to the imperfect optical mode matching and the final state detection of the atoms.
With a single-photon source, the heralding could be dropped altogether, making the gate fully deterministic with an efficiency of 100%. In this case our experimental imperfections would lead to a fidelity of 68% according to the simulation. Thus without heralding the efficiency would increase by a factor of three while the fidelity would only drop by 14%, because there is a considerable probability that the gate worked perfectly even if the inefficient photon detector didn't yield a click. The dominating source of errors would be the photon loss within the cavity [Eq. (C10)]. Additional errors are predominantly the optical mode matching and the imper-fect state detection. The total fidelity of 68% is lower than the measured fidelity for heralded weak coherent photons, but it is still significantly above the classical threshold of 50%.

APPENDIX D: EVALUATION OF THE TRUTH TABLE MEASUREMENTS
In our gate characterization measurement for the controlled-NOT (CNOT) operation, we use the Bell basis states |Ψ ± and |Φ ± as input, prepared as detailed in FIG. 5. Parity signals of input and output states of the CNOT gate. The left column shows Π(φ ) for all four prepared Bell states used as input states for the gate. The right column shows the respective parity signals after the gate. While the states |Ψ ± remain basically unchanged by the gate operation, one can observe the swap |Φ ± →|Φ ∓ as a π/2 phase flip in the respective parity oscillation signal. Error bars are statistical standard errors of each data point. The solid lines are fitted sine curves with free offset, amplitude and phase, which are used to compute the fidelities. the preceding section. The gate is expected to produce Bell states as output. The fidelities of our measured states with the ideal ones, depicted in Fig. 3, are determined from average state populations P ↑↑ , P ↑↓ + P ↓↑ and P ↓↓ and parity oscillations Π(φ ). These parity oscillations are recorded after a common π/2 rotation on both atomic qubits with a rotation axis determined by the relative phase φ to previous rotations, which we imprint on the Raman laser beams. A population measurement after such an analysis pulse reveals coherence properties of the two-qubit state. This can be seen from the analytical expression of the parity as a function of φ : Π(φ ) =P ↑↑ (φ ) +P ↓↓ (φ ) − P ↑↓ (φ )+P ↓↑ (φ ) = 2 Re(ρ ↑↓,↓↑ ) + 2 Re(ρ ↑↑,↓↓ ) cos(2φ ) + 2 Im(ρ ↑↑,↓↓ ) sin(2φ ) The information about the respective populations and coherences is sufficient to determine the fidelities with each of the four Bell states according to Eq. (2): F(|Ψ − ) = 1 2 (P ↑↓ + P ↓↑ ) − Re(ρ ↑↓,↓↑ ) F(|Ψ + ) = 1 2 (P ↑↓ + P ↓↑ ) + Re(ρ ↑↓,↓↑ ) F(|Φ − ) = 1 2 (P ↑↑ + P ↓↓ ) − Re(ρ ↑↑,↓↓ ) F(|Φ + ) = 1 2 (P ↑↑ + P ↓↓ ) + Re(ρ ↑↑,↓↓ ).
(D2) Figure 5 shows the recorded parity oscillations for the twoatom states before and after the gate, and Table II lists the state populations and resulting fidelities that produce the bar plots depicted in Fig. 3.