## Abstract

Using trapped atomic ions, we demonstrate a tailored and versatile effective spin system suitable for quantum simulations and universal quantum computation. By simply applying microwave pulses, selected spins can be decoupled from the remaining system and, thus, can serve as a quantum memory, while simultaneously, other coupled spins perform conditional quantum dynamics. Also, microwave pulses can change the sign of spin-spin couplings, as well as their effective strength, even during the course of a quantum algorithm. Taking advantage of the simultaneous long-range coupling between three spins, a coherent quantum Fourier transform—an essential building block for many quantum algorithms—is efficiently realized. This approach, which is based on microwave-driven trapped ions and is complementary to laser-based methods, opens a new route to overcoming technical and physical challenges in the quest for a quantum simulator and a quantum computer.

- Quantum information science
- quantum simulation
- quantum computation
- microwave-driven trapped ions
- spin-spin coupling
- long-range coupling
- quantum fourier transform

## INTRODUCTION

The idea of using one quantum system under sufficient experimental control to investigate the static and dynamic properties of another, complex quantum system that is difficult to access directly (*1*) has spurred the development of proposals for universal quantum computing and for quantum simulations. Devices for processing quantum information promise new insight into pertinent scientific problems ranging from quantum field theories, to molecular dynamics, to cosmology, to name but a small sample (*2*–*4*). A universal quantum computer would be suitable for tackling any of these scientific questions. More specialized quantum simulations—already in close experimental reach—also promise groundbreaking new insight into phenomena governed by quantum processes.

Recently, important experimental progress was demonstrated with several auspicious, potentially scalable physical systems, including trapped neutral atoms (*5*), propagating photons (*6*), superconducting qubits (*7*), and spins in semiconductors (*8*). Trapped atomic ions offer a level of quantum control of individual quantum systems that is unsurpassed, and systems of coupled effective spins realized by trapped ions are a powerful resource not only for universal quantum computing (*9*–*11*) but also for specific quantum simulations (*12*–*19*).

Here, we explore a system of effective spins represented by individual trapped ions that exhibit long-range spin-spin coupling. Such a long-range coupling between effective spins can be induced by a spatially varying static or dynamic magnetic field leading to a state-dependent shift of the ions’ internal states (*14*, *20*–*24*) or by laser beams inducing a state-dependent optical dipole force (*10*–*19*, *25*).

In the case of magnetically induced coupling, coherent operations are carried out using radio-frequency (RF) radiation, and the application of global pulses is sufficient to control coherent interactions between spins, thus avoiding technical and physical challenges associated with the use of laser light (*26*–*31*).

Quantum simulations carried out on a physical system that is particularly well suited for solving a particular problem are likely to yield new insight that is not available from computations on classical computers. A universal quantum computer could perform any such quantum simulation and, in addition, solve other problems that are intractable, for all practical purposes, on classical computers (*32*–*36*). Various implementations of essential elements of such a device and even complete quantum algorithms have been carried out (*37*), with atomic trapped ions playing a prominent role.

Here, we take advantage of magnetic gradient–induced coupling (MAGIC) between effective spins of trapped ions. We experimentally realize different coupling topologies within a three–spin-1/2 system and show ferromagnetic and antiferromagnetic interactions. All coupling topologies are attained by individual ion control using microwave (MW) pulses (*38*). Hence, during a quantum simulation or quantum algorithm, one can easily and rapidly change (“on the fly”) from one interaction to another. Furthermore, we also decouple any desired spin from the rest of the system. This enables one to use a subset of the qubit register as a quantum memory while simultaneously carrying out conditional quantum gates with other qubits. In addition, the change between coupling topologies enables the efficient implementation of quantum algorithms that are useful for quantum information processing, which is demonstrated by realizing a coherent quantum Fourier transform (QFT), taking advantage of simultaneous coupling between three spins.

## RESULTS

### Experimental setup

^{171}Yb^{+} ions are confined in a linear Paul trap with an axial trap frequency of ν_{1} = 2π × 130 kHz and a radial trap frequency of 2π × 500 kHz. After Doppler cooling, the ions form a linear Coulomb crystal (*39*). Two hyperfine states of each ion’s ground state ^{2}*S*_{1/2} represent an effective spin 1/2. If this spin is formed using at least one magnetically sensitive state, and in the presence of a static magnetic field gradient, effective spins can be distinguished by their frequency for resonant excitation. Also, they are coupled via a pairwise spin-spin interaction (*14*, *20*–*22*, *29*). If the spin-up state is encoded in the magnetic sensitive level |^{2}*S*_{1/2}, *F* = 1, *m*_{F} = ±1〉 ≡ |↑〉, the (linear) Zeeman effect causes the internal energy of spin *i* to depend on the ion position as *ℏ*ω_{i} = *g*_{F}*m*_{F}μ_{B}*B*(*z*_{i}), where *g*_{F} denotes the Landé factor, *m*_{F} denotes the magnetic quantum number (±1 for magnetic σ^{±} transitions used here), μ_{B} denotes the Bohr magneton, and *B*(*z*_{i}) denotes the magnetic field at qubit *i*’s axial position *z*_{i}.

The magnetic gradient present in our setup is 19 T/m (*29*). An additional magnetic bias field and the trapping potential described above result in magnetic fields at the ions’ positions of 0.1881(4), 0.4146(4), and 0.6432(5) mT. The corresponding addressing frequency separations are about 3.2 MHz. Hence, each of these spins can be individually excited by dialing in the MW frequency near 12.6 GHz, matching the respective spin resonance (*38*).

The Hamiltonian describing the spin-spin interaction of *N* ions reads (*21*, *22*, *29*)(1)where *ℏ* denotes the Planck constant and denotes the *z* Pauli matrix on qubit *i*’s subspace.

The mutual coupling strengths are given by(2)with the dimensionless constants . The dimensionless entry *S*_{in} of the unitary matrix that diagonalizes the dynamical matrix of the system is the scaled deviation of ion *i* from its equilibrium position when vibrational mode *n* is excited. Hence, ϵ_{in} describes how strongly the spin of this ion couples to the vibrational mode. Here, denotes the extension of the ground-state wave function of vibrational mode *n*, which has the angular frequency ν_{n}, and *m* is the ion’s mass.

Because the partial derivative of the internal energy of the spins always occurs pairwise in the *J*-coupling strength between two spins [(∂_{z}ω_{i}) × (∂_{z}ω_{j}) in Eq. 2], it is possible to control the sign of their mutual coupling. If the two spins have their spin-up state encoded in different hyperfine levels |^{2}*S*_{1/2}, *F* = 1, *m*_{F} = ±1〉, then their magnetic quantum numbers *m*_{F} differ in sign and, thus, their mutual *J*-coupling will be negative. However, if the magnetic quantum numbers are equal, the *J*-coupling will be positive.

When choosing (to first order) magnetically insensitive spin states, |^{2}*S*_{1/2}, *F* = 0〉 ≡ |↓〉 and |^{2}*S*_{1/2}, *F* = 1, *m*_{F} = 0〉 ≡ |↑〉 (referred to as the π basis in what follows), all of the spins have the same resonance frequency of the magnetic π transition; in addition, spin-spin coupling is suppressed.

### Fully coupled three-spin systems

To experimentally determine the joint couplings within a three-spin system, we observe its internal dynamics for different initial states. All spins are encoded in the hyperfine levels |↓〉 ≡ |^{2}*S*_{1/2}, *F* = 0〉 and |↑〉 ≡ |^{2}*S*_{1/2}, *F* = 1, *m*_{F} = −1〉 (henceforth referred to as the σ^{−} basis). The dynamics are studied using Ramsey-like experiments (see Materials and Methods), where one of the spins is prepared in a superposition state, whereas the other two are prepared in energy eigenstates. During a conditional evolution time, the system is left to evolve according to the time evolution , which results in a precession of the spin in the superposition state, whereas the spins in energy eigenstates are left unaffected. The spin precession is revealed by observing Ramsey interference fringes. Because the conditional dynamics are slower than the inverse dephasing time of a single spin, we apply 20 dynamical decoupling (DD) pulses during the conditional evolution time to protect the dynamics (see Materials and Methods) (*40*).

Exemplary results indicating conditional precession of spin 1 are shown in Fig. 1. The resulting Ramsey fringes with spins 2 and 3 prepared in |↑〉_{2}|↑〉_{3} (the indices denote the spin) are shown in Fig. 1A for two different conditional evolution times (1 and 4 ms). As one can see, the fringe minimum, which is found at π for vanishing conditional evolution time, is shifted to smaller phases for increasing conditional evolution time, which reveals the spin precession. One may also notice a reduction of the fringe contrast, which can be explained mainly by dephasing because of magnetic field noise that is not fully compensated by the present DD sequence. We measure the dephasing time of a single spin as τ^{σ} = 7.1(1.1) ms when 20 DD pulses are applied to each spin (see Materials and Methods).

This experiment is repeated for different input states of the second and third spins and for different conditional evolution times. In Fig. 1B, the acquired phase shifts conditioned on the initial states of spins 2 and 3 are shown. From these phase shifts Δϕ = *JT*, acquired by spin 1 during a conditional evolution time *T*, we obtain information about the couplings among the system. For the symmetric input state |↑〉_{2}|↑〉_{3}, the time evolution of the first spin is described by , which is a precession around the *z* axis at angular velocity *J* = *J*_{12} + *J*_{13}. Hence, from the observed phase shifts, we conclude that *J*_{12} + *J*_{13} = 2π × 52(9) Hz. For the other symmetric state |↓〉_{2}|↓〉_{3}, the evolution corresponds to a precession about the negative *z* axis at the same angular velocity *J*_{12} + *J*_{13}. For the antisymmetric input state |↑〉_{2}|↓〉_{3}, the time evolution is described by , and from the phase shifts, we conclude that *J*_{12} − *J*_{13} = 2π × 21(9) Hz.

The other antisymmetric input state |↓〉_{2}|↑〉_{3} causes a spin precession in the other direction at the same angular velocity. Here, the value of the precession frequency derived from a fit is 2π × 16(9) Hz. For the symmetric input states, the angular velocity is larger; hence, the slopes extracted from a fit of the data are less affected by statistical errors.

To measure the mutual coupling between two spins among the three-spin system, we effectively suppress the third spin’s coupling by selective recoupling (see Materials and Methods) (*41*). Here, an additional spin echo (SE) π pulse is addressed to the third spin and cancels the phase shift due to this spin. From this, we reconstruct the *J*-coupling matrix shown in Fig. 2A with all couplings being positive.

### Changing the coupling topology

We realize spin systems with different signs of the couplings by coding the spin states in different hyperfine levels. In contrast to the experiments described above, one of the spin-up states is now encoded in |↑〉 ≡ |^{2}*S*_{1/2}, *F* = 1, *m*_{F} = +1〉, and this spin is realized by the magnetic σ^{+} transition of its ion. The *J*-coupling matrices of such systems are reconstructed, and we summarize the results in Fig. 2 (B and C). The topology from Fig. 2B features next-neighbor couplings of opposite signs, whereas in the topology from Fig. 2C, the next-neighbor couplings have the same sign.

As we have shown, single-ion control allows for preparing any spin in different basis states, thereby tailoring the couplings in the system. In addition, it is possible to change the spin states during a quantum algorithm by application of MW pulses, which will change the couplings accordingly. Therefore, the change between different couplings can be performed on the time scale of the Rabi frequency Ω, that is, nearly instantaneously on the time scale of the conditional evolution. In these experiments, Ω ≈ 2π × 50 kHz.

We demonstrate this change between two bases by preparing the first spin in a superposition state in the σ^{−} basis. Then, we transfer the state by a sequence of MW pulses (see Materials and Methods) to the π basis where it is decoupled from the rest of the spin system. After a conditional evolution time, the spin state is transferred back to the σ^{−} basis, and the coherence is probed with a Ramsey pulse as before. Now, this spin does not acquire any phase shift that depends on the other spins’ initial states. Because this spin is less affected by magnetic field fluctuations, we measure its coherence time to be τ^{π} = 50(10) ms when only a single DD pulse is applied. The coupling between spins 2 and 3 is, again, reconstructed by Ramsey-like experiments, and experimental results are shown in Fig. 2D. In the context of quantum information processing, such a system of two coupled spins and one uncoupled spin with a long coherence time realizes a quantum memory, while simultaneously, the other two spins may perform a conditional quantum gate.

Furthermore, it is possible to simultaneously suppress all couplings within the system by transferring all the spin states to the magnetic insensitive base (compare Fig. 2E). Experimentally, we protect the product state of equal superposition states (hereafter, indices are omitted for simplicity) for 10 ms and detect a preserved coherence, for instance, of the second spin having a fidelity of 0.91(2).

### Quantum Fourier transform

Fully coupled spin systems are a resource for quantum computation, where each spin represents a qubit. We present the realization of an example quantum algorithm: the QFT, defined with its action on an orthonormal basis |0〉, |1〉,…, |*N* − 1〉(3)

We have chosen this particular algorithm because of its relevance in providing exponential speedup as a subroutine in many quantum algorithms (*35*, *42*, *43*). Previous realizations of the QFT in systems based on nuclear magnetic resonance (*44*, *45*) rely on single-qubit gates and conditional two-qubit gates. A realization with trapped ions was achieved using single-qubit gates, collective nonentangling gates, and collective entangling gates (*46*). A semiclassical QFT, without conditional two-qubit gates, using trapped ions is described by Chiaverini *et al.* (*47*). Such a realization can be used, for example, in the Shor algorithm (*32*), where the QFT is the last subroutine before a projective measurement of the output state. Because only probability amplitudes (and no relative phase information) need to be deduced, the fully coherent QFT can be replaced by the semiclassical version in such cases. However, there are existing algorithms in which the QFT or the inverse QFT is not the final subroutine and phase information of the output states is of further importance [for example, Harrow *et al.* (*34*) and Wiebe *et al.* (*36*)]. In these algorithms, the QFT cannot be replaced by a semiclassical version; hence, the fully coherent QFT is necessary for their realization.

In physical systems that are described by an Ising-type Hamiltonian, usual realizations of the QFT demand for the suppression of undesired couplings among the system during the conditional evolution of two selected qubits. However, in general, it is favorable to decompose the QFT into gates that can be realized naturally in the Ising-type system, for example, single-qubit operations and waiting times, during which the system evolves according to all the mutual couplings (*48*–*51*). In this way, the available physical system is efficiently used to achieve a reduced operation time and, consequently, to improve the fidelity of the quantum process, if the physical system is subjected to decoherence.

In what follows, we describe our gate set, which comprises a rotation *R*(θ), a phase gate Φ(φ), and an entangling gate *U*(*T*). We will also use phased rotations *R*(θ, φ), where the phase gate is absorbed in the rotation according to the rule *R*(θ, φ) ≡ Φ(φ/2)*R*(θ)Φ(−φ/2). The gate *R*(θ, φ) can be obtained with a simple phase shift in the driving MW field implementing *R*(θ). We have(4)(5)where the indices denote the qubit number and *R*_{k}(θ) = *R*_{k}(θ, 0).

The entangling gate is easily obtained from free evolution: We leave the ions to evolve with no driving for a certain conditional evolution time *T*(6)where *J*_{kl} represents the coupling strength for qubits *k* and *l*.

We derive the following sequence, which implements the QFT (up to a global phase) based on single-qubit rotations and entangling gates(7)

The derivation is described in more detail by Ivanov *et al.* (*52*) and in Materials and Methods where the duration *T*_{3} and the pulse areas *A*_{1} and *A*_{2} are also discussed. For the typical experimental parameters of the setup (*29*), one obtains the evolution times *T*_{1} = 3.69 ms, *T*_{2} = 0.22 ms, and *T*_{3} = 4.87 ms. Hence, the total duration of the algorithm is 8.78 ms. For the pulse areas, one obtains *A*_{1} = 0.686π and *A*_{2} = 0.716π.

The sequence in Eq. 7 can be further optimized. We first note that *T*_{2} is much shorter than the other conditional evolution times and can therefore be neglected, which results in an infidelity on the order of 10^{−3}. By making use of the fact that the entangling gate and simultaneous π pulses applied to all three qubits’ commute, we combine subsequent pulses applied to a qubit whenever possible. The gate *U*_{23}(*T*_{3}) where the first qubit’s coupling is suppressed could be realized by a change of the qubit base, as shown in our experiments. However, for simplicity, it is realized here by an SE pulse in the middle of the evolution time. An additional π pulse compensates for the state change of the first qubit and takes into account a phase gate that originates from the combination of subsequent π pulses. The optimized sequence reads(8)and the circuit is presented in Fig. 3. An additional SWAP_{13} gate that interchanges the state of qubits 1 and 3 completes the QFT. This gate is realized by just relabeling the qubits.

The chosen realization takes advantage of the fully coupled three-qubit system and consists only of conditional free evolution times and single-qubit gates (see Materials and Methods) (*52*). In comparison to the serial decomposition of the QFT using two-qubit gates, which would take about 23 ms in our setup, the duration of this efficient sequence is only 8.6 ms. The relative advantage in terms of time grows further with growing *N* (*50*).

A first validation of the desired quantum dynamics is achieved by simultaneous Ramsey-type measurements after the three-qubit register was prepared in one of the eight computational basis states |000〉,|001〉,|010〉,|011〉,|100〉,|101〉,|110〉,|111〉. Because the QFT transfers each computational basis state to a product state of superpositions, we apply to each individual qubit a Ramsey π/2 pulse to probe the qubit states. In Fig. 4, exemplary results for the input state |010〉 are shown. The solid lines are fits to the data points, whereas the light dashed lines represent the ideal outcome of the QFT. The Ramsey fringes’ phases match the expected result of a QFT, which is also true for all the other computational basis states chosen as initial states. The average deviation between the expected and the experimentally obtained phase is 〈δϕ〉 = −0.07(15) rad. The phase of each qubit is determined by all couplings present in the three-qubit system. Therefore, we conclude that the conditional evolution times and single-qubit gates chosen to implement the QFT match the couplings among the system.

Although the phases of the fringes match the expectations, their contrast is significantly reduced. We explain this by dephasing during the conditional evolution periods despite applying DD, by pulse imperfections of the 60 DD pulses applied during the complete QFT, and by a limited single-shot readout fidelity (see Materials and Methods).

The three single-qubit output fidelities for input state |010〉 are *F*_{1} = 0.76(7), *F*_{2} = 0.86(4), and *F*_{3} = 0.84(4). If the output state is a fully separable state, then the three-qubit state fidelity is simply given by *F*_{1} × *F*_{2} × *F*_{3}. For a general state, the three-qubit state fidelity *F* of the state ρ right after application of the QFT is given by *F* = 〈ψ|ρ|ψ〉, where |ψ〉 is the ideal outcome. We further quantify the performance of the QFT by reconstructing this fidelity and obtain an average fidelity 〈*F*〉 = 0.58(5). Fidelities of the QFT for all input states (the basis states mentioned above and, in addition, for several superposition states) are given in Materials and Methods. Because the QFTs of the computational basis states are given by superposition states with equal weights for each qubit, an average fidelity of 〈*F*〉 = 0.58(5) clearly indicates nonclassicality. For comparison, an average fidelity of 0.5^{3} = 0.125 can be achieved with classical states.

In addition to validating the process that realizes the QFT for computational basis states and some exemplary superposition states, we demonstrate that the algorithm correctly estimates the period of quantum states. After initializing the register in the desired input state of interest, the sequence is applied and a projective measurement takes place. The probability of each possible outcome (|000〉,|001〉,…,|111〉) is recorded. In binary notation, these states represent the integer numbers *i* = 0, 1, 2...7, which label the output states. The necessary SWAP_{13} operation that completes the QFT is realized by interchanging qubits 1 and 3 during the analysis.

Figure 5 shows the results for the four input states |111〉,|+11〉,|++1〉, and |+++〉, which are of periods 8, 4, 2, and 1, respectively. We compare the experimental results both to the ideal expectation and to simulations that take into account the experimental imperfections present in the setup. Suitable measures that allow for a comparison of the experimentally determined probability *p*_{i} with the expected correlations *q*_{i} are the squared statistical overlap (SSO) and the distinguishability (*53*).

As one can see, the SSO and the distinguishability for the different states vary from 0.99(3) to 0.54(2) for the input states |111〉 and |+++〉, respectively. The reason for this broad range is the different susceptibility of different states to technical imperfections. One further observes that the match of the classical measures of the SSO and the distinguishability can be higher than the mean quantum state fidelities of 0.58(5) that have been discussed above. This can be explained by the fact that these benchmarks, in contrast to the quantum state fidelities, do not measure quantum phase relations.

## DISCUSSION

MAGIC makes it possible to coherently manipulate trapped ions using exclusively MW and RF radiation for all coherent operations. In similar laser-based experiments with trapped ions, signals controlling the coherent dynamics of ions are generated first in the MW or RF regime; then, laser light is modulated using these signals. Here, we avoid this detour via the optical regime, demanding the precise control of coherent light, and thus considerably simplify experimental requirements. In addition, spontaneous scattering is practically eliminated, and the vulnerability of quantum logic operations to motional excitation is reduced. The latter is true as long as the ions experience a harmonic potential, which is the case for Doppler-cooled ions, as has been investigated in much detail theoretically and in recent experiments (to be published). Also, individual addressing of interacting spins is possible with unprecedented low crosstalk (*38*).

We show that the spin-spin coupling topology can be experimentally tailored to best suit a desired quantum simulation or computation, and we have investigated different coupling topologies among an exemplary three-spin system realized by single-ion control using MW pulses. We demonstrate how to rapidly change the sign of the couplings in the system. Furthermore, any spin can be decoupled from the remaining coupled system. Thus, switching between the role of an ion as a memory qubit, on the one hand, and a qubit conditionally processing quantum information, on the other hand, is realized by simple MW pulses and does not require physical relocation (shuttling) of ions or the use of different ion species.

Also, the effective magnitude of spin-spin coupling during a quantum simulation or computation can be adjusted by varying the interaction time. In addition, the coupling strength can be varied by adjusting the trapping potential (*29*) and the magnetic gradient.

In microstructured segmented ion traps (*54*), detailed control of (quasi-)static DC potentials is possible. These potentials determine local and global trapping potentials, thus allowing for control of the range of interaction (for example, from long range to next-neighbor). At the same time, larger magnetic gradients can be achieved in microstructured traps. Thus, the use of such traps adds more versatility for realizing coupling topologies suitable for quantum simulation and computation (*55*–*59*).

A QFT that may serve as an essential ingredient of other quantum algorithms is implemented here. We take advantage of simultaneous coupling between all qubits, and a speedup of nearly a factor of 3 is achieved for three qubits as compared with a decomposition of the QFT into two-qubit gates.

The spin-spin coupling used here increases quadratically with larger magnetic gradients. In recent experiments, a gradient of 150 T/m (*60*) has been implemented, which would already yield an increase in coupling strength by about a factor of 60, as compared to the experiments reported here. In this case, the entangling gate time of the algorithm is reduced by the same factor to about 140 μs, and DD is no longer required. Single-qubit MW gates, as used here, have been previously realized with outstanding fidelity (*31*, *61*). Thus, a fidelity of the QFT higher than 0.99 is realistic when using a larger magnetic gradient (see Materials and Methods).

Because of the generality of the method used here, which takes advantage of a fully coupled spin system, this approach is attractive for other physical systems as well. A three-qubit processor could be used as an elementary unit for distributed quantum computing (*62*). Also, a relatively small quantum processor with qubits that serve at the same time as a quantum memory and a quantum processor for simultaneous conditional quantum dynamics is well suited as an essential element of a quantum repeater (*63*).

Using a larger magnetic gradient would also be useful for quantum simulations of various spin systems with flexible control of the coupling topologies. Furthermore, the system and methods described here are well suited for other quantum simulations, for instance, of lattice gauge theories (*64*).

## MATERIALS AND METHODS

### Spin precession and Ramsey experiments

We used Ramsey-like experiments to observe the ions’ internal coherent dynamics and deduce the couplings among the spins from these measurements. In this experiment, all of the spins were first prepared in |↓↓↓〉. Then, one of the spins was prepared in a superposition state . The other two spins were prepared in one of the energy eigenstates {|↓↓〉, |↓↑〉, |↑↓〉, |↑↑〉}. During a conditional evolution time *T*, the system evolved according to(9)Hence, the spins in energy eigenstates will not change their states, whereas the spin in the superposition state will perform a spin precession conditioned on the state of the other two spins. After the conditional evolution time *T*, a Ramsey π/2 pulse was addressed to the spin in the superposition state, and the spin’s state was measured. The phase of this pulse was varied while repeating the experiment to record Ramsey interference fringes. The phase information of these fringes revealed information about the spin state. Therefore, by observing the Ramsey fringes changing their phase for a varying conditional evolution time, we deduced the angular frequency of the spin precession.

For reconstructing the *J*-coupling matrix, we made use of the fact that the *J*-coupling is equal to the precession velocity. To measure the isolated mutual coupling between two distinct spins, we decoupled the third spin from the remaining system. This can be achieved using the selective recoupling method (*41*). Here, a single SE π pulse is addressed to the spin that shall be decoupled right in the middle of the conditional evolution time. Hence, the other spins’ evolution that is caused by this individual spin is effectively canceled. Like before, one of the coupled spins was prepared in a superposition state, whereas the other was prepared in an energy eigenstate. From the spin precession, the coupling among these two spins was deduced.

### Pulse sequence to change between couplings

The pulse sequence that transfers the spin state from one base to another is based on single-ion control with MW pulses. In the experiments, we showed the transfer from the magnetic sensitive base |^{2}*S*_{1/2}, *F* = 0〉 ↔ |^{2}*S*_{1/2}, *F* = 1, *m*_{F} = −1〉 (magnetic σ^{-} transition) to the (first-order) insensitive base |^{2}*S*_{1/2}, *F* = 0〉 ↔ |^{2}*S*_{1/2}, *F* = 1, *m*_{F} = 0〉 formed by the magnetic π transition. The particular sequence for this transfer of spin *n* consists of three MW pulses and reads(10)where π_{π} denotes a π pulse on the magnetic π transition and denotes a π pulse on qubit *n*’s σ transition. The phase of all pulses is ϕ = 0.

When using this sequence to decouple a spin by transferring it from the σ to the π base, it is possible that a small detuning of the pulse that prepares the superposition causes this spin to precess during the conditional evolution time. To suppress this spurious effect, an SE π pulse is included into the experimental sequence. After half of the desired evolution time, the isolated spin is recoded back to the sensitive base, and an SE pulse of phase ϕ = π/2 on the sensitive transition is applied before it is recoded back to the insensitive base. Right after the complete evolution time, the spin is again recoded back to the sensitive base. Now, a possible Ramsey experiment can probe the state of this spin *n*. In summary, the spin is recoded four times during the experimental sequence to decouple it.

For the case where more qubits (if not all) are recoded, the sequence in Eq. 10 is changed to(11)

### Dynamical decoupling

The dynamics within the three-spin system are driven by *J*-coupling, which is typically about 2π × 40 Hz for next-neighbor spins using a static magnetic gradient of 19 T/m at a center-of-mass frequency, ν_{1}, of the ions’ motion of about 2π × 130 kHz. Because the single spins’ coherences decay in the present experiment on the time scale of 200(100) μs, these dynamics are slower than the dephasing. To stabilize the dynamics and to enhance the coherence time, we applied DD pulses (*40*) during the conditional evolution times. To keep the desired conditional dynamics unaffected by the DD pulses, they need to be applied to all qubits simultaneously. Because the MW source used at present generates a single frequency at a certain time and the qubits’ addressing frequencies differ, the DD pulses were applied to the qubits one after another.

The timing of the DD pulse sequence used to measure the *J*-coupling matrix corresponds to a Carr-Purcell-Meiboom-Gill (CPMG) sequence with 20 pulses, and the time evolution reads(12)where τ denotes a waiting time, denotes a π pulse on qubit *n*’s magnetic σ transition, and the exponent denotes a repetition of the evolution in the brackets. The phase relation of the π pulses corresponds to a Knill DD sequence (*65*).

Although more pulses may further enhance the coherence time and hence the fringe contrast, after a certain duration, the pulse sequence becomes more and more susceptible to instrumental imperfections (*40*). In our setup, the pulse errors are consequences of a slow drift of the spins’ addressing frequencies. With 84 pulses, for example, it was possible to protect conditional spin dynamics for 11 ms (*29*, *40*). Thus, more pulses may enhance the contrast after 4 ms but, at the same time, reduce it for shorter evolution times. In general, there exists an optimal number of pulses for each evolution time. Twenty DD pulses turned out to be a good compromise for evolution times between 1 and 5 ms, as used here, to measure the conditional phase shift.

The realization of the QFT took 8.6 ms; hence, more DD pulses were necessary to stabilize the dynamics during this period. During the QFT, a total of 60 DD pulses were addressed to each qubit. Twenty pulses were applied during the first conditional evolution time *T*_{1} and 40 pulses were applied during *T*_{3}. These pulse numbers turned out to be an optimal choice, and more pulses did not improve the performance in terms of the fidelity. The reason is that for more pulses, the sequence becomes more susceptible to instrumental errors, which counteract the improvements due to a longer coherence time.

### Derivation of the QFT sequence

We based our implementation on the more general approach presented by Ivanov *et al.* (*52*). The *N* = 3 Fourier gate can be obtained with the circuit , where *H*_{k} is the Hadamard gate, applied to ion *k*, and(13)and(14)are the phase gates, applied to all *N* = 3 ions in the beginning and at the end of the circuit. Note that the phase gates represent a shift of the phase of the driving field, rather than a physical modification of the qubit. Hence, they are not associated with infidelity. The circuit can be written in a more explicit form (up to a global phase of −π/2)(15)where we have used the Hadamard gate decomposition *H* = *iR*(π/2, −π/2)*R*(π). Below, we will implement this circuit with our gate set.

An operation that requires particular attention is the implementation of the term . During this process, no net evolution occurs between qubits 2 and 3, whereas a conditional evolution occurs between qubits 1 and 2 and between qubits 1 and 3. One possible realization is the consecutive realization of the coupling topologies where only qubits 1 and 2 or qubits 1 and 3 are coupled. In particular, one could first isolate qubit 3 for a certain time interval and then isolate qubit 2 for an additional time interval. However, such a realization would be time-consuming, and a parallel decomposition seems advantageous. For the implementation of this operation, we note that if we surround the gate *U*(*T*) (which is based on all the couplings among the system being present) with two π pulses on one of the qubits, we effectively change the sign of the coupling of the same ion with the other ions. If we apply the π pulses to ion 3, we change all couplings *J*_{jk}, where index 3 is present(16)Thus, the sequence *U*(*T*_{2})*R*_{3}(π)*U*(*T*_{1})*R*_{3}(π) yields(17)Now, if we choose(18)(19)we get the term and a residual factor. This factor can be eliminated with properly selected rotations, determined from the expansion(20)where *k*, *p* = *x*, *y*, *z*.

Thus, we rearrange the above sequence, which now acquires the form(21)where the duration *T*_{3} and the pulse areas *A*_{1} and *A*_{2} are obtained from the following set of equations(22)(23)Here, α = *J*_{23}/*J*_{13}. Note that the sequence in Eq. 21 is generic in the sense that it is valid for any spin-spin coupling *J*. This sequence was further optimized as described in the main text.

### State fidelities

To validate the QFT, we implemented the appropriate pulse sequence after initializing the three-qubit system in one of the computational basis states or in some exemplary superposition states. In the next step, we reconstructed the fidelity *F* = 〈ψ|ρ|ψ〉 of the three-qubit state ρ after the QFT, given the ideal result |ψ〉. Further analysis takes into account the single-qubit fidelities in each qubit’s subspace, *F*_{1}, *F*_{2}, and *F*_{3}, and the full three-qubit state fidelity *F*.

The QFT transfers the input states investigated here to fully separable product states |ψ〉 = |ψ_{1}〉|ψ_{2}〉|ψ_{3}〉. Under the assumption of a fully separable state after the QFT, ρ = ρ_{1} × ρ_{2} × ρ_{3}, we derived the single-qubit state fidelities *F*_{n} = 〈ψ_{n}|ρ_{n}|ψ_{n}〉 from Ramsey fringes (phase and amplitude).

The three-qubit state fidelity is measured without any assumption on ρ. The fidelity *F* = 〈ψ|ρ|ψ〉 can be written as *F* = 〈000|*V*^{†}ρ*V*|000〉, where *V* denotes local rotations that connect the ideal outcome |ψ〉 with the ground state |000〉. The procedure is therefore to apply appropriate single-qubit rotations *V* at the end of the QFT just before the projective measurement takes place. The probability of detecting the state |000〉 then yields the fidelity *F*. The results are summarized in Table 1.

We point out that we have carefully selected the input states in Table 1 in the following sense: With the first eight measurements, we made sure that the QFT is applied correctly to all eight computational basis states. Thus, we verified that each column vector in the measured QFT matrix is correct, possibly up to a column-specific global phase, which may vary from column to column. Next, we verified that these column-specific phases are equal, so that the correct QFT matrix is obtained up to a global phase. For this purpose, we performed seven additional measurements on superpositions. The first four measurements indicate that column 1 is in phase with column 5, column 2 is in phase with column 6, column 3 is in phase with column 7, and column 4 is in phase with column 8. The last three measurements, respectively, verify that column 1 is in phase with column 3, column 2 is in phase with column 4, and column 1 is in phase with column 2. With the described 15 measurements, we validated the QFT matrix up to a global phase.

For the computational basis states, the average state fidelity is 〈*F*〉 = 0.58(5). As one can also see, the results do not significantly differ for the investigated computational basis states and the exemplary superposition states. One may further notice that the product *F*_{1} × *F*_{2} × *F*_{3} that is equal to the three-qubit state fidelity under the assumption of fully separable final states and the measured three-qubit state fidelities *F* are in agreement.

### Technical imperfections in the setup

Experimental imperfections in the setup are sources of error. The most dominant source at present is the magnetic field noise that causes dephasing of the qubits. During the conditional evolution time, magnetic field noise is counteracted by DD pulses. However, these pulses are not perfect, due to slow drifts of the qubits’ addressing frequencies (*40*), and can cause a seemingly random behavior of the qubits, when many DD pulses are applied. Another instrumental error is the nonperfect single-shot detection efficiency. This causes a mistagging of the results and, hence, effectively a seemingly random outcome as well.

These different error sources have consequences for the performance of the QFT that differ for different input states of the algorithm. Qubits that are in a superposition state during the sequence are affected by dephasing, whereas a qubit in an energy eigenstate is not. Also for the histograms from which the periods are deduced (compare Fig. 4 in the main text), one may notice a very good performance for the input state |111〉. The reason is that the expected ideal histogram of this output state is the same as that for a totally dephased mixture of states. Therefore, the results are almost not affected by the present technical imperfections.

To date, there is no magnetic shielding or active stabilization of the magnetic field at the location of the ions. Adding this is expected to substantially improve coherence times and fidelities. In addition, the single-shot readout fidelity of the experiments reported here is 0.96 for a bright or a dark state and will be improved either by more advanced analysis (*66*) or by changes of the optical detection setup (*67*).

### Simulations

In independent experiments, we experimentally quantified the exponential decay of single-qubit coherences during the conditional evolution times. Hence, we can simulate the dephasing that leads to the partially dephased three-qubit density matrix ρ_{dephased}. In this matrix, the single-qubit coherences are partially decayed, and the particular decay depends on the duration during which a single qubit was in a superposition state. The experimentally determined decay constant is 0.0625/ms.

Furthermore, we deduced from separate experiments the effect of a seemingly chaotic behavior due to imperfect DD pulses and a limited single-shot readout fidelity. These two effects cause a change between the qubit states |0〉 and |1〉 and can be treated by mixing the three-qubit density matrix with white noise: .

The resulting fidelity affected by dephasing of the qubits and by white noise reads(24)Here, *F*_{dephased} describes the fidelity due to pure dephasing without any further instrumental errors, and the phenomenological parameter ζ = 0.25 describes the amount of white noise in the final state. These phenomenological parameters (the decay constant and ζ) allow us to simulate the time evolution of the pulse sequence that realizes the QFT in a way that includes the experimental imperfections.

We compared the simulated results to the recorded data for the experiments in which the periods of quantum states were computed by our quantum computer prototype. In detail, we computed the SSO between the measured probabilities *p*_{i} and the simulated outcomes *s*_{i} as . For all data sets, we obtained an SSO close to unity, and the average of all data sets was 0.98(−3+2). Therefore, we conclude that the limitations of the experimental results are dominated by the experimental imperfections that are part of our model.

### Error budget and perspectives

On the basis of our measurements and simulations of the experiment, we now further discuss how the infidelities due to the different error sources contributes to the average fidelity of . Using Eq. 24 and setting ζ = 0, we conclude that if the system were subjected to residual dephasing only, the fidelity would be limited to *F*_{dephased} = 0.73. White noise only (that is, considering only errors in detection and DD pulses by setting *F*_{dephased} = 1 in Eq. 24) would limit the resulting fidelity in Eq. 24 to (for ζ = 0.25), where 0.12 = 1 − 0.96^{3} is the contribution to the infidelity from the limited single-shot detection fidelity and the remaining infidelity (0.10) is caused by errors in the DD sequences.

This error budget allows us to predict the possible performance in an improved experimental setup. In the present setup, the magnet gradient experienced by the ions is 19 T/m. If the gradient is enhanced to 150 T/m, as was recently reported by Lekitsch *et al.* (*60*), the coupling strengths, being proportional to the gradient squared, will be about a factor of 60 higher. Therefore, such a gradient will speed up the algorithm by the same factor, resulting in a total duration of only about 140 μs.

In this situation, there would be no need for sequences of DD pulses because a single SE pulse already enhances the coherence time to a few milliseconds in our setup. Hence, the error due to imperfect DD pulses will be eliminated. For discussing the fault tolerance of a quantum gate, state preparation and detection errors can usually be neglected. Therefore, the gate fidelity will only be limited by errors of the few remaining pulses that realize the QFT. Because MW-driven single-qubit gates can be realized with high fidelity (*31*), a gate fidelity of the QFT in the range of 0.99 is realistic in a system that features a gradient of about 150 T/m. Measures to increase the qubit coherence time (shielding and active stabilization of magnetic fields) would further increase this fidelity.

This is an open-access article distributed under the terms of the Creative Commons Attribution-NonCommercial license, which permits use, distribution, and reproduction in any medium, so long as the resultant use is **not** for commercial advantage and provided the original work is properly cited.

## REFERENCES AND NOTES

**Acknowledgments:**

**Funding:**We acknowledge funding from the Deutsche Forschungsgemeinschaft, the Bundesministerium für Bildung und Forschung (FK 16KIS0128), and the European Community’s Seventh Framework Programme (FP7/2007-2013) under grant agreement no. 270843 (iQIT).

**Author contributions:**C.W. proposed the project and conceived the idea. C.P. and T.S. carried out the experimental study. S.S.I. proposed and developed the realization of the QFT. S.W. assisted in data analysis and interpretation of the results. C.P. and C.W. wrote the paper. All authors analyzed the data and commented on the manuscript.

**Competing interests:**The authors declare that they have no competing interests.

**Data and materials availability:**All data needed to evaluate the conclusions in the paper are present in the paper. Additional data related to this paper may be requested from the authors.

- Copyright © 2016, The Authors