Demonstration of universal time-reversal for quantum processes

Although the laws of classical physics are deterministic, thermodynamics gives rise to an arrow of time through irreversible processes. In quantum mechanics the unitary nature of the time evolution makes it intrinsically reversible, however the question of how to revert an unknown time evolution nevertheless remains. Remarkably, there have been several recent demonstrations of protocols for reverting unknown unitaries in scenarios where even the interactions with the target system are unknown. The practical use of these universal rewinding protocols is limited by their probabilistic nature, raising the fundamental question of whether time-reversal could be performed deterministically. Here we show that quantum physics indeed allows for deterministic universal time-reversal by exploiting the non-commuting nature of quantum operators, and demonstrate a recursive protocol for two-level quantum systems with an arbitrarily high probability of success. Using a photonic platform we demonstrate our protocol, reverting the discrete time evolution of a polarization state with an average state fidelity of over 95%. Our protocol, requiring no knowledge of the quantum process to be rewound, is optimal in its running time, and brings quantum rewinding into a regime of practical relevance.


I. INTRODUCTION
In the macroscopic world there is an apparent unidirectionality of processes in time, which stands in contrast to the time-reversal symmetric nature of the underlying laws of physics. This tension was first pointed out by Eddington, who coined the term 'arrow of time' to describe the asymmetry [1]. In classical physics an arrow of time emerges through the second law of thermodynamics, giving rise to processes which cannot be reversed [2]. Due to the statistical nature of the law, and the determinism of classical physics, the irreversibility is not fundamental. Indeed, for classical wave mechanics it is well known that the time-evolution of a system can be reversed without any knowledge of the dynamics through a technique called phase conjugation [3,4]. In the microscopic quantum realm, however, the ability to perform phase conjugation becomes limited by fundamental quantum noise [5], due to the non-unitary nature of the process. It has therefore remained an open question whether or not the dynamics of quantum systems can be reversed in a universal manner.
Recently there have been several works addressing this question, in which probabilistic protocols for 'rewinding' quantum systems were presented [7,8] and demonstrated in a lab setting [9,10]. These protocols work independently of both the free Hamiltonian guiding the time evolution of the system in question, and the system's interaction with the experimental apparatus. A major drawback of the protocols in [8] is that they suffer from low success probabilities, typically on the order of 10 −3 . The scheme in [7], on the other hand, allows for a form of Figure 1. (a) In the classical world there is an unmistakable directionality to time, illustrated here through the process of ageing; a process which cannot be reversed in practice despite its deterministic nature. In this paper we show that these same limitations do not apply in the quantum realm. (b) The unitarity of quantum mechanics guarantees that an inverse of a given time evolution U always exists, even though it may be unknown. (c) By letting a target quantum system into pass through an interaction region, a perturbed time evolution V can be realised. (d) A quantum SWITCH makes the target system evolve in a superposition of its free evolution U and perturbed evolution V . This superposition of time evolutions can be used to 'rewind' the system backwards in time, without requiring any knowledge about either U, V or the state |Ψ . error correction, whereby the protocol can be repeated when it fails. However, it is not known whether these feed-forward corrections can boost the success probability arbitrarily close to one. Moreover, the protocol cannot rewind a target system in 'real-time', instead taking three units of time for every one rewound.
More traditional methods to rewind a quantum system with an unknown free Hamiltonian, such as the refocusing techniques used in nuclear magnetic resonance [11,12], require the ability to implement controlled operations that are specifically tailored to the target quantum system, and are therefore not universal.
The work of [13] combines both quantum theory and arXiv:2205.01122v1 [quant-ph] 2 May 2022 (d) A full interferometric implementation of the single-step protocol, which succeeds whenever the photon, in which the target state |Ψ is encoded, exits both quantum SWITCHes in the commutator port (blue arrow). Detecting a photon in the anticommutator port (grey arrow) heralds a failure of the quantum SWITCH. (e) Adaptive error correction for achieving an arbitrarily high probability of success. This entire diagram replaces a single quantum SWITCH in (d). Instead of detecting the failure mode of the quantum SWITCH the photon is made to re-interfere with itself. Whenever it exits in the bottom right the commutator [U, V ] will have been applied (see [6]) The dashed path represents recursive applications of the diagram, through which the success probability can be made arbitrarily high, while the darker shaded area indicates the additional quantum SWITCHes needed.
general relativity to devise a 'time translator', capable of rewinding or fast-forwarding quantum systems. While this method can time-translate any quantum system, it has two drawbacks: (1) it only works approximately, and under a restriction on the free Hamiltonian of the target; (2) if we demand a reasonable precision, the probability of success of the process becomes astronomically small. In this paper we demonstrate a novel universal timereversal protocol ( Fig. 1) for which the success probability can be made arbitrarily high, making it, in effect, deterministic. At its heart, the protocol is based on the non-commutativity of quantum operators, a core concept in quantum mechanics. This conceptual simplicity, which translates directly into a straight-forward implementation in the lab based on the recently developed quantum SWITCH [14,15], allows us to overcome the limitations of previous proposals.
More specifically, the utilization of quantum SWITCHes allows us to time-translate the unknown internal degree-of-freedom of a target system by setting the target system on a superposition of different trajectories. For some of these trajectories, the free evolution U of the target's internal degree-of-freedom is perturbed by an unknown but repeatable interaction, which induces an evolution V on the target. This perturbation can be achieved by any physical interaction and thus can be applied to every possible quantum system. We make these trajectories sequentially interfere in such a way that the final state of the target's internal degree-of-freedom is propagated by U −n , for some positive n, independently of the operators U, V . Each quantum SWITCH requires a projection of the target system's path degree-of-freedom to induce the desired superposition of time evolutions. An advantage of our scheme is that even in the event that the projection fails, a simple and repeatable error-correction procedure can be applied, yielding an arbitrarily high success rate, as long as [U, V ] = 0. It is also worth emphasizing that the protocol runs in 'real-time', meaning that the time it takes to rewind the system is equal to the amount of time to be rewound, aside from a bounded overhead.
We demonstrate the universality of our protocol by running it on a large set of different time evolutions. Our demonstration utilizes a quantum photonics platform with control of path and polarization degrees of freedom of single photons. We generate a discrete time evolution of a single photon by implementing a 'polarization Hamiltonian' using a combination of half-and quarter-wave plates. A superposition of time evolutions is achieved via an interferometric quantum SWITCH [14,15] in which the propagation direction defines the order of the evolutions U and V . Our setup uses two fast optical switches that allow the quantum SWITCH to be accessed several times.

II. THE PROTOCOL
In this section we will give a description of how the rewinding protocol works in a photonic setting, the basic steps of which are illustrated in Fig. 2. An alternative formulation using a scattering scenario is given in the Appendix. A full description, as well as the accompanying proofs, can be found in [6]. Given an unknown target system |Ψ , whose time evolution is described by U = e −i∆T H0 , where H 0 is an unknown Hamiltonian, our goal will be to rewind the system: |Ψ(t = n∆T ) → |Ψ(t = 0) where n is the number of discrete timesteps to be rewound. The basis of our protocol is the following identity: Here U, V are any 2 × 2 matrices, with U being invertible. When the matrix U describes the time evolution of a system, we see that an experimenter able to implement a commutator can reverse the time-evolution, even if U is unknown. The basic protocol is thus as follows: apply the commutator between the time evolution operator U and any other 2 × 2 matrix V , let the system evolve freely for the amount of time to be rewound, then apply the commutator again. The matrix V represents, in the general setting, a time evolution that is perturbed by any repeatable means, for example by bringing the target on a trajectory that leads it through some interaction region. This perturbed evolution can also remain unknown, however the magnitude of the commutator [U, V ] affects the success probability of a single-step attempt to rewind the system. In a photonic setting a commutator can be realized using a quantum SWITCH acting on two degrees-offreedom of a single photon. The control qubit, defining the order of gate operations, is encoded in the photon's path, while the target qubit is encoded in the polarization. The two possible gate orders, U V and V U are superposed by initializing the control in the superposition state (|0 C + |1 C )/ √ 2 and then applying a controlled operation between the control and target systems [15]: By applying a Hadamard gate to the control qubit, one obtains the following state: A measurement of the control qubit now projects the target state onto either the commutator or the anticommutator, where the latter is denoted by {·}. If the measurement outcome of the control qubit is |0 the anticommutator is applied by the quantum SWITCH, but the protocol does not necessarily fail. Instead, the following matrix identities can be used to correct the error: Through recursive application of these identities an anticommutator can always be turned into a commutator. This process can be described using a virtual road map, illustrated in Fig. 2 (e). In [6] some of us prove that when U, V are unitary and [U, V ] = 0 the protocol always terminates in a finite number of steps. Note that for random U, V the probability of the commutator vanishing is zero. We also point out that Eqs. (1),(4),(5) hold even for nonunitary matrices. Remarkably, the protocol can thus be used to rewind for example a two-level system undergoing a continuous decay governed by a non-Hermitian Hamiltonian.
From (1) it can be seen that to rewind a free evolution of time T our protocol runs for T + O(1) units of time, which is asymptotically optimal [8]. In comparison, the protocol demonstrated in [9,10] Figure 4. Experimental setup. A pulsed Ti:sapphire laser pumps a spontaneous parametric down-conversion source to generate pairs of single photons in a type-II process using a ppKTP crystal (top left). The signal photon is directed to the high efficiency superconducting nanowire single-photon detectors (SNSPDs), and a successful detection event triggers an FPGA to initiate a pulse sequence for the EO-switches (see Fig. 3). The approximately 400 ns rise time of the EO-switches is compensated for by three fiber spools, each around 100 m long, adding the needed optical delay. The target state, encoded in the idler photon, is initialized using a state-preparation stage after which it is sent to the quantum SWITCH, realised using a free-space Sagnac interferometer (highlighted in blue). The unitaries U and V are implemented using a combination of halfand quarter-wave plates. Additional waveplates are used in conjunction with the fiber polarisation controllers to compensate unwanted polarisation rotations induced by the fibers and mirrors. Two additional fiber couplers placed inside the Sagnac allow the photons to propagate through U separately. A tomography stage at the output of EO-switch S1 is used to measure the photons' polarization. The CW laser is used during the pre-measurement polarisation compensation procedure. of running time.
The above description of the protocol involves placing the target quantum system in a spatial superposition, however we note that the alternative, but equivalent, description of the protocol provided in the Appendix does not require this.

III. EXPERIMENT
The rewinding protocol described in the previous section is applied to a qubit state encoded in the polarization degree-of-freedom of a single photon, while the path degree-of-freedom of the same photon is used at two points to encode a second qubit which acts as a control system, thereby enabling the application of a commutator through a controlled unitary inside a quantum SWITCH. The photons are generated using spontaneous parametric down-conversion (SPDC). The SPDC process produces pairs of photons denoted signal and idler, the former of which is sent straight to a detector and is used to herald the presence of the idler photon. Upon such a heralding event a trigger signal is transmitted in optical fiber to an FPGA controlling two active electro-optical (EO) switches to permit the idler photon to pass through parts of the set-up multiple times. The active routing of the photons by the EO-switches is shown in Fig. 3, while a detailed schematic of the setup is displayed in Fig. 4.
The unitary Λ i initializes the idler photon into the polarization state |Ψ i chosen from a tomographically complete set, after which an EO-switch (S1) routes the photon into the quantum SWITCH. The unitaries V and U inside the quantum SWITCH are implemented using two sets of three wave plates [16]. Note that there is only one physical realisation of U and V , and they could thus in principle remain unknown without compromising the protocol. Depending on whether the photon exits in the backwards or forwards propagating port of the interferometer either [U, V ] or {U, V } is applied. The backpropagating port corresponding to {U, V } (Fig. 2 c) is disregarded in our implementation, but could be used to increase the success probability of the protocol. Any photon leaving the interferometer in the forward propagating direction passes through a second EO-switch (S2), which traps the photon in a loop allowing it to propagate through U a total of n times. Upon exiting the loop, the photon is directed back to S1 which sends the photon through the quantum SWITCH a second time where [U, V ] is applied once more. Finally, the photon is routed to a quantum tomography stage by S1, where its polarisation is measured. These measurements are then used to construct the density matrix ρ. In a successful run of . For a given Nc the plotted fidelity is averaged over all runs and input states, with a total of 72 samples per point as several pairs of unitaries commute to the same degree. The error bars show the standard deviation of the fidelities, and not the uncertainty in the estimated mean fidelity, which too small to be visible. At high commutativity the experiment becomes more sensitive to several noise sources, such as detector dark counts, background photons and the leakage of the interferometer due to finite visibility, whereas in the regime of high commutativity the fidelity is limited by constant effects such as finite polarization contrast through the setup. (c) Commutativity (Nc) versus the normalised total event count rate for all implementations of V and U . Count rates are normalised to the maximal event rate separately for each n (to account for additional losses at higher n). The rates are averaged over all 4 input states and all 3 runs. n = 1 (circles), n = 2 (rectangles), n = 3 (triangles). Error bars (Poissonian standard deviation) are too small to be visible. The theoretically ideal behaviour, depicted by the solid line, is given by N 2 c and has a quadratic behaviour due to the commutator being applied twice. The biggest deviation from the overall good agreement to the theory appears in the central region of the curve, where the interferometer has a higher sensitivity to noise. the experiment, the state U −n |Ψ i is recorded.

IV. RESULTS
To demonstrate that the performance of the protocol is independent of the initial state |Ψ i , the timeindependent evolution U , the perturbed evolution V , and the number of timesteps n, a large set of combinations of these parameters was realised. More specifically, the unitary operators U and V were chosen from the set: Depending on the choice of p and q the degree to which the operators U, V commute changes. As a measure of the commutativity we define: which is normalized to be one when the unitaries are fully commuting and is equal to the probability of applying the commutator in a single step. For our implementation we select the 50 pairs of U, V for which N c ≤ 0.9. Choosing a finite set of unitaries generated by fixed Hamiltonians, rather than sampling them randomly, allows us to compare our results to those of a classical experimenter given access to the same resources, but who cannot implement quantum superpositions of time evolutions. The optimal strategy for such a classical experimenter is discussed in the Appendix. While polarization rotations implemented by waveplates alone are in general not invariant under counterpropagation, the specific set above is since it does not contain any σ x terms. We can therefore implement all the unitaries in our set using a Sagnac geometry, without the need for time-reversal symmetry breaking elements.
To benchmark the fidelity of the protocol we ran it on the four input states {|H , |+ , |− , |R }, corresponding to horizontally, diagonally, anti-diagonally and righthanded circularly polarized light respectively. This was independently repeated three times for all 50 choices of time evolutions, and for three different sizes of timestep (n = 1, 2, 3), yielding a total of 1800 experimental runs with a combined measurement time of more than 500 hours. In each experimental run full quantum state tomography was performed on the output states ρ, and the fidelity Ψ i | U n ρU −n |Ψ i was calculated. The density matrices of the output states were reconstructed using a maximum likelihood fit [17], and a background contribution originating from the detector dark counts was accounted for using a Monte Carlo simulation, which is how the uncertainties in the fidelities were calculated (see Appendix). The average fidelities for n = 1, 2, 3 were F 1 = (0.94234 ± 0.00023), F 2 = (0.93803 ± 0.00041), F 3 = (0.97336 ± 0.00043). These fidelities, along with the classical bound, are shown in Fig. 5(a); it can be seen that the quantum protocol clearly outperforms the classical strategy, achieving a high fidelity independent of the length of the time evolution.
In our implementation the fidelity of the final state is not fully independent of the choice of U, V . This is due to the fact that for pairs of unitaries that almost commute, photons are most likely to exit in the anticommutator port of the interferometer, which in turn makes the protocol more sensitive to experimental imperfections such as finite interferometric visibility and detector dark counts. In Fig. 5(b) the relationship between the degree of commutativity N c and fidelity is illustrated. The mean fidelity stays at high levels over a broad range of N c ; only when the degree of commutativity approaches 0.9 can a small drop in the fidelity be seen.
Since it is expected that the event rate will drop with increasing values of N c , we verify that out setup produces the correct scaling by comparing N c to our normalized detected photon rate, separately for each n. The comparison is visualized in Fig. 5(c) where good agreement between relative rate and degree of commutativity can be seen. We attribute the undesired variance in rate to imperfect polarisation compensation inside the Sagnac interferometer, as well as phase shifts originating from slight interferometer misalignment. The largest variance is seen in the neighbourhood around N c = 0.5, where the sensitivity to phase noise is highest, due to the sinusoidal relationship between phase and output intensity in an interferometer.

V. DISCUSSION
In this work we have demonstrated a universal timerewinding protocol for two-level quantum systems. Unlike previously proposed protocols, ours can reach an arbitrarily high probability of success and is asymptotically optimal in the time required to perform the rewinding, answering the question of whether or not such processes are permitted by the laws of quantum mechanics. Remarkably, the experimenter performing the rewinding does not need any knowledge about the target quantum system, its internal dynamics or even the specifics of the perturbed evolution. The optimality of the protocol is demonstrated in our implementation, where the total elapsed time (equivalent to the number of applications of U ) grows linearly with the length of time to be rewound, with an optimal proportionality constant of 1. We find that the experimental quantum protocol significantly outperforms the optimal classical strategy in terms of the resulting state fidelity.
We emphasize that our results are not restricted to photonic quantum systems, and would be equally applicable to other platforms. However, our photonic implementation offers a particularly simple and robust approach that utilizes a mature technological platform, in particular for implementing the commutator of the time evolutions through a quantum SWITCH. Given the recent progress in integrated quantum photonics [18,19], we envision that fully monolithic architectures capable of higher fidelity operations will facilitate demonstrations of the active error correction (Fig. 2 (e)) in the near future. Additional follow-up investigations could include non-optical implementations of the protocol as well as extensions to higher dimensions, as described in [8].

COMPETING INTERESTS STATEMENT
The authors have no competing interests to declare.

DATA AVAILABILITY
All data used in the manuscript can be made available upon reasonable request.
Previous proposals for universal time translation [7], [8] are framed in a scattering scenario, where the target system, which sits still in a so-called scattering region, is made to sequentially interact with a number of quantum probes. These probes are prepared in a controlled lab and then released to the scattering region, where they interact with the target in an uncharacterized but repeatable way. As it turns out, the rewinding protocol introduced in the main text can also be realized as a scattering experiment. In the following we explain how this can be achieved.
Our goal is to implement a quantum SWITCH by means of scattered probes, which the experimenter has full control over. The probe system P , together with an ancillary qubit A, are initially prepared in the state: Here |Φ is a state that remains in the lab and does not interact with the target system, while |Ψ represents a probe state that allows the probe to enter the scattering region and interact with the target. We assume that the target system T , in the absence of probes, evolves via the (unknown) free Hamiltonian H 0 . Similarly, when the probe remains in the lab, its evolution is governed by the (known) free Hamiltonian H P . Finally, the interaction between the target and a probe in the scattering region is described by the (unknown) Hamiltonian H I .
Taking the initial state of the target to be |ψ , we let the joint target-probe state |ω AP |ψ T evolve for time ∆T : (A2) where U = e −iH0∆T and W = e −iH P ∆T . Subsequently, we apply the following (probabilistic) operation on the probe system: where |Ξ is any state of the probe with support in the lab. Defining: we can now write the joint state as: Taking advantage of the fact that the probe is now in the state |Φ , i.e. within the lab, we apply the following operation: yielding the state: Letting the probe and target systems evolve for another ∆T units of time and applying (A3) once more results in the state: Since the state of the probe factors out, we ignore it from now on. Finally, we measure the ancillary qubit in the basis |± = 1 √ 2 (|0 ±|1 ). Depending on the measurement result ±, the final state of the target system will be This is an implementation of the quantum SWITCH gate.

Classical strategies
In this section we compute the fidelity of a classical rewinding protocol. We consider an experimenter given access to the same resources as a quantum one. Specifically they can choose to either let the system evolve freely for some length of time, or evolve the system using the perturbed time evolution V . In contrast to the quantum experimenter, the classical one can only implement these evolutions sequentially, not in a coherent superposition. Thus, the most general classical strategy will have the following form: where t j ≥ 0 for all j, and n + n i=0 t i ≤ (4 + n)∆T.
This last condition ensures that the classical protocol does not last longer than the one we have used in the main text. Since we are using waveplates as gates, we have to consider a discretized version of time where each gate consumes ∆T units of time, and thus the most basic rewinding protocol, consisting of implementing [U, V ]U n [U, V ], lasts indeed (4 + n)∆T time units.
Our figure of merit for each n is the average over the fidelities between the final state and the result of rewinding the original state |ψ ∈ S by an amount ∆T n. The classical expression is thus (A10) where P, S are, respectively, the set of pairs of operators (U, V ) and states ψ considered in the experiment.
We numerically maximize this expression in Mathematica, obtaining F c ≈ 0.733713 for n = 1, 2, 3. The optimal classical strategy for these choices of states and gates is to let the system evolve unperturbed for 5.91507 − n units of time. This particular result is a coincidence, since for other choices the optimal is a nontrivial strategy.
The numerical optimization over C implies that the classical experimenter posesses knowlege about the set of unitaries. An experimenter restricted to being ignorant about these sets -a constraint we impose on the quantum experimenter -does not have access to this optimal strategy.

Experimental details 1
Photon pairs centered at approximately 1546 nm are produced in a type-II spontaneous parametric down conversion (SPDC) source based on a periodically poled KTiOPO 4 crystal in a Sagnac configuration [20]. The source is pumped by a mode-locked Ti:sapphire laser (Coherent Mira HP) emitting 2 ps long pulses at 773.1 nm with a repetition rate of 76 MHz.
Two electro-optical (EO) switches (Agiltron NanoSpeed) are used throughout the experiment to route the photons in real time, enabling them to pass through the same part of the setup multiple times.
Upon the detection of a signal photon, the electrical signal created by the detector is split off, with one copy being amplified to TTL levels using a fast comparator, whereupon it is fed into a waveform preserving electrooptical converter outputting an optical pulse at 1310 nm. The optical signal is sent back through the fiber link to the experimental setup, where it gets re-converted to an electrical signal using an opto-electrical converter, and is then received by the FPGA controlling the EO-switches.
The roughly 400 ns rise time of the switches necessitates the use of long fiber delays, which lower the duty cycle of the experiment. These are 519 ns/106 m between the state preparation Λ i and S 1 , 533 ns/109 m between the output of the quantum SWITCH and S 2 , and 760 ns/155 m inside of the U-loop (Fig. 3(b)). The 1.5 dB attenuation per pass through the EO-switches is the main contributor to the overall experimental loss, as the eight passes for n = 3 add up to 12 dB. The non-negligible leakage through the switches of around −13 dB also contributes to some experimental noise. Additional short fiber delays are used to offset the experimental signal in time to ensure that detection events originating from unused photon pairs are not separated from the real signal by an integer multiple of the pump pulse separation of 13.2 ns.
The quantum SWITCH is implemented using a bulk Sagnac interferometer to enable long term phase stability. Additionally, the common path geometry ensures that the polarization unitaries are sampled on the same physical spots on the waveplates for both values of the control qubit. The visibility of the interferometer is measured to be in excess of 0.99 for all the four input polarization states used in the experiment. Polarization-dependent phase shifts from the mirrors inside the interferometer are corrected using multi-order QWPs.
Superconducting nanowire single-photon detectors from Photon Spot, housed in a 1 K cryostat, are used for detection. The typical measured detection efficiencies are around 93 %. An approximately 100 m long optical fiber link separates the detectors from the experiment. Successful detection events are recorded by a time-tagger with 15.625 ps timing resolution.

Experimental details 2
While our SPDC source is able to generate single photons at a rate in excess of 1.5 MHz, many of which cannot be used since a single run of the experiment takes between 2.5 and 4.5 µs. Therefore, the FPGA discards all detection events from heralding (signal) photons when a run of the experiment is still in progress. We therefore attenuate the laser pump power until the point where the rate of successful trigger events by the FPGA begins to fall. This also lets us bias the heralding detector at a greater voltage, leading to a higher heralding efficiency.
The Sagnac interferometer constituting the quantum SWITCH is housed in and isolated by three different layers of thinsulate, acrylic and neoprene. This is done to decrease airflow and temperature fluctuations. Gold coated mirrors are used throughout the setup as they exhibit low polarization-dependent loss at our working wavelength (0.034, 0.035 for S, P respectively). Their relatively poor reflectivity of 0.96 adds around 3.5 dB to the total loss. Similarly, a beam splitter with low polarisation dependent loss and splitting ratio is used for the Sagnac. Multi-order quarter-wave plates are used inside the interferometer to compensate the unwanted polarization-dependent phase shifts caused by the mirrors, with typical polarization contrasts in excess of 40 dB. After acquiring data for the cases n = 1, 2 we were able to exchange the CW-laser used for this compensation to a model with broader wavelength tuningrange to more closely match our single-photon central wavelength. This lead to superior polarization compensation performance, which in turn explains the increased fidelity F 3 compared to F 1,2 . While the polarization rotations induced by most components in the setup are not strongly wavelength dependent, the EO-switches are an exception to this, and therefore benefit from a CWwavelength that more closely matches that of the idler photons. The polarization unitaries U p , V q , Λ i are implemented with three sets of three waveplates in a QWP-HWP-QWP-configuration, mounted in motorized piezoelectric rotation mounts. While polarization transformations implemented purely with linear retarders will not in general be the same for both propagation directions, our restricted gate set consisting only of linear combinations of σ y and σ z is invariant under change of propagation direction. Since the applications of U outside the quantum SWITCH involve the photons hitting a different spot on the wave-plates, we verify their uniformity by performing quantum process tomography on six randomly generated unitaries. The wave-plates are sampled by four different beams offset horizontally by 2 mm each, and we find that the resulting gate fidelities do not differ by more than 0.1 %. To verify that the free time-evolution unitaries U p are faithfully implemented we also perform quantum tomography on them inside the setup and obtain an average fidelity of F U = (0.9928 ± 0.00035), averaged over all values of p and the states |H and |+ .
The applicability of the protocol to mixed states is verified by reconstructing density matrices from convex combinations of the acquired data for the pure states |+ and |− . They are compared to expected outcomes for input states of the form ρ = α |+ +| + (1 − α) |− −|, for 23 values of α ∈ (0, 1), all 50 combinations of (p, q) and all 3 experimental runs. In Fig. 6, the fidelities to these expected states are plotted for each value of n.

Signal Processing
To analyse the data we generate coincidence histograms between the heralding detector and the two detectors connected to the tomography stage. As previ- ously stated, due to the long fiber delays the idler photon takes several microseconds to traverse the entire setup. Heralding photons detected within this time window will be ignored by the FPGA, but will still be recorded by the time-tagger. In order to filter out these unused heralding photons in the coincidence analysis, the FPGA outputs a trigger signal whenever it initiates a new pulse sequence. This signal is transmitted back to the timetagger by the same electro-optic conversion procedure as in the previous section. Only trigger events for which a corresponding signal was received from the FPGA are used in the analysis. Conditioning the photon detection events on the FPGA trigger signal significantly reduces the background noise, as illustrated in Fig. 7.
Due to the presence of active switches in the setup, in any given run of the experiment there exists multiple possible paths that a photon could have taken from the source to the tomography stage. For example, during the state depicted in Fig. 3 (c) photons can travel directly from the source to the tomography stage. While most such events can be filtered out by virtue of the fact that the difference in arrival time between the signal and idler photons will not match that of the real signal, there are also higher order contributions consisting of signal and idler photons emitted at different times. Since the photons propagating straight to the tomography stage avoid most of the experimental loss, and are not attenu-ated by the success probability, the rate of these events becomes comparable to the signal even though the intrinsic rate of double-pair emission from the source is significantly lower than the single-pair emission rate. To offset this large noise contribution we add a small fiber delay between S1 and S2. The result is that the signal sits between the major noise peaks, as shown in Fig. 8.
While the SNSPDs have a very low dark count rate, ranging from about 30 to 300 Hz, the high rate of heralding photons nevertheless leads to a small number of accidental coincidence events that form a uniform background in the coincidence landscape. For pairs of implemented unitaries that nearly commute, the resulting low rate of detected signal photons makes the background of accidental coincidences non-negligible. To estimate the impact of this noise in our signal we sample the background in several regions of the coincidence histograms that don't contain any signal. These regions, separated by 13.2 ns, are indicated in Fig. 8. The mean value of the noise is used as input to a Monte Carlo simulation, from which the mean and standard deviation of the fidelity is obtained. At every step of the simulation a density matrix is constructed using a maximum likelihood fit. The Monte Carlo simulation is allowed to run until the 0.95 confidence interval on the mean fidelity reaches a value below 2 · 10 −3 . In order to further increase the signal to noise, a narrow coincidence window of 0.3−0.7 ns is used.  Figure 7. Influence of FPGA trigger events on noise background. A comparison between two coincidence histograms with 100 ps wide bins taken from the first run of (p, q, i, n) = (6, 2, H, 1). Background noise originating from higher-order emission events in the SPDC-source as well as detector dark counts can be greatly reduced by filtering out trigger photons that were ignored by FPGA while it was already executing a measurement sequence (blue, solid line). An unprocessed histogram is shown as dashed line. The inset shows a magnified region centered around the signal peak. The suppression of the noise peaks originating from unrelated photon pairs is greater than the ratio of unused to used trigger events. This is because the dead time of the detectors (on the order of 100 ns) acts as an additional filter on the heralding photons in the region around our signal, and as a consequence the majority of the events contributing to these peaks in the unfiltered signal comes from heralding photons that were not triggered on. Integrated coincidence events per 100ps Background Signal peak Sampled noise regions Figure 8. Background noise sampling. An example of a coincidence histogram with 100 ps wide bins taken from the first run of (p, q, i, n) = (6, 2, H, 1). It shows the number of coincidence events between the H-port of the tomography stage and the heralding detector, integrated over the measurement time, as a function of a time-offset in the heralding detector. The signal in our experiment is the dark green peak in the center of the graph. Slightly offset from the signal peak one would in an ideal experiment expect zero coincidence events due to the strong time correlation between the signal and idler photons, however due to a small but non-negligible detector dark count rate (on the order of 100 Hz) some coincidence events nevertheless occur. These form a uniform background, which we sample and include as an input to the Monte Carlo simulation that estimates the reconstructed state fidelities. The small side peaks offset from the signal by 13.2 ns (which is the reciprocal of the 76 MHz laser repetition rate) are caused by signal photons emitted before or after the pair the FPGAs triggered on. The remaining peaks are caused by coincidences from uncorrelated photon pairs, and this signal is strongly suppressed by conditioning the coincidence counting on the FPGA output signal.
Appendix B: Individual fidelities for all input states, timesteps and pairs of U and V