Introduction

Many features of quantum physics are based on symmetries present in physical systems. For example, the fundamental difference between bosons and fermions lies in their behavior under particle exchange.1 Indistinguishable bosons are symmetric while indistinguishable fermions are antisymmetric. The situation is more convoluted for distinguishable particles, which can be in states that are symmetric, anti-symmetric, or even arbitrary superpositions of thereof.2 The full sets of completely symmetric and anti-symmetric states form specific symmetric and anti-symmetric subspaces of the global multi-particle Hilbert space. Such states are naturally orthogonal and can be discriminated by projective measurements.3 Such projections play an important role in quantum measurements and general quantum information processing. They allow direct measurements of nonlinear functionals of quantum states,4,5,6 direct evaluation of the overlap and Hilbert–Schmidt distance between different states,4,5 and construction of programmable quantum multimeters.7,8

In principle, such measurements can be implemented by applying projectors onto the chosen subspaces. Consider an example of the direct measurement of purity of a qubit state. The purity is a nonlinear functional which provides important information about the quantum state and is utilized in many evaluations of quantum protocols. The direct measurement of purity requires two copies of the state and for two identical polarization qubits it can be realized in the Hong-Ou-Mandel experiment.9,10 This, in practice, is just a destructive projection onto the symmetric and antisymmetric subspaces.4,5 However, the projection does not need to be destructive. Laws of quantum physics allow implementing measurements as filters, without consuming the quantum systems which could then be employed for further processing or analysis. For qubits, the purity directly determines the diagonal form of the density matrix.4 Other measurements would be needed for full characterization, but they could still be realized, because the states were not affected. This is even more pronounced for quantum states from larger Hilbert spaces for which quantum tomography is a daunting task.

The possibility of implementing nondestructive multi-qubit operations was opened up by the recent experimental tests of linear optics three-qubit Fredkin gates.11,12 The construction allows one of the qubits to act as an ancilla which can, after interaction with the other two qubits, be destructively measured. At the same time, the measurement reveals information about the two qubits nondestructively, saving the qubits for further processing. However, full exploration of all features of the projective symmetrization4,5,7,8 requires versatile control of the input states and the ability to perform full quantum process tomography in addition to the high fidelity three-qubit gate. These were not simultaneously available in the pioneering tests.11,12

In this study we utilize a high-fidelity high-rate quantum Fredkin gate for full exploration of the nondestructive projections into symmetric and antisymmetric subspaces. Our setup allows for strong control of input and output qubits and is fast enough to allow collection of enough data for full quantum process tomography. These features enable tests and characterization of direct nondestructive measurements of purity and overlap of quantum states,5 as well as the optimal single-qubit quantum multimeter.7,8 The nondestructive nature of the operation also enables realization of optimal purification and optimal cloning13 of qubits. This demonstrates applicability of the exchange symmetry measurement for realizing quantum operations on optical qubits.

Results and discussion

The controlled exchange interaction is schematically depicted in Fig. 1 (see Methods for details on the experimental implementation). The interaction, also called control swap or quantum Fredkin gate,14,15 acts on three qubits; two signal (a and b) and one control (m). When the control qubit m is in the state \(\left| 1 \right\rangle\) the operation swaps states of qubits a and b, otherwise it does nothing. In its ideal form it is a unitary operation represented by controlled exchange operator UF = \(1 - 2\left| {{\mathrm{\Psi }}_ - } \right\rangle \left\langle {{\mathrm{\Psi }}_ - } \right| \otimes \left| 1 \right\rangle \left\langle 1 \right|\), where \(\left| {{\mathrm{\Psi }}_ - } \right\rangle\) = \(\frac{1}{{\sqrt 2 }}\left( {\left| {1,0} \right\rangle - \left| {0,1} \right\rangle } \right)\) is the antisymmetric Bell state.16 When the control qubit is initially in the superposition state \(\left| + \right\rangle\) = \(\frac{1}{{\sqrt 2 }}\left( {\left| 0 \right\rangle + \left| 1 \right\rangle } \right)\), the gate realizes projection onto either symmetric or anti-symmetric subspace of qubits a and b. These two operations correspond, respectively, to action of operators ΠS = \(\left| {{\mathrm{\Psi }}_ - } \right\rangle \left\langle {{\mathrm{\Psi }}_ - } \right|\) and ΠA = 1 − ΠS. Which one of the two operations was performed is random, but it can be found out by measuring the control qubit in the basis consisting of states \(\left| \pm \right\rangle\) = \(\frac{1}{{\sqrt 2 }}\left( {\left| 0 \right\rangle \pm \left| 1 \right\rangle } \right)\).4,5 Measurement results ‘+’ and ‘−’ indicate projection onto the symmetric and antisymmetric subspaces, respectively. The theoretical probabilities of these events depend on the state ρab of qubits a and b, \({\cal P}_S\) = Tr[ρabΠS] and \({\cal P}_A = 1 - {\cal P}_S\), and can be asymptotically obtained from the experimentally determined relative frequencies fS and fA. As a whole, the device therefore realizes a non-destructive detector of exchange symmetry (NDES). We will distinguish two regimes in which we operate the controlled exchange interaction device: when the control qubit m is initially in the \(\left| + \right\rangle\) state we will say that the NDES is on. When the control qubit is initialized in the state \(\left| 0 \right\rangle\) and the device should not implement any operation, we will say the NDES is off. This regime is mainly used for characterization. More details can be found in Methods.

Fig. 1
figure 1

a The principle of the controlled exchange interaction UF using three qubits. Two interacting qubits, a and b, are exchanged if and only if the controlling ancillary qubit m is in the state \(\left| 1 \right\rangle\). b The nondestructive detector of exchange symmetry (NDES) composed of the controlled exchange interaction device with the ancillary qubit m prepared in state \(\left| + \right\rangle\) and measured in the basis of \(\left| + \right\rangle\) and \(\left| - \right\rangle\). The qubits a and b are preserved and available for analyzing the influence of the device

Purity measurement

The most common way of estimating purity of an unknown quantum state employs tomographic measurement followed by density matrix reconstruction. This approach is demanding because the number of required projections scales exponentially with the dimension of the system. Knowledge of quantum state density matrix gives us full information about the examined state but in some cases knowledge about purity suffices. A recent example is the quantification of macroscopic quantumness, where measurement of purity plays an important role.17 An elegant way to directly estimate purity of the unknown quantum state was developed using symmetrization protocol.5 The method is general and applicable to quantum systems with arbitrary dimension. Here we test it for systems of qubits for which we can verify the obtained values with help of quantum tomography. The scheme is based on the identity Trρ2 = Tr[(ΠS − ΠA)ρ ρ]. It therefore requires two copies of the investigated state ρ and employs them to measures the mean value \(\left\langle {{\mathrm{{\Pi}}}_S - {\mathrm{{\Pi}}}_A} \right\rangle\). The individual operators ΠS and ΠA, corresponding to projection into the symmetric and antisymmetric subspaces, can be used for determining the purity P as

$$P = \frac{{f_S - f_A}}{{f_S + f_A}},$$
(1)

where fS and fA are the relative frequencies of the results heralding the symmetric and antisymmetric projections, respectively. The scheme reduces the number of required measurements for the price of increasing the dimension of the Hilbert space of the implemented quantum circuit. In the past this technique was demonstrated for two polarization encoded qubits carried by single photons and destructive measurement based on the Hong-Ou-Mandel effect.9 Here we use the NDES to demonstrate the nondestructive and nondemolition version.

We have tested the purity measurement for a set of input states with varying purity. The pairs of identical input states have been prepared with average fidelity F = 0.997(8). The number in the brackets represents one standard deviation at the final decimal place. We have performed full tomography of the two-qubit state at the output of the controlled exchange device, with the NDES both on and off. We have evaluated the experiment for all six basis states of the three mutually unbiased bases and aggregated the results, see Methods for details. The reconstructed density matrices were used to evaluate the purities of the input qubit and of the qubit pair state, which were compared to the purities P obtained by the direct nondestructive measurement of the ancillary qubit m, see Fig. 2a. The purities measured by the NDES closely match those obtained by the tomographic measurement. To verify that the measurement is also non-demolition we have also analyzed the reconstructed density matrices to compare the measured qubits a and b, in terms of their mutual information I, see Fig. 2b, and the on-off-fidelity, see Fig. 2c. For our purposes we define the on-off-fidelity of a quantum system as Fon|off = \({\mathrm{Tr}}\left[ {\sqrt {\sqrt {\rho _{{\mathrm{off}}}} \rho _{{\mathrm{on}}}\sqrt {\rho _{{\mathrm{off}}}} } } \right]^2\),16 where ρon (ρoff) is the reconstructed density matrix of the system (either one or two qubits) when the NDES was on (off). Quantum mutual information,18 can be defined as I = S(ρa) + S(ρb) − S(ρab), where \(S(\rho )\) = \(- {\mathrm{Tr}}[\rho {\kern 1pt} {\mathrm{log}}_2{\kern 1pt} \rho ]\) is the von Neumann entropy of the respective states. Both figures of merit confirm the non-demolition nature of the measurement: the mutual information I is kept close to zero, significantly below the possible maximum of two bits, and is mainly caused by correlations in the initial state. The average on-off-fidelities are 0.999(1) for single qubits and 0.990(5) for the two-qubit states. The error bars of the on-off-fidelity (see Methods for details on obtaining them) tend to grow as the purity of the states increases. This happens because we realized the experiment for six possible input states and aggregated them to obtain the final values. The fine differences between these states play a role when the states are pure but vanish in the case of impure states, which are mixtures of all of them. Despite the experimental imperfections, both high quality of the measurement and its non-demolition nature were confirmed by the analysis.

Fig. 2
figure 2

Data for the non-demolition measurement of purity using the NDES with error bars corresponding to one standard deviation. x-axis always shows purity of a single input state Pa,off as measured by complete tomography with the NDES off. Dashed lines correspond to ideal theoretical predictions while the points represent the experimental data. a Direct non-demolition measurement of purity using NDES. b Mutual information estimated from the tomographic reconstruction of the qubits a and b. Black circles are for NDES on, gray squares are for NDES off, the nearly overlapping solid lines are predictions based on the actual estimated process matrix. c On-off-fidelities obtained from tomographic data. Red triangles pointing up relate to qubit a, blue triangles pointing down relate to qubit b, and black circles are for the joint state of a and b. d Purity and e fidelity for conditional purification of two copies of input qubit producing qubit a as the output. The circles mark the quantities for the single purified qubit while the squares show them when NDES is off

Due to its nondestructive nature, the NDES can be also used to realize the quantum purification protocol.19,20 This protocol aims to improve quality of quantum states affected by decoherence. For qubits the input states can be given as ρin = Γ(ψ; p), where Γ(ψ; p) = \(p\left| \psi \right\rangle \left\langle \psi \right| + (1 - p)\rho _M\), \(\left| \psi \right\rangle\) is the initial unperturbed state, and ρM = \(\frac{1}{2}\left( {\left| 0 \right\rangle \left\langle 0 \right| + \left| 1 \right\rangle \left\langle 1 \right|} \right)\) is the density matrix of the maximally mixed state. Through the purification operation, several copies of the perturbed state are converted into fewer copies exhibiting both higher purity and higher fidelity, which can be expressed by \({\mathrm{\Gamma }}(\psi ;p)^{ \otimes n_1}\) → \({\mathrm{\Gamma }}(\psi ;p\prime )^{ \otimes n_2}\) with p′ > p and n1 > n2. In our realization, we used two identical copies of a partially mixed quantum state as input states of qubits a and b. We then used the NDES, post-selecting the ‘+’ results to apply projection onto the symmetric subspace, and taken the output qubit a as the product of the operation. Subplots (d) and (e) in Fig. 2 demonstrate improvement in both purity and fidelity which is in a very good agreement with the theory, as well as comparable to the previous experimental realizations of purification.20

Overlap and quantum state disturbance measurement

Overlap of two quantum states can be used to quantify their similarity. When at least one of the quantum states is pure, the overlap has the physical meaning of fidelity. A common way to estimate overlap uses knowledge of density matrices obtained by quantum state tomography and subsequent state reconstruction. However, there is an alternative approach for measuring the overlap of two quantum states, ρa and ρb, using the symmetrization protocol.5 In a way similar to the measurement of purity, we can use the NDES on the joint input state ρa ρb to obtain the relative frequencies fs and fa and the estimated overlap between states is defined as

$${\mathrm{Tr}}\left[ {\rho _a\rho _b} \right] = \frac{{f_S - f_A}}{{f_S + f_A}}.$$
(2)

We have experimentally realized this idea and studied the influence of the control qubit measurement on the quantum states involved. We started with input qubit a in state \(\left| 0 \right\rangle\), qubit b in state \({\mathrm{sin}}{\kern 1pt} \alpha \left| 0 \right\rangle + {\mathrm{cos}}{\kern 1pt} \alpha \left| 1 \right\rangle\) and iterated the α parameter through 19 values ranging from 0 to π/2 radians. First we measured and estimated density matrixes for all input single-qubit and two-qubit states when the NDES was turned on, and then when it was turned off. After that we used the NDES to directly measure the fidelity (overlap) in the nondestructive fashion.

Our findings are summarized in Fig. 3 where we compared the values obtained by the measurement of the ancillary qubit m with the values obtained by ideal theoretical calculation and simulation employing the full process matrix of the operation (see Methods for details). Figure 3a shows the fidelity between the qubits a and b, Fa|b, as well as the on-off-fidelity of the joint two-qubit system Fon|off. The direct measurement closely follows the results obtained by tomography. We can also see that the severity of the measurement back-action increases when the states are more distinct. For the identical input states \(\left( {\left| a \right\rangle = \left| b \right\rangle = \left| 0 \right\rangle } \right)\) the output two-qubit state is barely altered and the fidelity approaches unity. On the other hand, in case of orthogonal states on input (\(\left| a \right\rangle = \left| 0 \right\rangle\), \(\left| b \right\rangle = \left| 1 \right\rangle\)), the symmetrization produces a balanced mixture of Bell states \(\frac{1}{{\sqrt 2 }}\left( {\left| {01} \right\rangle \pm \left| {10} \right\rangle } \right)\) and the fidelity drops to 1/2. This demonstrates that the overlap measurement, while still non-destructive, is no longer non-demolition.

Fig. 3
figure 3

Measuring two different qubits a and b by the NDES. The horizontal axis Fa|b,off corresponds to the fidelity between input qubits a and b, which was estimated from density matrixes obtained with the NDES off. The dashed lines represent values given by the ideal theory, the solid lines give values obtained by simulation using the full process matrix, and the points denote measured experimental data. a Black circles mark the overlap of a and b directly measured by the non-demolition measurement. Green triangles show the on-off-fidelity of the joint two-qubit system. b and c Quantum mutual information of the joint state of qubits a and b. Gray squares correspond to the NDES off, black circles correspond to the NDES on. The triangles relate to the probabilistic operations in which only data corresponding to projection on the symmetric (red triangles pointing up) and anti-symmetric (blue triangles pointing down) subspaces were selected. The ideal curve for the anti-symmetric projection (blue dashed line) attains values I = 2 for Fa|b,off < 1 and I = 0 for Fa|b,off = 1. This theoretical discontinuity is reflected in the experimental data by the sudden decrease (blue solid line). The error bars correspond to one standard deviation. Please note that subfigure c relates to the Quantum-state programmable multimeter and is discussed in the corresponding section

This behavior can be in greater detail analyzed by looking at the correlations the NDES creates between the qubits a and b. In Fig. 3b we show the average mutual information between the two qubits. This quantity, which disregards the knowledge about which of the two projections has been performed, shows that the output states are most correlated when the input qubits were orthogonal and the correlations diminish with increasing overlap of the two qubits until they vanish for identical states as predicted by the theory. We can also see that when the NDES is off the correlations are small but nonzero. This is a consequence of the hyper-encoded architecture of the gate, see Methods for details.

So far we have investigated fidelity of two pure states but the NDES can also directly measure the fidelity between a pure and a mixed state. To test this, we have prepared qubit b in a mixture of \(\left| 0 \right\rangle\) and the maximally mixed state and measured its fidelity with the state of the qubit a, which was prepared either in \(\left| 1 \right\rangle\) or in \(\left| + \right\rangle\). We have repeated the measurement for different purities of the qubit b. The measured fidelity between qubits a and b is shown in Fig. 4a. In Fig. 4b we evaluate the back action of the measurement by comparing the on-off-fidelities of the individual qubits a and b and in Fig. 4c we track the changes in the mutual information. In nearly all the observed cases the experimental results closely follow the theoretical predictions.

Fig. 4
figure 4

Measurement of the fidelity between a pure state of qubit a and a mixed state of qubit b. All graphs illustrate various quantities dependence on the qubit’s b purity Pb,off. Top and bottom row illustrate cases with qubit a set to \(\left| 1 \right\rangle\) and \(\left| + \right\rangle\), respectively. All dashed lines are ideal theoretical prediction, while all solid lines are predictions based on the actual estimated process matrix. In column a we plot the measured fidelity Fa|b between qubits a and b measured by the NDES (black dots) and fidelity Fa|b,off calculated from the reconstructed density matrices in the case of the NDES turned off (green triangles). Column b shows single-qubit on-off-fidelity for qubits a (red triangles pointing down) and b (blue triangles pointing up). In column c we plot quantum mutual informationIfor the NDES on (black dots) and off (gray squares). The error bars correspond to one standard deviation

The active projection onto the symmetrical subspace can be also employed for quantum cloning.21,22,23 Quantum cloning is a protocol which takes one or more copies of an unknown quantum state \(\left| \psi \right\rangle\) and creates a higher number of copies. Such copies are always imperfect and their quality diminishes with their number. In our case we have created two clones of a single unknown pure quantum state realizing transformation \(\left| \psi \right\rangle\) → \(\frac{2}{3}\left| \psi \right\rangle \left\langle \psi \right| \otimes \left| \psi \right\rangle \left\langle \psi \right|\) + \(\frac{1}{3}\left| S \right\rangle \left\langle S \right|\), where \(\left| S \right\rangle\) = \(\frac{1}{{\sqrt 2 }}\left( {\left| \psi \right\rangle \left| {\psi ^ \bot } \right\rangle + \left| {\psi ^ \bot } \right\rangle \left| \psi \right\rangle } \right)\) is the symmetric superposition of the initial state and the state orthogonal to it. The unknown state, encoded into the qubit b, can be cloned when qubit a is initialized in the maximally mixed state ρM and the NDES is used to probabilistically project the pair onto the symmetric subspace. We have realized the operation for the six different states forming the three mutually unbiased bases and used tomographic reconstruction to characterize the two clones (see Methods for details). The reconstructed density matrices have been used to evaluate the average clone fidelities \(\bar F_a\) = 0.81(4) and \(\bar F_b\) = 0.80(3), which are significantly above the classical threshold of 2/3 and approach the optimal theoretical limit of 5/6, comparably to the previous realizations of quantum cloning.24,25

Quantum-state programmable multimeter

Von Neumann projective measurement of a qubit can be realized in an arbitrary basis given by orthogonal states \(\left| b \right\rangle\) and \(\left| {b_ \bot } \right\rangle\). Quantum multimeter is a device with the ambition to implement the full set of such measurements while controlling the measurement basis by a finite programmable quantum register. This makes them usable as a part of larger quantum processing circuit. However, this is impossible in the ideal form and quantum multimeter implements a positive operator valued measure (POVM) instead.7 It was shown in ref.8 that when the signal and the program are states of qubits the optimal scheme is based on the projection into the symmetric and anti-symmetric subspaces.

We have used our controlled exchange interaction to implement a nondestructive quantum multimeter for unknown signal state \(\left| a \right\rangle\) of qubit a, which is programmed by the quantum state \(\left| b \right\rangle\) of qubit b, see Fig. 1. The ancillary control qubit m, initially prepared in quantum state \(\left| + \right\rangle\), has been used to read out the measurement result. Measurement outcomes \(\left| + \right\rangle\) or \(\left| - \right\rangle\) can be interpreted as indication that qubit a was found most likely in state \(\left| b \right\rangle\) or \(\left| {b_ \bot } \right\rangle\), respectively. The full POVM elements corresponding to these measurement results can be expressed as

$${\mathrm{{\Pi}}}_ + = \left| b \right\rangle \left\langle b \right| + \frac{1}{2}\left| {b_ \bot } \right\rangle \left\langle {b_ \bot } \right|,{\mathrm{{\Pi}}}_ - = \frac{1}{2}\left| {b_ \bot } \right\rangle \left\langle {b_ \bot } \right|.$$
(3)

The quality of the measurement can be evaluated with help of the conditional probabilities p(x|y), which represent the probability that measurement of m returned value x when the initial state of qubit a was \(\left| y \right\rangle\). In our case x = ± and \(\left| y \right\rangle = \left| a \right\rangle {\kern 1pt} {\mathrm{or}}{\kern 1pt} \left| {a^ \bot } \right\rangle\). These conditional probabilities generally depend on the overlap Fa|b,off = \(\left| {\left\langle {a|b} \right\rangle } \right|^2\) between the signal and the program state.

The natural way to benchmark the quality of the experimental quantum multimeter is by evaluating its performance as a quantum discriminator.7,8 In this regime, in which we attempt to discriminate between known orthogonal states \(\left| a \right\rangle\) and \(\left| {a_ \bot } \right\rangle\) appearing with equal probabilities, the program qubit is prepared in state \(\left| b \right\rangle = \left| a \right\rangle\). The quality of the discriminator can be quantified by the discrimination fidelity:8

$$F_{{\mathrm{disc}}} = \frac{1}{2}\left[ {p\left( { + |a} \right) + p\left( { - |a_ \bot } \right)} \right],$$
(4)

which should be, barring experimental imperfections, equal to 3/4. We have experimentally tested the multimeter for the six basis states of the three mutually unbiased bases. The achieved fidelity, averaged over the six separate settings, was \(\bar F_{{\mathrm{disc}}}\) = 0.74(1). This is, within the estimated confidence interval, perfectly in line with the expected value for perfect implementation of the optimal multimeter.

The multimeter is non-destructive, but it still introduces correlations between the signal and the program which diminishes their single qubit qualities. The extent to which this happens depends on their overlap and it can be evaluated with the help of mutual information I which is depicted in Fig. 3c. The situation is different for each of the two possible measurement results, ‘+’ and ‘−’. The measurement result ‘−’ corresponding to the projection into the anti-symmetric subspace produces a two-qubit state with maximal mutual information as long as the qubit states differ. When the qubits are in identical states the projection never succeeds, which manifests as discontinuity in the theoretical description. In the experimental reality, however, the reduction of the probability of success leads to larger measurement errors together with higher sensitivity to experimental imperfections. This causes increase in size of the error bars, as well as the drop of correlations between highly overlapping states of a and b. Nevertheless, this situation leads to qubits which are individually in the maximally mixed state and unsuitable for further processing. On the other hand, correlations introduced by the measurement result ‘+’ are generally lower. As a consequence, both the signal and the program qubits can be recovered with average theoretical fidelity \(\overline F _{{\mathrm{th}}}\) = 0.793. In our experiment we managed to obtain fidelities \(\overline F _a\) = 0.763(9) and \(\overline F _b\) = 0.806(9).

Conclusion and outlook

We have presented experimental implementation of the nondestructive detector of exchange symmetry based on the quantum Fredkin gate. The Fredkin gate uses an architecture which, apart from a single two-photon interaction implemented in a probabilistic fashion, is deterministic. The path encoding,26 polarization control,27 and partial polarization beam splitters28 have been all previously demonstrated in integrated optics experiments and our device is therefore suitable for on-chip implementation. Significant part of its processing power comes from hyper-encoding two qubit states into path and polarization degrees of freedom of single photons, which can be realized beforehand.29

We have applied the detector to nondestructive measurements of purity and overlap of quantum states, as well as implementation of quantum multimeter programmable by quantum states. Flexible control over all input and output ports allowed us perform full quantum process tomography of the operation and to confirm both faithfulness and the non-destructive nature of the measurements. The non-destructive nature of the detector allows it to be used for extracting partial information within a larger measurement scheme, or to actively implement nonlinear quantum operations, as we demonstrated by realizing quantum purification or quantum cloning. Apart from the applications listed in this work, the current proof-of-principle implementation of the detector can be immediately utilized for evaluation of the Hilbert–Schmidt distance5 and extended towards non-destructive estimation of higher-order functionals of quantum state density matrices17,30,31,32 or active implementation of fundamental quantum operations.33 The experiment also demonstrates conceptual usefulness of the exchange symmetry measurements, which can be adopted for non-destructive measurements of important characteristics of intricate quantum states in infinite dimensional spaces, such as those describing states of trapped ions34 or superconducting circuits.35

Methods

The controlled exchange interaction device is implemented by a photonic circuit based on quantum linear optics platform,36 with use of the hyper-encoding technique37 which exploits encoding two qubits into polarization and path degrees of freedom of a single photon. Hyper-encoded qubits interact more readily and can be obtained by joining together qubits encoded in degrees of freedom of separate photons.29 In our case we prepare the hyper-encoded qubits directly.

The experimental setup is composed of several Mach–Zehnder (MZ) interferometers with seven independent phases. The interferometers are formed by calcite beam displacing crystals, which is an inherently stable architecture commonly employed in quantum optical experiments.37,38,39,40 The consequence of the stability is a naturally low average drift of the overall phase which, in our case, is 3.30 deg/h. We discuss the phase stability of the interferometric setup into greater detail in a separate article.41

Our realization of the Fredkin gate includes two single-qubit Hadamard gates, two two-qubit control-not (cnot) and swap gates, and a three-qubit control-control-z (ccz) gate, see the circuit diagram in Fig. 5. We use orthogonally polarized time-correlated photon pairs with central wavelength of 810 nm generated in the process of degenerate spontaneous parametric down-conversion. The signal and idler photons are fed into the experiment via single-mode optical fibers, see Fig. 5. We encode qubits a and b into signal photon’s path and polarization degrees of freedom,42 respectively. The spatial qubit a is initially prepared in polarization encoding using combination of quarter-wave plate (QWP) and half-wave plate (HWP), and it is subsequently converted into path encoding using a calcite beam displacer. The computational basis state \(\left| 0 \right\rangle\) corresponds to the horizontally polarized photon propagating in the upper interferometer arm, while the state \(\left| 1 \right\rangle\) is represented by a vertically polarized photon propagating in the lower interferometer arm of the inherently stable MZ interferometer formed by the first and the last calcite beam displacers in the preparation and verification stages of the setup. The qubit b is encoded into polarization state of the signal photon using a combination of QWP and HWP. The elements are arranged so they affect both paths simultaneously in order to minimize undesirable correlations. The two qubits can be prepared in identical pure states with average fidelity F = 0.99(2) and in identical mixed states with fidelity F = 0.997(8). The ancillary qubit m is then encoded as the idler photon’s polarization state.

Fig. 5
figure 5

Experimental scheme of controlled exchange interaction device. Red line denotes photons path. HWP - half-wave plate (the ring variant is used in cnot and swap blocks), QWP - quarter-wave plate, BD - calcite beam displacer, PPBS - partially polarizing beam splitter, PBS - polarizing beam splitter, APD - collimator and single-mode optical fiber connected to avalanche photodiode. Inset shows the symbolic circuit diagram

The cnot gates between qubits a and b, where a is control, are implemented by inserting a HWP rotated by π/4 into a single spatial mode. It flips the state of the polarization qubit but only for a single spatial qubit state. This implementation, enabled by the hyper-encoding of qubits, is deterministic and offers unparalleled fidelity of process.43 The two-qubit swap gate for the hyper-encoded qubits a and b can be deterministically realized by rearranging two of the four possible rails the photon can take. Horizontal photon traveling in the upper path needs to be changed to vertical photon traveling in the lower part and vice versa. This can be realized by two calcite beam displacers arranged to form two MZ interferometers with one common path41 with two HWPs rotated by π/4 inserted into the two outer paths. The HWPs, which were realized by a single HWP with a circular gap allowing the common path unobstructed pass, flip polarization of the photons and cause the swap. The Hadamard gates for the polarization qubit are realized by HWPs rotated by π/8 radians inserted into both paths. The HWPs rotate the polarization states and thus change the computation basis states \(\left\{ {\left| 0 \right\rangle ,\left| 1 \right\rangle } \right\}\) to \(\left\{ {\left| + \right\rangle ,\left| - \right\rangle } \right\}\). Even though the circuit allows deterministic implementation of all single and two-qubit gates, the overall scheme is probabilistic due to the nature of the used three-qubit ccz gate which is realized by two-photon interference on an unbalanced beam splitter.38,43,44,45,46,47 Visibility of this interference, measured by characterizing the Hong-Ou-Mandel dip, largely decides overall quality of the gate.43 Thanks to the high spatial overlap boosted by filtering through single mode fibers we are able to achieve average visibility of V = 0.966(9). The ccz gate is the only probabilistic gate in the setup and limits the success probability to the theoretical value of 1/9.

The output qubits a and b are analyzed by a block consisting of a QWP, HWP, a calcite beam displacer, and the standard polarization analysis block consisting of HWP, QWP, and polarizating beam splitter (PBS). The ancillary qubit m is projected onto a chosen pure state using the standard polarization analysis block. All output beams are coupled to single-mode optical fibers, which provide spatial filtering, and guided to the avalanche photo diode (APD) detectors. The electronic signal from the APD detectors is electronically processed through delay lines and coincidence logic and the number of coincidences is recorded by an electronic counter module and a time-tagging unit.

In order to quantify the overall performance of the experimentally realized photonic circuit we perform full quantum process tomography of the Fredkin gate. All three qubits are sequentially prepared in the six different basis states \(\left| 0 \right\rangle\), \(\left| 1 \right\rangle\), \(\left| \pm \right\rangle\), and \(\left| { \pm i} \right\rangle\) = \(\frac{1}{{\sqrt 2 }}\left( {\left| 0 \right\rangle \pm i\left| 1 \right\rangle } \right)\) and later measured in the same bases for the total of 66 measurement records. We then use the maximum-likelihood estimation algorithm procedure48,49 to obtain the quantum process matrix χ. The quality of the gate can be expressed by the process fidelity Fχ = Tr[χχF], where χF is the process matrix of the ideal theoretical Fredkin gate. In our case, the process fidelity amounts to Fχ = 0.901. The operation is not perfect due to imperfections of the experimental setup. The most important contributions are the wave plate retardance errors, wavefront distortion, imperfect spatial mode matching at beam splitters and calcite beam displacers, and phase fluctuations in interferometers. When evaluating the individual protocols we distinguish two particular scenarios. The protocols for qubits a and b are performed when the control qubit m is prepared in \(\left| + \right\rangle\) and subsequently measured in basis \(\left| \pm \right\rangle\) (NDES is on). The second case, in which the control qubit m is both prepared in and projected to \(\left| 0 \right\rangle\) leaving the states of qubits a and b unaltered (NDES is off), serves for characterization of the input qubits. One thing revealed by this characterization is a nonzero mutual information between the qubits amounting to roughly 0.25 bits or 0.12 of maximal correlations possible. These correlations appear due to subtly different losses of the paths. On average, these losses amounted to 6.6% relative to the path with the lowest losses. These losses could be compensated by additional optical elements, such as suitably tilted glass plates. However, they would need to be inserted into each arm of all the interferometers, which is not feasible in practice. In the end, the correlations are the side-effect of hyper-encoding and can be seen as a cost for implementing multiqubit operations easily.

Several of the protocols we investigate require mixed states at the input. An arbitrary mixed polarization qubit can be prepared, for example, by using an electronically driven fiber polarization controller.50 Such device, together with a calcite beam displacer, can be used to prepare a mixed state of the spatial qubit. However, in our implementation, the mixed state of the polarization qubit would require additional rapid modulation of polarization. Such procedures are challenging and prone to imperfections, and that is why, for the purpose of characterizing the gate, we opt for a different approach. We have generated large sets of data for all combinations of the six different basis states at the input and we use this data to compose virtual measurement outcomes for arbitrary mixed states. For each evaluation, a different randomly picked subset of the overall data corresponding to the desired quantum state is chosen to minimize any potential bias.

The large set of data is also used for evaluation of errors. For majority of the protocols the large data set allowed us to simulate one hundred instances of the run in Monte–Carlo-like fashion. These instances are then individually evaluated and statistically processed to obtain overall mean values and standard deviations, which are used for construction of the error bars. In the case of the direct evaluation of purity (1), the error bars obtained by the simulation are further subjected to the methods of error propagation and averaged over the six possible input basis states.

Data availability

The data that support the findings of this study are available from the corresponding author upon request.