Implementation of SWAP test for two unknown states in photons via cross-Kerr nonlinearities under decoherence effect

We present an optical scheme for a SWAP test (controlled swap operation) that can determine whether the difference between two unknown states (photons) using cross-Kerr nonlinearities (XKNLs). The SWAP test, based on quantum fingerprinting, has been widely applied to various quantum information processing (QIP) schemes. Thus, for a reliable QIP scheme, it is important to implement a scheme for a SWAP test that is experimentally feasible. Here, we utilize linearly and nonlinearly optical (XKNLs) gates to design a scheme for a SWAP test. We also analyze the efficiency and the performance of nonlinearly optical gates in our scheme under the decoherence effect and exhibit a technique employing quantum bus beams and photon-number-resolving measurements to reduce the effect of photon loss and dephasing caused by the decoherence effect. Consequently, our scheme, which is designed using linearly optical devices and XKNLs (nonlinear optics), can feasibly operate the nearly deterministic SWAP test with high efficiency, in practice.


Scheme of SWAP test via XKNLs and linearly optical effect
First, we introduce the concept of a SWAP test (controlled swap operation) to determine whether two unknown states (|ψ〉 and |ϕ〉) are different. Figure 1 shows a schematic SWAP test and a theoretical SWAP test, consisting of two controlled-NOT (CNOT) gates (two-qubit operation) and one Toffoli gate (three-qubit operation) 55 . The two SWAP tests in Fig. 1 are equivalent in terms of the two output states. Let us assume that the input states are ψ α β B (two unknown states: we want to distinguish), and |0〉 C (control qubit: ancillary qubit), as described in Fig. 1 Figure 1. This plot describes a schematic SWAP test and a theoretical SWAP test using CNOT (two-qubit) and Toffoli (three-qubit) gates. The theoretical SWAP test is designed to utilize multi-qubit (two-and three-) controlled gates from the schematic SWAP test, in theory. Actually, the output state from the theoretical SWAP test is the same as the result state of the schematic SWAP test.
When the ancillary qubit, C, is measured, we can determine that two unknown states, A and B, are identical or not, according to Eq. 1. If the two unknown state are the same ( ψ ϕ = A B ), the result of measurement in the ancillary state is |0〉 C with probability 1 because the result state is ψ ϕ ⊗ 0 A B C . In another case, ψ ϕ ≠ A B , the probabilities of the result state in |0〉 C and |1〉 C of the ancillary qubit are φ ψ + 〉 (1 )/2 2 and φ ψ − 〉 (1 )/2 2 from Eq. 1, respectively. Thus, if the result of the ancillary qubit is in state |1〉 C , we can be convinced that two unknown states are different. Consequently, we can determine the result of the difference in the two unknown states with reliability through the SWAP test, in principle.
To determine the performance property of nonlinearly optical (path-parity and path-merging) gates using XKNLs, we introduce the Hamiltonian, H Kerr , of the XKNLS effect (H Kerr = ℏχN 1 N 2 for N i : photon number operator, and χ: strength of nonlinearity in a Kerr medium). The unitary operation  of the XKNL is expressed as between the photon (|n〉 1 : photon number state) and the coherent state (|α〉 2 : probe beam), where θ ( = χt) is the magnitude of the conditional phase shift caused by XKNL, and t is the interaction time in a Kerr medium.
From now on, we propose an optical scheme of the SWAP test to be implemented using XKNLs (nonlinear optics) and the HOM effect (linear optics), as described in Fig. 2 Then, two photons (A and B) in this state, |Φ 1 〉 ABC , are injected to the path-parity gate (1) using XKNLs, qubus beams, and PNR measurement, as described in Fig. 3. After the operation on the state |Φ 1 〉 ABC in Fig. 3, the state, Φ ⊗ 2 CAB P (pre-measurement) from path-parity gate (1) is expressed as Figure 2. Schematic plot of SWAP test (controlled swap gate): This scheme consists of two path-parity gates (1 and 2) and two path-merging gates (1 and 2) using XKNLs, and an HOM gate using the HOM effect with linearly optical devices. As a result of the outcome of measurement of photon C (ancillary photon), this scheme (SWAP test) can make a comparison to determine if two unknown states of photons (A and B) are different. Multi-qubit gates via XKNLs are utilized in our SWAP test for experimental realization.
n n n 1 ABC path parity gate(1) for α ∈ R. When the PNR measurement [For precisely measuring photon number, we use the quantum non-demolition detection 28,29,31,41 using positive-operator-value measurement (POVM) elements: APPENDIX (A)] is applied in the coherent state (probe beam) of path b, if the outcome is dark detection, 0 P b , the output state, |Φ 2 〉 CAB , is acquired as . Also, if the result is the state n P b (n ≠ 0), the output state can be transformed to the state |Φ 2 〉 CAB (dark detection) by feed-forward [PS, and path switch: APPENDIX (B)] in terms of the result (photon number n) on path b. Subsequently, the states of photons (A and B) on path 2 in the state |Φ 2 〉 CAB will be exchanged (swapped) to the state |Φ 3 〉 CAB after passing through the HOM gate, as follows: where the HOM gate (linear optics) using the HOM effect 54 , in Fig. 3, performs the swap operation. Consequently, the output state, |Φ 3 〉 CAB is transformed to the form (Eq. 4) having the same path (1 or 2) between two photons (A and B) by path-parity gate (1), and also the state of the two photons on path 2 are swapped by the HOM gate. Then, three photons (A, B, and C) in this state, |Φ 3 〉 CAB , pass through path-parity gate (2) using XKNLs, qubus beams, and PNR measurement, as described in Fig. 4. After the operation, shown in Fig. 4 www.nature.com/scientificreports www.nature.com/scientificreports/ When the PNR measurement is applied in the coherent state (probe beam) of path b, if the outcome is dark detection, 0 P b , the output state, |Φ 4 〉 CAB , is acquired as . Also, if the result is the state n P b (n ≠ 0), the output state can be transformed to the state |Φ 4 〉 CAB (dark detection) by feed-forward (PS, SF, and path switch) with regard to the result (photon number n) on path b. Then, after the photon C in the state |Φ 4 〉 CAB passes through PBS in path-parity gate (2), the output state, |Φ 5 〉 ABC , is expressed as Subsequently, for the merging paths (1 and 2) of photon A in Eq. 6, the state |Φ 5 〉 ABC passes through path-merging gate (1). After the operation, shown in Fig. 4, of path-merging gate (1) on the state |Φ 5 〉 ABC , the state, Φ ⊗ 6 ABC P (pre-measurement), is given by n n 5 ABC merging parity gate(1) According to the result of PNR measurement in the coherent state (probe beam) of path b, the output state is obtained as without feed-forward or with feed-forward (PF and path switch). Also, as described in Fig. 4, the state |Φ 6 〉 ABC will be expressed as Φ ⊗ 7 ABC P (pre-measurement) after the path-merging gate (2) regarding photon B, as follows: Then, through the PNR measurement and feed-forward (PF and path switch) in path-merging gate (2), the output state is given by www.nature.com/scientificreports www.nature.com/scientificreports/ From the input state, ψ ϕ ⊗ R A 1 B 1 C 1 , this output state, |Φ 7 〉 ABC , in Eq. 9 is transformed by passing the nonlinearly and nearly optical gates (path-parity, path-merging, and HOM gates). Finally, the final state, |Φ f 〉 ABC , is the same as the output state of the SWAP test in Fig. 1 after CPBS operates on photon C of the output state, |Φ 7 〉 ABC , as follows: Consequently, we can determine that two unknown states, A and B, are identical or not through the final state |Φ f 〉 ABC , in Eq. 10, which is generated by our optical scheme in Fig. 2. In our schematic SWAP test, the nonlinearly optical gates (two path-parity and two path-merging gates) are critical components for implementing the SWAP test. Thus, to ensure the high efficiency of these gates, the error probabilities (P err P : path-parity gate and P err M : path-merging gate) can be estimated by the probability to measure 0 P b (dark detection) in α θ ±i sin P b on path b of the qubus beams (Figs 3 and 4), as follows: . Moreover, when we increase the amplitude of the coherent state or magnitude of the conditional phase shift in nonlinearly optical gates, the error probabilities (P err P and P err M ) can approach zero. So far, we have presented an optical scheme to implement a SWAP test using nonlinearly optical gates (XKNLs, qubus beams, and PNR measurement) and a linearly optical gate (HOM gate) to determine if two unknown states are identical or not. However, because of the use of XKNLs in our scheme, the decoherence effect (photon loss and dephasing), which can induce the evolution of a quantum pure state into a mixed state, occurs in nonlinearly optical gates (path-parity and path-merging gates) when our scheme is experimentally realized in practical optical fibers 56,57 . Thus, we propose a method 26,27,32 for the nonlinearly optical gates (via XKNLs, qubus beams, and PNR measurement) to obtain robustness against the decoherence effect.

Analysis of path-parity and path-merging gates under decoherence effect
The nonlinearly optical (path-parity and path-merging) gates consist of the interactions of XKNLs, qubus beams (coherent state), and PNR measurements and are essential components for implementing the proposed SWAP test (controlled swap operation) scheme. However, in optical fibers 56,57 , photon loss (increasing error probability) in the probe beam and dephasing coherent parameters in the photon-probe system (decreasing the fidelity of the output state) occur because of the decoherence effect 26,27,32,52,53 when nonlinearly optical (path-parity and path-merging) gates are implemented in our SWAP test scheme, in practice. Thus, we need to analyze the efficiency (related to photon loss) and performance (related to dephasing) of nonlinearly optical gates, using XKNL, under the decoherence effect, and we also should demonstrate path-parity and path-merging gates, in our scheme, having high efficiency and high fidelity (performance) against the decoherence effect by the utilization of a coherent state with a large amplitude 26,27,32 .
We introduce the solution of the master equation 58 , which can describe the open quantum system (nonunitary operation), for analysis of the decoherence effect in a Kerr medium, as follows: where γ, t (=θ/χ), and a + (a) are the energy decay rate, the interaction time, and the creation (annihilation) operator. The solution of the master equation can be written as 58 . For application in the analysis of nonlinearly optical (path-parity and path-merging) gates, we show the process model 26,27,32 of the interaction of XKNLs and the decoherence effect (photon loss and dephasing) using the solution from the master equation (Eq. 12). We assume that the initial state (photon-probe system) is , and the interaction of XKNL (conditional phase shift: H e U Kerr i ) can be operated on the probe beam (coherent state) if the control photon's polarization is H (horizontal). After the interaction of XKNL, ∼ X t , and the decoherence effect, ∼ D t , which can be described as α β αβ , for interaction time t (=θ/χ), the output state can be represented by the solution of the master equation, as follows: where Λ t = e −γt/2 is the rate of remaining photons resulting from photon loss. The coefficient on the right hand side in Eq. 14 is the coherent parameter, which can quantify the degree of dephasing. Note that the operation of the decoherence effect, ∼ D t occurs with the interaction of XKNL, ∼ X t , in this process. For a good approximation of www.nature.com/scientificreports www.nature.com/scientificreports/ the process model of the interaction of XKNLs and the decoherence effect, we can take an arbitrarily small time, Δt (=t/N [) 26,27,32 , for the interaction of XKNL between photons and probe beam in a Kerr medium. Finally, equation 14 can be transformed to the process model 26,27,32 to analyze the efficiency and performance of nonlinearly optical (path-parity and path-merging) gates, as follows: N , and θ = χt = χNΔt = NΔθ for small time, Δt (=t/N), and α ∈ R. Also, an optical fiber, in which the nonlinearly optical gate using XKNLs is realized, of approximately 3000 km is required to acquire the magnitude of the phase shift, θ = π, of the XKNL 56,57 . For analysis of the efficiency and performance of nonlinearly optical gates, based on the process model (Eqs 13 and 15) under the decoherence effect, we use commercial fibers 56,57 with a signal loss of 0.364 dB/km (χ/γ = 0.0125) and pure silica core fibers 57 with a signal loss of 0.15 dB/ km (χ/γ = 0.0303), representing current technology. (1 and 2). When the path-parity gates (1 and 2) are implemented in an optical fiber 56,57 , we should consider how the decoherence effect (photon loss and dephasing) affects the efficiency and performance of the output states. Thus, the output states ( Φ ⊗ 2 CAB P in Eq. 3 and Φ ⊗ 4 CAB P in Eq. 7) of path-parity gates (1 and 2) will be modified into the form of a density matrix, as a result of the decoherence effect, as follows:

Path-parity gates
where Λ = e −γt/2 is the rate of remaining photons resulting from photon loss. Regarding the above equations (15 and 16), the forms of the two output states ( Φ ⊗ 2 CAB P and Φ ⊗ 4 CAB P ) are identical, Eq. 15, but have different basis sets, Eq. 16. Also, using the process model (Eq. 14), the coherent parameters (C, O, L, K, and M) in Eq. 15 are given by ( 1) ( ) www.nature.com/scientificreports www.nature.com/scientificreports/ N , and θ = χt = χNΔt = NΔθ for small time, Δt (=t/N), and α ∈ R. We can quantify the degree of dephasing to evolve a pure state into a mixed state using the coherent parameters in Eq. 15.
First, for the analysis of the efficiency of the path-parity gate, we fix the parameter value, αθ = αχt = 2.5, for < − P 10 err P 3 (which is the error probability, Eq. 11, without the decoherence effect), and assume that the path-parity gate is operated in optical fibers 56,57 having signal losses of 0.364 dB/km (χ/γ = 0.0125) and 0.15 dB/ km (χ/γ = 0.0303). Figure 5 represents the modified error probability, P err PP , of the output state, ρ ⊗ CAB P 2 or ρ ⊗ CAB P 4 , and the rate, Λ t 4 , of the remaining photons in the probe beam against the decoherence effect caused by optical fibers having signal losses of 0.364 dB/km (χ/γ = 0.0125) and 0.15 dB/km (χ/γ = 0.0303). Because of the decoherence effect, the error probability, P err PP , of the output state, ρ ⊗ where Λ = e −γt/2 (the rate of remaining photons) with αθ = αχt = 2.5, and the signal loss of 0.364 dB/km (χ/γ = 0.0125) and 0.15 dB/km (χ/γ = 0.0303), depending on the optical fibers 56,57 . When increasing the amplitude of the coherent state (probe beam), the error probability, P err PP , can be decreased, and also the rate, Λ t 4 , of remaining photons can approach 1 with reliable PNR measurement, as described in Fig. 5. In addition, the values of the rate, Λ t 4 , of remaining photons and the error probability, P err PP , with respect to the signal loss rates of optical fibers and the amplitude of coherent states (100 ≤ α ≤ 80000), are listed in the Table of Fig. 5. Consequently, by our analysis (using the process model, Eq. 14), the values in the , with fixed αθ = αχt = 2.5 in optical fibers when we employ a coherent state with a strong amplitude, α > 80000(probe beam) under the decoherence effect.
Second, for analysis of the performance of the path-parity gate under the decoherence effect, we should consider the values of coherent parameters, which can quantify the amount of evolution of the pure state into the mixed state, in Eq. 15, and we also should calculate the fidelities between the density matrices (ρ ⊗  www.nature.com/scientificreports www.nature.com/scientificreports/ parameters by dephasing via our process model, Eq. 14. As described in Fig. 6, the absolute values of coherent parameters (the off-diagonal terms, |KC| 2 , |OC| 2 , |MC| 2 , and |L| 2 in ρ ⊗ CAB P 2 and ρ ⊗ CAB P 4 ) will approach 1 according to our the process model (Eq. 14) with increasing amplitude of the coherent state (probe beams) for αθ = αχt = 2.5 and N = 10 3 (for a good approximation) in optical fibers 56,57 having signal losses of 0.364 dB/km (χ/γ = 0.0125) and 0.15 dB/km (χ/γ = 0.0303). Finally, in Fig. 6, when the path-parity gates are experimentally implemented in optical fibers, we can retain the output states as pure states (the absolute values of coherent parameters are 1) by utilizing the strong amplitude of the coherent state with fixed αθ = αχt = 2.5 and N = 10 3 . Figure 7 shows the diagrams of the values of coherent parameters in ρ ⊗ CAB P 2 and ρ ⊗ CAB P 4 (shortly ρ ⊗ CAB P 2 or 4 ) and fidelities (F PP ), according to the amplitude (α = 100, 10 4 ) of the coherent state with αθ = αχt = 2.5 and N = 10 3 in optical fibers having signal losses of 0.364 dB/km (χ/γ = 0.0125) and 0.15 dB/km (χ/γ = 0.0303). The fidelity, F PP , between the output states ( Φ ⊗ 2 CAB P and Φ ⊗ 4 CAB P without the decoherence effect) and the density matrices (ρ ⊗ CAB P 2 or 4 : under the decoherence effect) is given by where C, O, L, K, and M are the coherent parameters in Eq. 17. As described in Fig. 7, we can confirm the high fidelities (F PP > 0.9) of the output states when utilizing the strong amplitude of the coherent state (α > 10 4 ). The various values of fidelities and the required magnitude of conditional phase shifts (θ = χt), according to the amplitudes of the coherent state with αθ = αχt = 2.5 and N = 10 3 , are summarized in the Table in Fig. 7. From this result (using the strong coherent state), we can obtain two advantages for reliable performance of path-parity gates: (1) high fidelity -According to our process model, the coherent parameters in output states, ρ ⊗ CAB P 2 or 4 , approach 1 to maintain pure states. Specifically, we can avoid the evolution into mixed states induced by dephasing of coherent parameters; (2) feasible implementation -The magnitude of the conditional phase shift in nature is tiny, θ ≈ 10 −18 59 , although it can be increased by electromagnetically induced transparency, θ ≈ 10 −2 43,60 . By our analysis, the magnitude of the conditional phase shift is required to be small with fixed αθ = αχt = 2.5 and N = 10 3 when increasing the amplitude of the coherent state (i.e., if α = 80000 in the optical fiber with signal loss of 0.15 dB/km, then F PP~0 .999 and θ ~ 3.12 × 10 −5 , as listed in the Table of Fig. 7). Thus, when we employ the strong coherent state (probe beam), path-parity gates are feasible to experimentally realize in practice because of the small conditional phase shift.
Path-merging gates (1 and 2). We should also consider the effect of decoherence in the path-merging gates (1 and 2) on the efficiency and performance of the output states. The output states ( Φ ⊗ 6 ABC P in Eq. 7, and Φ ⊗ 7 ABC P in Eq. 8) of the path-merging gates (1 and 2) should be modified by the decoherence effect as follows:  , according to the amplitude of the coherent state with αθ = αχt = 2.5 and N = 10 3 in optical fibers 56,57 . Using our process model (Eq. 14), the absolute values of coherent parameters will approach 1 with increasing amplitude of the coherent state (α > 8000) in optical fibers with signal losses of 0.364 dB/km (χ/γ = 0.0125) and 0.15 dB/km (χ/γ = 0.0303).
First, for the analysis of the efficiency of the path-merging gate, comparing the error probability, P err PM in Eq. 11, without the decoherence effect, we should recalculate the error probability, P err PM , of the output state, ρ ⊗ ABC P 6 and ρ ⊗ ABC P 7 including photon loss, as follows: = . . where Λ = γ − e t t/2 (the rate of remaining photons) with αθ = αχt = 2.5, and signal losses of 0.364 dB/km (χ/γ = 0.0125) and 0.15 dB/km (χ/γ = 0.0303), depending on the optical fibers 56,57 . In Fig. 8  . Consequently, as with the path-parity gates (1 and 2), the values in the Table in Fig. 8 show that high efficiency, < − P 10 err PM 3 and a high rate of remaining photons Λ → 1 t 2 , with fixed αθ = αχt = 2.5 in optical fibers can be acquired, through our analysis (Eq. 14), using a coherent state with strong amplitude, α > 80000 (probe beam), under the decoherence effect. Second, for the analysis of the performance of the path-merging gate under the decoherence effect, we should analyze the absolute value of the coherent parameter, |C| 2 , in ρ ⊗ ABC P 6 and ρ ⊗ ABC P 7 (shortly ρ ⊗ ABC P 6 or 7 ), and the fidelities, F PM , in optical fibers 56,57 having signal losses of 0.364 dB/km (χ/γ = 0.0125) and 0.15 dB/km (χ/γ = 0.0303). As described in Fig. 9, the absolute values of the coherent parameter, |C| 2 , increase to maintain the output states (ρ ⊗ ABC P 6 or 7 ) in pure states (elimination of dephasing) by the strong coherent state under the decoherence effect, in  Table as calculated using our process model (Eq. 14) with αθ = αχt = 2.5 and N = 10 3 in optical fibers. If the amplitude of the coherent state increases, the fidelities increase (F PP → 1) and the magnitude of conditional phase shifts decrease (θ = χt → small), indicating reliable performance of the path-parity gates.
www.nature.com/scientificreports www.nature.com/scientificreports/ practice (optical fibers). This result, suggesting that a strong coherent state should be utilized for the reduction of dephasing, is the same as the result of path-parity gates by our analysis. Also, in the diagrams and Table of Fig. 9, the fidelity, F PM , of the density matrices (ρ ⊗ ABC P 6 or 7 : under the decoherence effect) is calculated as Finally, for the reliable performance (high fidelity, and weak XKNL: small magnitude of conditional phase shift) of path-merging gates, we should increase the amplitude of the coherent state for αθ = αχt = 2.5 and N = 10 3 when experimentally implemented path-merging gates under the decoherence effect, as described in Fig. 9.
Consequently, according to our analysis (the process model based on the master equation), we demonstrate that the utilization of the strong (increasing amNplitude) coherent state in nonlinearly optical gates (path-parity and path-merging gates in our SWAP test) will bring about high efficiency (small error probabilities) and reliable performance (robustness: high fidelities, and feasibility: weak XKNLs) with respect to the decoherence effect.

Conclusions
We presented an optical scheme for the SWAP test (controlled swap operation), via nonlinearly optical (path-parity and path-merging) gates and a linearly optical (HOM) gate, to definitely determine whether the difference between two unknown states in Sec. 2. We also demonstrated a method, which should utilize a strong coherent state according to our analysis, to obtain high efficiency (low error probability) and reliable performance (high fidelity) in nonlinearly optical gates under the decoherence effect, in Sec. 3. Therefore, the proposed scheme (SWAP test via weak XKNLs, qubus beams, and PNR measurements) has the following advantages: (1) When presented with the question of whether two unknown states are equal or not, the SWAP test can determine with certainty whether two unknown states are different in various QIP schemes (quantum communications: quantum authentication, quantum signature, and quantum computation: quantum machine learning, and Fredkin gate). Thus, we proposed a deterministic (determination of difference between two unknown states) and feasible (experimental implementation) scheme for the SWAP test using weak XKNLs, qubus beams, and PNR measurements. (2) In this paper, we demonstrated that nonlinearly optical (path-parity and path-merging) gates, which are designed using XKNLs, qubus beams, and PNR measurement, should employ a coherent state with a strong amplitude to obtain high efficiency (low error probability) and reliable performance (high fidelity) according to our analysis using the process model in Sec. 3. In the previous works 23,24,[28][29][30] , which have proposed the various nonlinearly optical gates (including to path-parity and path-merging gates), for quantum information processing schemes, the affection of the decoherence effect, in practice, have been overlooked.

Figure 8.
Graph represents the modified error probability, P err PM , and the rate of remaining photons, Λ t 2 in pathmerging gates (1 and 2) for αθ = 2.5 with optical fibers having signal losses of 0.364 dB/km (χ/γ = 0.0125) and 0.15 dB/km (χ/γ = 0.0303). In the other graph (red box), the values and plots of error probabilities depending on optical fibers are expressed in the range of amplitude of the coherent state (300 < α < 1300). Also, the values of the error probabilities and the rates of remaining photons are provided in the Table for the difference in amplitude of the coherent states with αθ = 2.5.
www.nature.com/scientificreports www.nature.com/scientificreports/ Compared with these works [28][29][30] , we analyzed the decoherence effect by master equation, and derived the method, using strong coherent state, to reduce photon loss and dephasing (decoherence). Thus, when our scheme for the SWAP test is experimentally realized, it will be robust against the decoherence effect (photon loss and dephasing).
(3) Through the analysis in Sec. 3, we showed that our scheme (nonlinearly optical gates) require the small magnitude of the conditional phase shift (θ), as described in Figs 7 and 9, because the conditional phase shift from Kerr media is extreme small 59 , and difficult to increase by electromagnetically induced transparency 43,60 . But our gates, compared with the former works 23,24,[28][29][30] , can obtain the high efficiency and reliable performance with tiny magnitude of conditional phase shift by utilizing the strong coherent state (for the reduction of decoherence effect), according to our analysis in Sec. 3. Therefore, when we employ the strong coherent state (probe beam), path-parity and path-merging gates are feasible to experimentally realize in practice because of the small conditional phase shift. (4) In our scheme, the designed nonlinearly optical gates employ qubus beams and the strategy of PNR measurement. Therefore, we employed only positive conditional phase shifts (θ) by XKNL in path-parity and path-merging gates. Kok in ref. 61 . showed that it is generally not possible to change the sign of the conditional phase shift (−θ). Thus, our nonlinearly optical gates using only positive conditional phase shifts (θ) with qubus beams and PNR measurement are more feasible than other nonlinearly optical gates 26,27,32,39,40 that use the negative conditional phase shift (−θ). (5) As for a minor issue, because PNR measurements are applied on the probe beam of path b in all nonlinearly optical gates, the probe beam of path a can be recycled for other nonlinearly optical gates (if desired) for a more efficient implementation.
Consequently, we demonstrate that our scheme for the SWAP test to determine whether the difference between unknown states, using weak XKNLs, qubus beams, and PNR measurements, can be experimentally realized and is immune to the decoherence effect in optical fibers.