Introduction

Quantum computation1 is one of the great challenges in quantum information processing, while it enables the exponential speedup of computations and solves numerous NP-hard problems which cannot be effectively tackled by the classical computing2,3. Recently, extensive attention has been raised in realizing large-scale universal quantum computing with instinctive systems including superconducting qubits4, linear optics5, atoms6 and NMR qubits7. Quantum logic gates acting as key components of quantum circuits are essential for quantum computation. However, the efficient realization of more qubits quantum logic gates still remains a significant challenge due to the difficulty in chaining various gates together in a circuit, e.g., the three-qubit Toffoli gate requires six CNOT gates8, while the Fredkin gate corresponds to a more difficult decomposition. Some ingenious methods of realizing three-qubit Toffoli and Fredkin gates have been experimentally demonstrated with large-scale bulk optics systems9,10. By expanding the qubit space to a higher dimensional Hilbert space, Lanyon et al. exhibited the realization of Toffoli gate with a photonic system9. A quantum Fredkin gate acting on photons is experimentally demonstrated with the pre-entangled input states, which cannot act as an independent gate device10. The inherent limited programmability, less scalability and instability of bulky optical gates restrict their wide deployment.

Nowadays, the burgeoning development of integrated photonic circuits has manifested themselves as paradigms for large-scale quantum computation due to the precise programming of the large-scale circuit5,11,12,13,14,15,16,17. In this paper, we propose a scheme to construct the quantum logic gates and fabricate a programmable silicon-based photonic chip for realizing a diversity of quantum logic gates, such as three-qubit quantum Fredkin and Toffoli gates. Instead of decomposing a multi-qubit gate into the basic single-qubit gates and two-qubit CNOT gates, the independent encoded photons pass through an optical circuit that implements a specific (usually non-unitary) transformation correspond to the desired quantum logic gate, which is programmed by controlling phases of each Mach–Zehnder interferometer (MZI). We then perform post-selective measurements on the output photons to directly implement the multi-qubit gate. Moreover, our method can be extended to realize large-scale n-qubit Toffoli gate18. The diverse quantum logic gates implemented in a single photonic integrated chip will facilitate the development of future quantum processors, and endow a great number of potential applications.

Results

Theoretical framework

A holistic scheme is presented to implement an n-qubit quantum gate with n photons and a 2n × 2n linear optical network. For simplicity, we choose a three-qubit quantum logic gate as an example. The functionality of the three-qubit gate can be described by a 23 × 23 matrix \(\left[\kern-0.15em\left[ {X_{ij}} \right]\kern-0.15em\right]\) which determines the relations between eight input and output states in the computational basis, e.g., \(\left| {000} \right\rangle _{in} \to X_{11}\left| {000} \right\rangle _{out} + X_{12}\left| {001} \right\rangle _{out} + \ldots + X_{18}\left| {111} \right\rangle _{out}\). Here, we consider a 6 × 6 nonunitary circuit \(\left[ {Y_{ij}} \right]\) with three input photons encoded in two adjacent modes labelled as \((a_0,a_1)\), \((b_0,b_1)\), \((c_0,c_1)\) as shown in Fig. 1. For each three-qubit input state in eight computational states, the amplitude of the corresponding eight output state is the permanent of \(Y_S\) due to the indistinguishability of bosons, where \(Y_S\) is the 3 × 3 submatrix of \(\left[ {Y_{ij}} \right]\), corresponding to the input and output states19,20 (See Supplementary Note 1.2 for details of constructing \(\left[ {Y_{ij}} \right]\)). By calculating the appropriate matrix \(Y_{Fre}\) and \(Y_{Tof}\) (see Fig. 1), we can obtain the amplitude matrices for the input-output relation which are exactly the desired \(\left[\kern-0.15em\left[ {X_{ij}} \right]\kern-0.15em\right]\) of quantum Fredkin gate and Toffoli gate. Since all evolutions of the photons via passing the optical circuit are coherent, our constructed gate also works well for arbitrary input three-qubit state with density matrix \(\rho _{in} = \mathop {\sum}\nolimits_{i,j} {\rho _{ij}\left| i \right\rangle \left\langle j \right|}\), where \(\left| i \right\rangle ,\left| j \right\rangle\) = \(\left| {000} \right\rangle ,\left| {001} \right\rangle , \ldots ,\left| {111} \right\rangle\) and \(\rho _{ij}\) is the element of density matrix in computational basis.

Fig. 1: Scheme of constructing three-qubit quantum logic gates.
figure 1

Three independent photons encoded in \(\left( {a_0,a_1} \right),\left( {b_0,b_1} \right),\left( {c_0,c_1} \right)\) pass through a 6 × 6 photonic circuit described by a nonunitary matrix \(\left[ {Y_{ij}} \right]\), the output distribution of the three-photon coincidence counts at each port is determined by the permanent of the 3 × 3 submatrix \(Y_{{{\mathrm{S}}}}\) defined as \({{{\mathrm{Per}}}}\left( {{{{\mathrm{Y}}}}_{{{\mathrm{S}}}}} \right)\). By calculating the appropriate nonunitary matrix \(Y_{Fre}\) and \(Y_{Tof}\) for the photonic circuit \(\left[ {Y_{{{{\mathrm{ij}}}}}} \right]\), the output amplitude is exactly the matrix \(\left[\kern-0.15em\left[ {X_{ij}} \right]\kern-0.15em\right]\) of the Fredkin gate and Toffoli gate respectively which infers the implementation of the three-qubit logic gates. Other quantum logic gates can also be reconstructed with the same method by adjusting the nonunitary matrix \(\left[ {Y_{{{{\mathrm{ij}}}}}} \right]\).

\(\left[ {Y_{ij}} \right]\) is usually a nonunitary matrix which cannot be realized experimentally by Reck’s decomposition scheme directly21. By performing the Singular Value Decomposition (SVD) of matrix \(\left[ {Y_{ij}} \right]\), we obtain:

$$Y = U{{\Sigma }}V^{\dagger} ,$$
(1)

where U and \(V^{\dagger}\) are unitary matrices which can be realized directly21,22. \({{\Sigma }} = diag\left( {\gamma _1,\gamma _2,...,\gamma _6} \right)\) \(\left( {\gamma _1 \ge \gamma _2 \ge ... \ge \gamma _6 \ge 0} \right)\) is the diagonal matrix and \(\gamma _1\) is the largest eigenvalue. Usually, the matrix \({{\Sigma }}\) cannot be realized experimentally due to \(\gamma _1 > 1\). We then define \(\Sigma _{Att} = {{\Sigma }}/\gamma _1 = diag\left( {1,\gamma _2/\gamma _1,...,\gamma _6/\gamma _1} \right)\), which means that different attenuations are added for the six paths. By connecting the three unitary matrixes in order, we can experimentally realize the attenuated matrix as

$$\left[ Y \right]_{Att} = \frac{Y}{{\gamma _1}} = U\Sigma _{Att}V^{\dagger} ,$$
(2)

where \(1/\gamma _1^6\) is the experimental success probability of the three-qubit quantum gate. For the calculated matrices show in Fig. 1 for Fredkin gate and Toffoli gate, we obtained a success probability of 0.056 for the Fredkin gate and 0.017 for the Toffoli gate. The success probability of the Toffoli gate is higher than 1/72 (0.014) achieved in the previous experiment9.

Besides the three-qubit Toffoli and Fredkin gates, our scheme can also be potentially used to implement quantum gates with more qubits such as the n-qubit Toffoli gates (n>3) (see Supplementary Note 3). An even more interesting point is that our scheme can also be used to realize a heralded Toffoli gate with ancillary photons (see Supplementary Note 4 for details). Using the multiplexing approach23, the success probability of such heralded Toffoli gate can be boosted to near-deterministic level, thus making it potentially promising for future applications in scalable optical quantum circuits.

Experimental setup

A series of quantum logic gates including a three-qubit Fredkin gate, a three-qubit Toffoli gate, and other two-qubit quantum gates are implemented in a silicon quantum photonic chip as shown in Fig. 2. A pump laser beam containing central wavelengths of 1546.8 nm and 1553.2 nm (See Methods and Supplementary Note 1.1 for details) is fed into the photonic chip which mainly consists of two parts: (i) the generation of degenerated photonic source pair and (ii)–(iv) the photonic circuit for realizing the quantum logic gate.

Fig. 2: Experimental realization of quantum logic gates.
figure 2

a A dual-wavelength pump beam is injected into the photonic chip composed of four parts: (i) the generation of two pairs of degenerated photons labelled as a, b and c, d via the interference of the N00N state; (ii) the preparation of initial states; (iii) the photonic circuit to realize the 6 × 6 nonunitary matrix \(\left[ {Y_{{{{\mathrm{ij}}}}}} \right]\) by the SVD decomposition into three unitary matrices \(V^{\dagger}\), \(\Sigma _{Att}\) and U; (iv) the measurement part at different bases. The photons at the outputs are coupled into fibers and detected by SNSPDs. SNSPD: superconducting nanowire single-photon detector. Inset: The left subpicture is the results of the N00N state. At the angle \(\theta = \pi /2\), the maximum coincidence counts mean one photon pair is generated at port a, b. The right subpicture is the construction of an MZI on chip which is composed of two multi-mode interferometers (MMIs) and two phase shifters. b The optical micrograph of the whole chip. In our chip, the 6 × 3 nonunitary matrix is divided into three parts: \(V^{\prime {\dagger} }\), the attenuation and U′. \(V^{\prime {\dagger} }\) is a 3 × 3 unitary matrix, thus only two attenuations should be inserted in path 2 and 3 which are labelled as \({{{\mathrm{Att}}}}_2\) and \({{{\mathrm{Att}}}}_3\). The attenuated photons are leaked out of the chip shown as \({{{\mathrm{leak}}}}_2\) and \({{{\mathrm{leak}}}}_3\). The red box represents the main parts (i)-(iv) in our experiment.

Generation of degenerated photonic source pair

After entering into the part (i) of the chip, the pump light is divided into four paths with equal intensity by three MZIs (each consisting of two multi-mode interferometers and two phase shifters θ and ϕ, see the inset of Fig. 2a). Each pump beam passes through a silicon waveguide spiral to generate the degenerated squeezed light source simultaneously through the spontaneous four wave mixing (SFWM) process. The residual pump pulse is filtered by two asymmetric MZIs (AMZIs), and the remaining parametric photons at 1550 nm are in the N00N state \(\left| \psi \right\rangle = 1/\sqrt 2 \left( {\left| {20} \right\rangle + \left| {02} \right\rangle } \right)\) when only one pair photon term is considered. Here, we tested the two-photon N00N state24 by interfering them by a 50:50 beam splitter with an adjustable phase of θ. The coincidence counts are measured at two outputs with a visibility of \(0.909 \pm 0.004\), see the inset of Fig. 2a. When \(\theta = \pi /2\), the output photon pair state \(\left| \psi \right\rangle = \left| {11} \right\rangle\) is generated. Two such pair sources are pumped out with the same input intensity and labelled as a, b and c, d when realizing the three-qubit gate. We then measure the Hong–Ou–Mandel (HOM) interference between the two photon pair sources and obtained a visibility of \(V_{HOM} = 0.82 \pm 0.05\) at a coincidence count of ~3000 Hz for both two photon pairs. The HOM interference visibility is calculated as: \(V_{HOM} = \left( {C_{{{{\mathrm{max}}}}} - C_{{{{\mathrm{min}}}}}} \right)/\left( {C_{{{{\mathrm{max}}}}} + C_{{{{\mathrm{min}}}}}} \right)\) where \(C_{{{{\mathrm{max}}}}}\) and \(C_{{{{\mathrm{min}}}}}\) are the peak and dip four-photon coincidence counts.

The photonic circuit for realizing the quantum logic gate

The d photon is sent to the detector as a trigger signal, and the other three photons are sent to the circuit with three parts: (ii) the preparation stage, (iii) the SVD decomposition stage and (iv) the tomography stage. For the state preparation, three MZIs are linked to encode the photons a, b and c into dual-rail qubit, which are denoted as \(\left( {a_0,a_1} \right)\), \(\left( {b_0,b_1} \right)\) and \(\left( {c_0,c_1} \right)\). Subsequently, they are injected into the 6 × 6 non-unitary matrix composed of two 6 × 6 unitary matrices \(V^{\dagger}\) and U, which are both composed of 15 MZIs and a total of 36 thermo-optic phase shifters22. The connected attenuation matrix \(\Sigma _{Att}\) is composed of 6 MZIs. While in our experiment for the proof-of-principle demonstrating the quantum gate, our fabricated photonic chip is not large enough to realize a 6 × 6 nonunitary matrix. But luckily, we can construct a 6 × 3 nonunitary matrix which combines the state preparation and measurement parts for each encoded input state of a three-qubit gate. It can be used to proof-of-principle demonstrate the three-qubit gate since the evolution for each input to output is determined by the 6 × 3 submatrix (See Supplementary Note 1. 3 for details). The 6 × 3 nonunitary matrix can be decomposed into the matrices 3 × 3 unitary matrix \(V^{\prime {\dagger} }\) and 6 × 6 unitary matrix U′ by the SVD decomposition which are experimentally realized in our photonic chip (Fig. 2b). The three photons are fed into the superconducting nanowire single-photon detectors (SNSPDs) for the fourfold coincidence measurement.

Results for three-qubit gates

In quantum information processing, Fredkin gate and Toffoli gate are the most commonly used three-qubit gates. The Fredkin gate is the controlled-swap gate which means the qubit states of the two target qubits (\(T_1,T_2\)) are swapped when the control qubit (C) is \(\left| 1 \right\rangle\). While the Toffoli gate is the controlled-controlled-NOT gate where the target qubit (T) is flipped when the two control bits (\(C_1,C_2\)) are both \(\left| 1 \right\rangle\). These two logic gates are fundamental components of universal reversible computation and have a great usage in quantum error correction, thus playing important roles in the quantum network25,26,27,28. In order to realize these two three-qubit gates separately, we calculate the non-unitary matrices \(\left[ {Y_{ij}} \right]\) for both Fredkin gate \(Y_{Fre}\) and Toffoli gate \(Y_{Tof}\) as shown in Fig. 1. In the experiment, the detected four-fold coincidence counts were averaged ~3 per hour for the Fredkin gate and ~1 per hour for the Toffoli gate, and we measured about 100 events for each input basis. Although such low count rates are not sufficient to perform a full process tomography of the prepared three-qubit gate within a reasonable time frame, they are sufficient to verify whether the prepared gate can fulfil the core functions of the three-qubit gate.

First, we verify whether it can achieve the classical behavior of Fredkin and Toffoli gates, i.e., whether it can convert all eight logical input states into the correct eight logical output states in the computational basis. Mathematically, the fidelity \(F_Z = {{{\mathrm{Tr}}}}\left( {M_{ideal}.M_{exp}} \right)/{{{\mathrm{Tr}}}}\left( {M_{ideal}.M_{ideal}} \right)\) is calculated to quantify the overlap between two truth tables, where \(M_{ideal}\) is the ideal truth table and \(M_{exp}\) is the experimental one. Figure 3a, b show the experimental results for constructed Fredkin gate and Toffoli gate with a fidelity of \(0.75 \pm 0.02\) and \(0.79 \pm 0.03\), respectively, which reflects the performance of the classic action of our prepared three-qubit gates.

Fig. 3: Experimental results for three-qubit logic gates.
figure 3

a and b show truth tables of the constructed Fredkin and Toffoli logic gates, respectively. The x and y axes are eight calculation basis for input and output states. c Measured results for determining the fidelity of target qubits for the input state \(\left| { + ,0,1} \right\rangle\) of the Fredkin gate. \(\left| {R/L} \right\rangle = \left( {\left| 0 \right\rangle \pm i\left| 1 \right\rangle } \right)/\sqrt 2\) d,e, The measured results of control qubit C2 and target qubit T for the input state \(\left| {1, + ,0} \right\rangle\) and \(\left| {0, + ,0} \right\rangle\) respectively of the Toffoli gate. All error bars refer to ±1 standard deviation estimated from Poissonian photon-counting statistics.

Then, we verify the quantum behaviour of the prepared three-qubit gate, i.e., its ability to operate correctly on the input quantum superposition states. For the Fredkin gate, we choose \(\left| { + ,0,1} \right\rangle\) as the input state, where \(\left| + \right\rangle = 1/\sqrt 2 \left( {\left| 0 \right\rangle + \left| 1 \right\rangle } \right)\) to verify whether the prepared gate can manipulate the input state \(\left| { + ,0,1} \right\rangle\) correctly. The reason for verifying the performance of the prepared gate in manipulating the input state \(\left| { + ,0,1} \right\rangle\) is the fact that it is one of the most experimentally challenging cases that reflects the core quantum functionality of a Fredkin gate. The challenges originate from that it requires all three qubits to interact with each other which could generate a maximally entangled state at output ports. It is functionally important because it verifies the Fredkin gate’s ability to generate and control the entanglement, which is a key capability necessary for quantum computing. An ideal Fredkin gate can transform the input state \(\left| { + ,0,1} \right\rangle\) into a superposition state of \(\left| {001} \right\rangle\) and \(\left| {110} \right\rangle\). After projecting the control qubit C to \(\left| + \right\rangle\), the state of the two target qubits will become the Bell state \(\left( {\left| {01} \right\rangle + \left| {10} \right\rangle } \right)/\sqrt 2\), which is a superposition of the original quantum state of the two target qubits (\(\left| {01} \right\rangle\)) and the quantum state of the two target qubits after swapping (\(\left| {10} \right\rangle\)). The final output of this entangled state of the two target qubits embodies the core function of the Fredkin gate for its controlled-swapping operation. As shown in Fig. 3c, we measured the output state of the two target qubits in ZZ, XX and YY bases whereby Z, X and Y are Pauli operators. The fidelity with respect to the ideal Bell state was calculated as \(F = 0.70 \pm 0.03\), affirming the performance of the quantum action of our prepared Fredkin gate.

For the Toffoli gate, the input superposition states are chosen as \(\left| {1, + ,0} \right\rangle\) and \(\left| {0, + ,0} \right\rangle\) which theoretically give rise to the output state \(\left| 1 \right\rangle \left( {\left| {00} \right\rangle + \left| {11} \right\rangle } \right)/\sqrt 2\) and \(\left| 0 \right\rangle \left( {\left| {00} \right\rangle + \left| {10} \right\rangle } \right)/\sqrt 2\) after passing through the Toffoli gate. A maximum Bell state is generated between C2 qubit and T qubit when C1 is \(\left| 1 \right\rangle\) and a product state when C1 is \(\left| 0 \right\rangle\) which expresses the functionality of the Toffoli gate, i.e., the target qubit is only flipped when both control qubits are \(\left| 1 \right\rangle\). Figure 3d shows the results for the entanglement state C2 qubit and T qubit with corresponding detection of control qubit \(C_1 = \left| 1 \right\rangle\). The sampling time of the Toffoli gate is almost two times longer than that of the Fredkin gate for each basis. Thus, for the entangled state generated by the Toffoli gate, we only measured them in the ZZ and XX bases, whose data are enough to determine the lower bound on the fidelity of the entangled state29. The fidelity of the maximum two-qubit Bell state measured can be estimated to be \(F \ge 0.64 \pm 0.04\) which exceeds the entanglement limit 0.5 over 3 standard deviations. Figure 3e shows the coincidence results for the product state measured in the XZ basis with a calculated fidelity of \(F = 0.84 \pm 0.03\). These results manifest the good functions of qubit Toffoli gate for the superposition state.

Results for two-qubit gates

In order to realize the two-qubit logic gates, one correlated photon pair source is chosen as the resource which is injected into the 4 × 4 circuit constructed inside the 6 × 6 circuit. Here, we choose the controlled-NOT (CNOT) gate, controlled-Hadamard (CH) gate, \(\sqrt {{{{\mathrm{iSWAP}}}}}\) gate and quantum Fourier transformation (QFT) gate for experimental testing examples. The success post-selection probabilities for these gates are calculated to be \(1/9,1/9,0.17,0.09\), respectively. Our method achieves the same success probability with previous schemes for realizing the CNOT gate13,30,31. The matrix representations of these gates are listed in Supplementary Note 2. The evolution of a two-qubit state \({{{\mathrm{\rho }}}}\) after passing through a quantum logic gate is described by: \({{{\mathrm{\varepsilon }}}}\left( {{{\mathrm{\rho }}}} \right) = \mathop {\sum}\nolimits_{{{{\mathrm{m}}}},{{{\mathrm{n}}}} = 0}^{15} {{{{\mathrm{\chi }}}}_{mn}E_m{{{\mathrm{\rho }}}}E_n^{\dagger} }\), where \(E_m\) and \(E_n^{\dagger}\) are Kronecker product of Pauli operators, and \({{{\mathrm{\chi }}}}_{mn}\) is a 16 × 16 matrix which describes the process completely. By choosing the input state from the set \(\left\{ {\left| 0 \right\rangle ,\left| 1 \right\rangle ,\left| + \right\rangle ,\left| {{{\mathrm{R}}}} \right\rangle } \right\}\) for each qubit, we performed the quantum process tomography (QPT)8 for the constructed gates and obtained \({{{\mathrm{\chi }}}}_{exp}\) matrices and the process fidelity \(F_p = {{{\mathrm{Tr}}}}( {{{{\mathrm{\chi }}}}_{exp}{{{\mathrm{\chi }}}}_{ideal}} )\), where \({{{\mathrm{\chi }}}}_{ideal}\) is the ideal \({{{\mathrm{\chi }}}}\) matrix as shown in Fig. 4.

Fig. 4: Experimental results of quantum process tomography for a diversity of two-qubit quantum logic gates.
figure 4

CNOT gate (a), CH gate (b), \(\sqrt {{{{\mathrm{iSWAP}}}}}\) gate (c), QFT gate (d). The left and right parts are the real and imaginary parts of the quantum process tomography matrices. The fidelity errors are calculated with a 1000-times Monto Carlo simulation subjected to Poissonian statistics.

Discussion

The main noise in our experiment exists in the higher order photon pair emission which becomes distinct at a low collection efficiency and the distinguishability of the photon pair sources. Considering the high loss in the silicon chip including both the transmission loss and the coupling loss from the chip to the fiber, we can improve the experimental quality of our method by either using low-loss silicon nitride material (5 dB per meter)32 or the integration the SNSPD detectors on chip33. In addition, we can combine high efficiency and HOM interference visibility SPDC-based source2,34 with the reported ultralow coupling and transmission loss on a silicon nitride chip35, which can greatly increase the collection efficiency and the fidelity. With the precise thermal control36 of the programming nonunitary matrix and the improvement of the total efficiency, our method can be extended to the on-chip large-scale implementation of the n-qubit Toffoli gate. And also, there still left some open questions for future work: whether our method can be used to realize high-dimensional quantum logical gates37.

In conclusion, we have proposed a method to realize quantum logic gates and experimentally demonstrated proof-of-principle the three-qubit Fredkin gate and Toffoli gate with linear optics on chip, as well as a series of typical two qubit gates. The most important merit compared with the previous method to realize a three-qubit Fredkin gate10 is that we don’t need any pre-existing entanglement. It thus allows the constructed Fredkin gate can work as an independent device, which is more compatible with other optical systems, such as using the high efficiency quantum dot single photon sources as input qubits38,39. Our method will stimulate more efforts in building up manifold quantum circuits by means of integrated technologies, facilitating the development of future quantum processors.

Methods

Experimental setup

A pump laser with a central wavelength of 1550 nm and a pulse width of 2 ps is passed through an optical compressor to broaden its spectral width to 10 nm (see Supplementary Note 1.1 for details). By passing the laser through a wavelength-division multiplexing (WDM) with 0.8 nm channel spacing, two laser beams with central wavelengths of 1546.8 nm and 1553.2 nm are selected and then combined into a single beam by another WDM. A tunable optical delay is inserted between the two WDMs to ensure that the two beams are indistinguishable in time. The combined beam is then coupled into the silicon photonic chip by an optical fiber to generate the desired single photons through SFWM. After transforming through the on-chip optical circuit, the single photons are led out by the fiber array at the output. A WDM (isolation >100 dB, bandwidth 0.5 nm) is connected to each channel of the fiber array to filter out all unwanted light, thus extracting single photons with a central wavelength of 1550 nm and feeding them into SNSPDs with an average efficiency \(\sim 85\%\) for the detection. Taking into account the waveguide and optical element losses, the waveguide-to-fiber coupling losses, and the single-photon detection efficiency, the resulting single-photon heralding efficiency is 3%.

Fabrication

The source part and photonic circuit are fabricated on the 220 nm-thick silicon-on-insulator (SOI) platform. All phases are thermally adjusted by adding the current at each heater to facilitate the construction of programmable nonunitary matrix to realize the logic gates. The transmission loss of the silicon waveguide is 2 dB per centimeter, and the loss for each Mach-Zehnder interferometer (MZI) is ~0.3 dB.