Non-Markovianity-assisted high-fidelity Deutsch-Jozsa algorithm in diamond

The memory effects in non-Markovian quantum dynamics can induce the revival of quantum coherence, which is believed to provide important physical resources for quantum information processing (QIP). However, no real quantum algorithms have been demonstrated with the help of such memory effects. Here, we experimentally implemented a non-Markovianity-assisted highfidelity refined Deutsch-Jozsa algorithm (RDJA) with a solid spin in diamond. The memory effects can induce pronounced nonmonotonic variations in the RDJA results, which were confirmed to follow a non-Markovian quantum process by measuring the non-Markovianity of the spin system. By applying the memory effects as physical resources with the assistance of dynamical decoupling, the probability of success of RDJA was elevated above 97% in the open quantum system. This study not only demonstrates that the non-Markovianity is an important physical resource but also presents a feasible way to employ this physical resource. It will stimulate the application of the memory effects in non-Markovian quantum dynamics to improve the performance of practical QIP.

However, quantum superposition and correlation are fragile in an open quantum system. Notorious decoherence [17][18][19], which is caused by interactions with noisy environments, is a major hurdle in the realization of faulttolerant coherent operation [20,21] and scalable quantum computation. To further expand the implementation of QIP in open quantum systems, full understanding and control of environmental interactions are required [4,17,22,23]. Many techniques have been developed to address this issue, including decoherence-free subspaces [25], dynamical decoupling (DD) [1,13] and the geometric approach [27]. However, actively utilizing the environmental interactions would represent a significant achievement, compared with passively shielding them.
Usually, the interaction of an open quantum system with a noisy environment exhibits memory-less dynamics with an irreversible loss of quantum coherence, that can be described by the Born-Markov approximation [28]. However, because of strong system-environment couplings, structured or finite reservoirs, low temperatures, or large initial system-environment correlations, the dynamics of an open quantum system may deviate substantially from the Born-Markov approximation and follow a non-Markovian process [8,[28][29][30]32]. In such a process, the pronounced memory effect, which is the primary feature of a non-Markovian environment, * fwsun@ustc.edu.cn can be used to revive the genuine quantum properties [8,[28][29][30][32][33][34], such as quantum coherence and correlations. Consequently, improving the performance of QIP by utilizing memory effects as important physical resources in the non-Markovian environment is crucial [35,36]. However, no real quantum algorithms have been demonstrated with the help of such memory effects. Here, we first investigated the memory effects of non-Markovian environments using the quantum Deutsch-Jozsa algorithm [37] with a solid spin in a diamond nitrogen-vacancy (NV) center. The memory effects were further applied as important physical resources [28] to substantially improve the performance of the quantum algorithm with the assistance of the DD protection method [1].
The Deutsch-Jozsa algorithm [5][6][7], which can be used to determine whether a coin is fair or fake in a single examination step [6,41], is one of the seminal algorithms used to demonstrate the advantages of quantum computations. Experimentally, the refined Deutsch-Jozsa algorithm (RDJA) [5][6][7] was implemented with a single spin qubit of the NV center to study the memory effect of a non-Markovian environment, with a bidirectional flow of information between the spin qubit and the spin bath, as shown in Fig.1a. The probability of success (POS) of RDJA presents an unexpected non-monotonic dependence on the delay time of the measurement, that is induced by memory effects of the environment and further confirmed by the non-Markovianity measurement of the open quantum system [8,29]. Based on a complete understanding of the non-Markovian environment, we took advantage of the memory effect by applying the DD protection method [1] to significantly enhance the POS of the RDJA to above 97% in a realistic solid spin system. This result represents a substantial improvement over previous results [7,43] The single spin qubit of the NV center was used to study the memory effect of a non-Markovian environment with a bidirectional flow of information between the spin qubit and the spin bath.

Quantum qubit in diamond and RDJA
An NV center in diamond with an electron spin S = 1 was applied for the RDJA implementation at roomtemperature. The m s = +1 and m s = −1 energy level degeneracy was lifted by applying a magnetic field along the symmetry axis of the NV center.
By tuning the microwave (MW) frequency to be resonant with m s = 0 ↔ m s = +1, these two spin states in the NV center could be encoded as qubit |0 and |1 , respectively [42]. As shown in Fig.1, 532 nm laser pulses were used for the initial spin state (|0 ) preparation and final state readout. The RDJA can be decomposed into two different unitary transformations: rotation operation and phase-controlled gate [6,7,43]. The rotation operation can be realized by a (π/2) X pulse resonant with the transition between |0 and |1 . Here φ X(Y ) denotes the rotation with angle φ around the X(Y ) axis. The phase gates were realized with U = (−π/2) X (φ) Y (π/2) X , where φ = 0, 2π for constant operations (U 1 and U 2 ) and φ = 3π, π for balanced operations (U 3 and U 4 ) in the RDJA. After taking the commutation relations of Pauli matrices, unitary gates of the RDJA were constructed experimentally, as shown in Fig.1b. Finally, another (π/2) X was applied with delay time τ immediately after MW operations to transfer the relative phase between |0 and |1 to the spin population for the quantum state measurement.
In theory, when balanced operations of the RDJA are applied, the ideal results for the NV center remain in the bright state |0 . The POS corresponds to P 0 = tr(|0 0| ρ), where ρ is the state after operations. The dark state |1 occurs for constant operations with the POS P 1 = tr(|1 1| ρ) = 1 − P 0 . The results of applying the RDJA to a single NV center are shown in Fig.1c. The POS of the RDJA is the contrast between the results of constant and balanced operations, where the contrast (P 0(U3) − P 0(U1) ) between U 3 and U 1 is shown in Fig.1d. Clearly, the POS of the constant (U 1 and U 2 ) operations, balanced (U 3 and U 4 ) operations, and RDJA show prominent oscillations with the delay time of the measurement. This result obviously contradicts previous results [6,43]. In the Born-Markovian decoherence region [44], as the duration of the interaction of the quantum system with the environment increases, the degeneration of the coherence of the quantum system also increases. Consequently, the POS should decrease monotonically with the delay time of the measurement. Moreover, we also observed that quantum RDJA is worse than the classical method when the contrast is less than 50% and completely fails when the contrast is negative as shown in Fig.1d. However, with an appropriate delay, the maximal POS is achieved, as shown by the green arrow in Fig.1d.

Non-Markovian effect of noise environment on RDJA
These nontrivial phenomena deviate mainly from the quantum Born-Markovian process [8,[28][29][30] and reflect the occurrence of non-Markovian dynamics. To confirm this supposition and study how the memory effects of the environment affect the RDJA, we measured the non-Markovianity of the quantum system by employing the trace distance method [8,9,29], which is given by where is the rate of the change of the trace distance, and D(ρ 1 , ρ 2 ) = ρ 1 − ρ 2 /2, for the two states ρ 1 and ρ 2 . When N > 0, the interaction process is non-Markovian. To experimentally characterize a non-Markovian quantum dynamics, optimal state pairs [46], | = √ 2/2 (|0 − i |1 ) and | = √ 2/2 (|0 + i |1 ), were experimentally prepared. After the system had interacted with the environment, quantum state tomography was performed to analyze the dynamics of the quantum system [42], as presented in Fig.2a. Fig.2b shows that the trace distance of the electron spin NV center decreases non-monotonically with the spin bath interactions. This behavior was the characteristic of the non-Markovianity of the environment. The measured value of the non-Markovianity is N = 1.96 ± 0.14, which is much larger than 0 and confirms that this environment is non-Markovian.
This non-Markovian environment of the NV center can be further characterized using a triple-mode spin bath [42]. The experimental data in Fig.2b can be fitted with D(ρ 1 , ρ 2 ) = (a + b cos(2π∆t))e −t 2 /T 2 , where a and b relate to the mode density distribution of reservoir, and T relates to the width of reservoir. We obtained a = 0.105± 0.002, b = 0.218 ± 0.003, the splitting of the triple-mode reservoir ∆ = (2.170 ± 0.005) MHz and T = 1382 ± 31ns. So the width of each modes was 724 ± 16 kHz. From the type of lineshape which can be explained by coupling with a dark spin 1 system, the non-Markovian dynamics is from the coupling between the intrinsic 14 N nuclear spin and the electron spin in NV center. In fact, if the quantum operations are ideal, the RDJA process is similar to the preparation of optimal state pairs for the measurement of non-Markovianity. The oscillation of the trace distance and POS of RDJA implementation is identical, as shown in Fig.1d and Fig.2b by taking P 0(U3) − P 0(U1) . The non-monotonic behavior can be interpreted as a bidirectional flow of information between the electron spin of the NV center and the spin bath, which induces the distance between the two states to decrease or increase. Because the rate of information exchange is on the same order of magnitude as the coherent operation speed, the flow of information begins and tightly accompanies with the RDJA implementation. Therefore, the maximal POS for the RDJA cannot be obtained using a delay of τ = 0ns. Indeed, an appropriate delay (τ = 400ns) is required to achieve the maximal POS when the information reflows from the environment, as shown in Fig.1d.
The performance of DD-protected RDJA under a non-Markovian environment.
The RDJA achieves a POS of approximately 78%, which is relatively high [6,7,43]. However, a recent study revealed that the memory effects of a non-Markovian environment can be regarded as important physical resources [28,33] to improve QIP in an open quantum system. To further enhance the POS of the RDJA, we utilized the memory effects of the non-Markovian environment, which can be extracted by the DD method [1,7] to mitigate imperfect operations and decoherence.
As shown in Fig.3a, a single π pulse between the RDJA and the measurement was applied to construct the simplest DD sequences: spin echo. Without complex design sequences [1], the DD-protected RDJA can be implemented in 700 ns which is mainly limited by the Rabi frequency. Fig.3b shows the results of the implementation of the DD-protected RDJA, where the positive and negative echoes correspond to the constant and balanced functions, respectively. Because balanced and constant operations are different in the quantum circuits, as shown in Fig.3a, the echoes in these operations are expected to appear at different absolute times. Thus we shift each result to facilitate interpretation [7]. Similar to the original results as shown in Fig.1c, the POS also oscillates with the delay time of the measurement because of the non-Markovianity of the environment. However, corrected results can be obtained at the echo delay time, when t = 76, 170, and 400 ns. When t = 170 ns, which corresponds to the failed operation shown in Fig.1d, we obtained a perfectly corrected result via the assistance of the non-Markovian environment [42], as presented in Fig.3b.
The maximal POS exceeds 97% in the DD-protected RDJA. Moreover, the contrast between the next local maximum and minimum, which correspond to constant and balance operations, also exceeds 50% as shown in Fig. 3b. This finding indicates that the DD protection method can enhance the fidelity of coherent operation and extend the detection region under non-Markovian environment.
Transition from a non-Markovian to a Markovian environment.
Generally, the non-Markovianity of the present NV center system, which arises from the structured environments, leads to a non-monotonic dependent relationship between the POS of the RDJA and the delay time of the measurement. Therefore, a non-monotonic behavior can be changed by polarizing the spin bath in diamond [47][48][49].
Here we adopted this strategy [47-50] by making use of a level anti-crossing in the excited state of the NV center to polarize the nuclear spins in diamond. By applying magnetic field along the axis of NV center, the tripe-mode spin bath was converted to a single mode system, as shown in Fig.4a,b. Fig.4c shows that the non-Markovianity of spin bath decreases as the magnetic field magnitude increases, while maintaining its orientation along the symmetry axis of the NV center. When the magnetic field exceeded 35 mT, we realized the transition from non-Markovian to Markovian dynamics in realistic solid spin system at room-temperature [42]. Since such a non-Markovian environment of NV center is caused by coupling with the single intrinsic 14 N spin, the transition is always same for different single NV centers in diamond. In a Markovian environment, the information re-flow is turned off from spin bath to the electron spin of the NV center. Therefore, the POS of the RDJA decreases monotonically with the delay time of the measurement [6,43] as shown in Fig.4d. Because of the partial polarization of the spin bath, the maximal POS increases to 86% compared with the result obtained in the non-Markovian environment without delay.

Discussion
We first studied the memory effects of non-Markovian quantum dynamics on the RDJA with a realistic solid spin system in diamond. The POS of the RDJA exhibits non-monotonic dependence on the delay time of the measurement. Specifically, we observed that the RDJA would be better than the classical method or fail completely depending on the delay time of the measurement. The POS was elevated beyond 97%, much higher than a sim-ilar result obtained previously [7,43], by utilizing the memory effects of the environment and the DD protection method. Furthermore, we also realized the transition from non-Markovian to Markovian dynamics in a realistic solid spin system by applying a magnetic field at room-temperature. Because of the turnoff of the information re-flow from the spin bath to the electron spin of the NV center, the POS of the RDJA decreased monotonically with the delay time of the measurement [6,43]. The memory effects in the non-Markovian process, obtaining the final measurement immediately after the operation is not an optimal strategy when the operation speed is comparable to the rate of information exchange between the system and the environment. However, using an appropriate delay time recovers the result. This study also demonstrated that the memory-effect-based non-Markovianity can be used as an important physical resource. Thus extracting and applying this resource for quantum information techniques is feasible. This finding will stimulate the application of these memory effects in non-Markovian quantum dynamics to improve the performance of practical QIP.
Furthermore, the spin state of the NV center in diamond was shown to be an excellent test platform for the study and application of non-Markovian dynamics beyond elaborate engineering systems [8,9]. In the future, the electron spin of the NV center could be used to address some fundamental physical questions [28] such as the mathematical structure of the geometric space of non-Markovian quantum dynamical maps, the relevance of non-Markovianity in the study of the border between classical and quantum aspects of nature, and the use of non-Markovian quantum probes to detect nonlocal initial correlations in composite environments. Ultimately, with a deep understanding of and perfect control over the environment, the performance of QIP in solid-state system can be further improved.

Methods
We used a room-temperature home-built confocal microscopy, with a dry objective lens (N.A. = 0.9), to address single NV center in a type-IIa, single-crystal synthetic diamond sample (Element Six). The abundance of 13 C was at the nature level of 1%. The NV centers were produced by nitrogen ions implantation and the energy of the implantation was 30 keV. The dosage was 10 11 /cm 2 and the estimated average depth of NV was 20nm. For NV center, the environment was made with dark spin bath 13 C and 14 N. In our work, the former was come from diamond lattice and was the source of slow dephasing noise. And the latter was come from nitrogen implantation, which caused the non-Markovianity of environment for NV center. The NV center, mounted on a three-axis, closed-loop piezoelectric stage for submicrometre-resolution scanning, was illuminated by a 532 nm diode laser. Fluorescence photons (wavelength ranging from 647 nm to 800 nm) were collected into a fiber and detected using the single-photon counting module, with a counting rate of 130 kHz and a signal-to-noise ratio of 200 : 1. We verified single photon emission from the NV center by measuring the photon correlation function. An impedance-matched gold coplanar waveguide (CPW), deposited on the bulk diamond, was used for delivery of MW to the NV center. The optical and MW pulse sequences were synchronized by a multichannel pulse generator (Spincore, PBESR-PRO-300).

Supplementary Information
I. EXPERIMENTAL SETUP Fig. 5(a) shows the image of NV center detected by a home-built confocal microscopy at room-temperature. We verified single photon emission from the NV center by measuring the photon correlation function g 2 (τ ) as shown in Fig. 5(b). And g 2 (0) < 1/2 indicates a single NV center.
With the secular approximation, the effective Hamiltonian for the qubit system reads [1,2] where ω e (ω I ) is the electron (nuclear) spin resonance frequency, S z (I j z ) denotes electron (nuclear) operator, A j is the hyperfine coupling between the electron and the jth nuclear spin, and H dip denotes the interaction within the nuclear spin bath. Electron spin levels m s = ±1 are separated from m s = 0 by a zero-field splitting D ≈ 2.87GHz [3]. The m s = +1 and m s = −1 energy level degeneracy is lifted by a static magnetic field along the NV symmetry axis as shown in Fig. 5(c). The optically detected magnetic resonance (ODMR) spectra of NV center is shown in Fig. 5(d). By tuning microwave (MW) frequency resonance with m s = 0 ↔ m s = +1, the NV center can be treated as a pseudo-spin-1/2 system [4].
In the experiment, we used two MWs (MW1 and MW2) for rotation operations around X and Y axes, respectively. Before the implementation of the RDJA [5][6][7], we first measured the frequencies of the Rabi oscillations with MW1 and MW2 as shown in Fig. 5(e) and made sure the same power of them. In order to analyze Rabi frequencies in these two MW channels, fast Fourier transform (FFT) spectra of the Rabi oscillations were carried out as shown in Fig. 5(f). We used π pluses with the length of 93ns for these two MW channels. The relative phase between MW1 and MW2 was π/2 and was verified by spin-locking experiment.

II. SIGNAL INTERPRETATION
In the experiment, the observed fluorescence signal, which is related to the population distributions among m s = 0 and m s = +1 states of NV center, can be converted to the probability of success of quantum coherent operation by linear transformation. Specially, we firstly initialized the system into m s = 0 state by a laser pulse and then changed it into m s = +1 state by MW operation and measured their photon counts (denoted by C max , C min ). In order to beat the fluctuation of photon counting, we repeated the experimental cycle at least 10 6 times. So the relative population of the m s = 0 state for where C is the measured photon count under the same experimental condition. Therefore, the probability of successful quantum operation can be expressed as the function of fluorescence intensity of NV center.

III. THE REFINED DEUTSH-JOZSA ALGORITHM
The main idea of the refined Deutsh-Jozsa algorithm [5] with single qubit is used to determine whether a coin is fair or fake just by one step. However, in classical world, we have to check both side of coin. Here, we give detailed instructions of it.
Step 1: initializing quantum system to ground state |0 Step 2: implementing Hadamard gate on the qubit. The state will be at |0 + |1 ; Step 3: operating a quantum black box on the qubit. If the coin is fake, we get |0 − |1 . If the coin is fair, we get |0 + |1 . In the experiment, the black box of fake coin corresponds to constant operation and the black box of fair coin corresponds to balance operation; Step 4: implementing Hadamard gate again on qubit. If the coin is fake, we get |0 . If the coin is fair, we get |1 ; Step 5: readout. The realization of quantum black box is the core of the quantum algorithm. In RDJA, the quantum core is a phase gate. In our work, we make use of a single qubit phase gate (e −iθσz = e iπ/2σx e −iθσy e −iπ/2σx ) to realize it. A third auxiliary level of NV center can also be applied to make the gate [7]. However, the single qubit phase gate can be carried out feasibly without additional microwave driving [7].

IV. TRIPLE MODE OF SPIN BATH
In the main text, we witnessed the strong non-Markovian environment of the quantum system by the trace distance method. A nonzero value for this method means that there is an initial state pair which the trace distance increases over a certain time interval. It can be interpreted as a flow of information from the environment back to the open system, implying the presence of memory effects. A pair of states, ρ 1 , ρ 2 are said to be an optimal state pair [9] if the maximum of N is attained. For NV center in the diamond, the environment is given by the nuclear spins coupling to the electron spin of NV center via hyperfine interaction [4]. Due to energy mismatching between NV center and spin bath, the spin flip-flop between them is usually prohibited. Hence, the energy conservation process such as pure dephasing is the main characteristic of NV center. And this process has direct effect on coherent superposition states, which stay in equatorial plane of Bloch sphere. So according to optimal state pair criterion [9], the optimal state pair is chosen in the present work.
After carrying out quantum state tomography (QST) as shown in Fig. 6(a), we can get the density matrix of the system: where all the components of density matrix can be obtained by normalizing fluorescence signal. Then we can calculate trace distance with formula and this result is shown in Fig. 6(b). In experiment, the non-markovianity of the quantum system is calculated by For NV center in diamond, the environment is composed of dark spin bath 13 C and 14 N and can be described by ∆S z I z [4]. Here I z is the z-component of a dark nuclear spin, and ∆ is the splitting of the triple mode reservoir. In the experiment, MW was resonant with the center frequency of ODMR and the evolution of trace distance of two optimal states can be fitted with where a and b relate to the mode density distribution of reservoir, and T relates to the width of reservoir. The type of lineshape can be explained by coupling with a dark spin-1 system instead of 1/2 [8]. By fitting the experimental data, we obtained a = 0.105 ± 0.002 , b = 0.218 ± 0.003, ∆ = (2.170 ± 0.005) MHz and T = 1382±31ns. So the width of each modes was 724±16 kHz. This result is agree with structure of resonance peaks as shown in Fig. 4(a). The frequency spectrum structure can be characterized by a triple-mode, where ω e is the electron spin resonance frequency. The effective Hamilton for NV center under MW driving reads H = ω e σ z /2 + Ω cos(ω e t)σ x + f (t)σ z /2, and we define g(t 1 − t 2 ) = f (t 1 )f (t 2 ) . So S(ω) corresponds to the Fourier transform of g(t). With this model, we can get the physical phenomenal formula Eq. (7). Due to the interaction between the spin qubit and the tripe-mode spin bath, the quantum gate, which was based on the Rabi oscillation, was imperfect and showed an average result. However, DD method can be applied to the modify the imperfect operation. After we pre-pared imperfect state which is denoted in the Y-Z plane of Bloch sphere, as shown in Fig. 7(b), we let it interact with the spin bath with a duration time t ≈ 170 ns, corresponding to complete failure of the RDJA for original sequence as show in Fig. 1(c) of main text. After applying DD operation, we got a state as shown in Fig. 6(d). After the system interacted with spin bath for τ = t again as shown in Fig. 7(e), we implemented (π/2) X gate and read the state out as shown in Fig. 7(f). From quantum state dynamic evolution, we can see only when t ≈ (170+n∆ −1 ) ns (n = 0, 1, 2 · · · ) the imperfect operation caused by spin bath can be modified by itself perfectly except the middle modes of spin bath which was resonant with MW. In brief, the DD method filters the slowly noise and non-Markovian environment modifies imperfect operations.