Abstract
The Grover quantum search algorithm is a hallmark application of a quantum computer with a wellknown speedup over classical searches of an unsorted database. Here, we report results for a complete threequbit Grover search algorithm using the scalable quantum computing technology of trapped atomic ions, with betterthanclassical performance. Two methods of state marking are used for the oracles: a phaseflip method employed by other experimental demonstrations, and a Boolean method requiring an ancilla qubit that is directly equivalent to the state marking scheme required to perform a classical search. We also report the deterministic implementation of a Toffoli4 gate, which is used along with Toffoli3 gates to construct the algorithms; these gates have process fidelities of 70.5% and 89.6%, respectively.
Introduction
Searching large databases is an important problem with broad applications. The Grover search algorithm^{1,2} provides a powerful method for quantum computers to perform searches with a quadratic speedup in the number of required database queries over classical computers. It is an optimal search algorithm for a quantum computer^{3}, and has further applications as a subroutine for other quantum algorithms^{4,5}. Searches with two qubits have been demonstrated on a variety of platforms^{6,7,8,9,10,11,12} and proposed for others^{13}, but larger search spaces have only been demonstrated on a nonscalable NMR system^{14}.
The Grover search algorithm has four stages: initialization, oracle, amplification, and measurement, as shown in Fig. 1a. The initialization stage creates an equal superposition of all states. The oracle stage marks the solution(s) by flipping the sign of that state’s amplitude. The amplification stage performs a reflection about the mean, thus increasing the amplitude of the marked state. Finally, the algorithm output is measured. For a search database of size N, the singleshot probability of measuring the correct answer is maximized to nearunity by repeating the oracle and amplification stages O((N)^{1/2}) times^{1,2}. By comparison, a classical search algorithm will get the correct answer after an average of N/2 queries of the oracle. For large databases, this quadratic speedup represents a significant advantage for quantum computers.
Here, we implement the Grover search algorithm using a scalable trapped atomic ion system^{15} on n = 3 qubits, which corresponds to a search database of size N = 2^{n} = 8. The algorithm is executed for all eight possible singleresult oracles and all 28 possible tworesult oracles. All searches are performed with a single iteration. For a singlesolution algorithm (t = 1), the algorithmic probability of measuring the correct state after one iteration is \(t \cdot \left( {\left[ {\frac{{N  2t}}{N} + \frac{{2(N  t)}}{N}} \right]\frac{1}{{\sqrt N }}} \right)^2 = \left( {\frac{5}{{4\sqrt 2 }}} \right)^2 = 78.125\% \) ^{2}, compared to \(\frac{t}{N} + \frac{{N  t}}{N} \cdot \frac{t}{{N  1}} = \frac{1}{8} + \frac{7}{8} \cdot \frac{1}{7} = 25\% \) for the optimal classical search strategy, which consists of a single query followed by a random guess in the event the query failed. In the twosolution case (t = 2), where two states are marked as correct answers during the oracle stage and both states’ amplitudes are amplified in the algorithm’s amplification stage, the probability of measuring one of the two correct answers is 100% for the quantum case, as compared to \(\frac{{13}}{{28}} \approx 46.4\% \) for the classical case. The algorithm is performed with both a phase oracle, which has been previously demonstrated on other experimental systems, and a Boolean oracle, which requires more resources but is directly comparable to a classical search. All quantum solutions are shown to outperform their classical counterparts.
Results
Oracles
We examine two alternative methods of encoding the marked state within the oracle. While both methods are mathematically equivalent^{16}, only one is directly comparable to a classical search. The Boolean method requires the use of an ancilla qubit initialized to 1〉, as shown in Fig. 1b. The oracle is determined by constructing a circuit out of NOT and C ^{k}(NOT) (k ≤ n) gates such that, were the oracle circuit to be implemented classically, the ancilla bit would flip if and only if the input to the circuit is one of the marked states. By using classically available gates, this oracle formulation is directly equivalent to the classical search algorithm, and therefore can most convincingly demonstrate the quantum algorithm’s superiority. On a quantum computer, because the initialization sets up an equal superposition of all possible input states, the C ^{n}(NOT) gate targeted on the ancilla provides a phase kickback that flips the phase of the marked state(s) in the data qubits. An example oracle is shown in Fig. 1c to illustrate this. The phase method of oracle implementation does not require the ancilla qubit. Instead, the oracle is implemented with a circuit consisting of Z and C ^{k}(Z) (k ≤ n − 1) gates that directly flip the phase(s) of the state(s) to be marked (Fig. 1d, e).
Experimental setup
The experiments presented here were performed on a programmable quantum computer consisting of a linear chain of five trapped ^{171}Yb^{+} ions^{17,18} that are laser cooled near the motional ground state. Qubits are comprised of the firstorder magneticfieldinsensitive pair of clock states in the hyperfinesplit ^{2} S _{1/2} manifold, with 0〉 ≡ F = 0; m _{ F } = 0〉 and 1〉 ≡ F = 1; m _{ F } = 0〉 having a 12.642821 GHz frequency difference. Optical pumping initializes all qubits to the 0〉 state. We execute modular one and twoqubit gates through Raman transitions driven by a beat note between counterpropagating beams from a pulsed laser^{19}, which couples the qubit transition to the collective transverse modes of motion of the ion chain. The qubit–motion interaction provides entangling twoqubit Ising gates^{17,20,21}. A pulse segmentation scheme modulates the amplitude and phase of the Raman laser to drive highfidelity entangling gates using all modes of motion^{22,23}. Individual optical addressing of each ion with one Raman beam provides arbitrary singlequbit rotations (R(θ,ϕ)) as well as gates between arbitrary pairs of ions (XX(χ)) (see Methods for details). Statedependent fluorescence detection with each ion mapped to a separate photomultiplier tube (PMT) channel allows for individual ion readout^{15}.
Toffoli gates
Successful demonstration of the Grover search algorithm first requires the implementation of its subroutines. ControlledNOT (CNOT) gates constructed from an \(XX\left( {{\textstyle{\pi \over 4}}} \right)\) gate and singlequbit rotations (Methods) have been demonstrated on this system previously^{15}. Here, we show results for a controlledcontrolledNOT (C ^{2}(NOT)), or Toffoli3, gate, with a process fidelity of 89.6(2)% (Fig. 2a). Toffoli3 gates have been previously performed in NMR systems^{24} and ion traps^{25}, including this system^{26}. We employed a limited tomography procedure to verify that the Toffoli3 gate performed had no spurious phases on the outputs (Supplementary Note 1; Supplementary Fig. 1).
Our Toffoli3 gate is constructed from five twoqubit gates (three \(XX\left( {{\textstyle{\pi \over 8}}} \right)\) and two \(XX\left( {{\textstyle{\pi \over 4}}} \right)\) gates) in a manner similar to the Toffoli gate demonstrated in ref. ^{14}. Any doublycontrolled unitary C ^{2}(U) operation can be performed with five twoqubit interactions (two CNOTs, two C(V)s, and one C(V ^{†})) if a controlledV operation is available such that V ^{2} = U ^{27}. Since \(\left[ {XX\left( {{\textstyle{\pi \over 8}}} \right)} \right]^2 = XX\left( {{\textstyle{\pi \over 4}}} \right)\), we can add singlequbit rotations to construct a Toffoli3 gate with minimal use of twoqubit gates, as shown in Fig. 2b (see Methods for a detailed circuit diagram). This compares favorably to the six twoqubit gates that would be necessary if only CNOT (or equivalently, \(XX\left( {{\textstyle{\pi \over 4}}} \right)\)) gates were available. These constructions also provide for the implementation of C(Z) and C ^{2}(Z) gates, which can be constructed by adding a few singlequbit rotations to a CNOT or Toffoli3 gate, respectively (see Methods for circuits). For all circuits, the singlequbit rotations are further optimized to minimize total rotation time^{28}.
We use a related strategy to construct a Toffoli4 gate, and report an average process fidelity of 70.5(3)% (Fig. 2c). Using the methods described in ref. ^{29}, we construct a circuit with three control qubits, one target, and one ancilla qubit, requiring 11 twoqubit gates (see Methods for circuit). By again using both \(XX\left( {{\textstyle{\pi \over 4}}} \right)\) and \(XX\left( {{\textstyle{\pi \over 8}}} \right)\) gates, we are able to save one twoqubit gate relative to a construction limited to CNOT gates^{29}.
Data
Figures 3 and 4 show the results, respectively, of single and twosolution Grover search algorithms, each using both the Boolean and phase marking methods (see Methods for optimized circuits performed.). All possible oracles are tested to demonstrate a complete Grover search (Tables 1, 2). Two figures of merit are provided with the data for each oracle. The algorithm success probability (ASP) is the probability of measuring the marked state as the experimental outcome. For the twosolution algorithm, the ASP is calculated by summing the probabilities of measuring each of the two marked states. The squared statistical overlap (SSO) measures the statistical overlap between the measured and expected populations for all states: \({\mathrm{SSO}} = \left( {\mathop {\sum}\nolimits_{j = 0}^N {\kern 1pt} \sqrt {e_jm_j} } \right)^2\), where e _{ j } is the expected population and m _{ j } is the measured population for each state j ^{30}. Additionally, all of the data shown in this paper is corrected to account for state preparation and measurement (SPAM) errors (see figure captions for values), similar to the method proposed in ref. ^{31} while also accounting for multiion crosstalk^{15}. All uncertainties given are statistical uncertainties based on the number of experiments performed.
The single iteration, singlesolution Grover search algorithm shown in Fig. 3 has a theoretical ASP of 78.1%, as discussed above. The SSO takes into account that the seven unmarked states then have equal expected probabilities totaling 21.9% of being measured. For all Boolean oracles, the average ASP is 38.9(4)% and the average SSO is 83.2(7)%, while phase oracles have an average ASP of 43.7(2)% and an average SSO of 84.9(4)%; the reduced use of resources in the phase oracles (10 XX(χ) gates and 3 qubits for phase oracles compared to 16 XX(χ) gates and 5 qubits for Boolean oracles) results in better performance, as expected. These results compare favorably with the classical ASP of 25%.
The twosolution Grover search algorithm shown in Fig. 4 has a theoretical ASP of 100%, as discussed above. For all Boolean oracles, the average ASP is 67.9(2)% and the average SSO is 67.6(2)%, while phase oracles have an average ASP of 75.3(2)% and an average SSO of 74.4(2)%; the reduced use of resources in the phase oracles (6–8 XX(χ) gates and three qubits for phase oracles compared to 10–14 XX(χ) gates and four qubits for Boolean oracles) results in better performance, as expected. For all oracles in both cases, the two states with the highest measurement probability are also the two marked states. These results compare favorably with the classical ASP of 46.4%.
Outlook
We note that this implementation of the Grover search algorithm scales linearly in the twoqubit gate count and ancilla count for increasing search database size as a function of the number of qubits n, and for a constant number of solutions t. For a database of size N = 2^{n} stored on n qubits, the amplification stage requires one Toffolin gate, and the tsolution oracle stage requires at worst t Toffolin (for a phase oracle) or Toffoli(n + 1) (for a Boolean oracle) gates; optimal oracles for particular sets of marked states may require even fewer twoqubit gates. The method used here to construct the Toffoli4 circuit scales to Toffolin gates as 6n − 13 in the twoqubit gate count and as \(\left\lceil {{\textstyle{{n  3} \over 2}}} \right\rceil \) in the ancilla count^{29}. This paves the way for more extensive use of the Grover search algorithm in solving larger problems on quantum computers, including using the circuit as a subroutine for other quantum algorithms.
Methods
Circuit diagrams
Here we present detailed circuit diagrams for all of the operations presented in the paper above, shown in terms of the R(θ,ϕ) and XX(χ) gates directly implemented by the experiment. The singlequbit rotation is defined as
Rotations about the Xaxis (R _{ x }(θ)) are achieved by setting ϕ = 0, and rotations about the Yaxis (R _{ y }(θ)) are achieved by setting \(\phi = {\textstyle{\pi \over 2}}\). Rotations about the Zaxis (R _{ z }(θ)) are comprised of three rotations about axes in the XY plane, as demonstrated in Fig. 5a.
The twoqubit entangling gate is
The parameter χ can be varied continuously by adjusting the overall power applied to the gate, but the gates used here require only \(\chi = \pm {\textstyle{\pi \over 4}}\) or \(\chi = \pm {\textstyle{\pi \over 8}}\). The gate is maximally entangling for \(\chi = \pm {\textstyle{\pi \over 4}}\), so \(XX\left( {{\textstyle{\pi \over 4}}} \right)\left {00} \right\rangle = {\textstyle{1 \over {\sqrt 2 }}}\left( {\left {00} \right\rangle  i\left {11} \right\rangle } \right)\).
Twoqubit XX gates are combined with rotation R gates to construct the composite gates needed for the Grover search algorithm implementation. The parameter χ can be positive or negative, depending on what ion pair is chosen and the particulars of the pulse segmentation solution chosen for the ion pair in question; the sign of χ (sgn(χ)) is determined experimentally for each ion pair. Consequently, some composite gate circuits include rotations with parameters that depend on sgn(χ). Composite gates were constructed by starting with known circuits, converting constituent parts into R and XX gates using lowerlevel constructions, and then optimizing the circuit. First, the number of XX gates was minimized (as in the Toffoli3 gate, described in the main text). Second, the singlequbit gates were optimized by minimizing the sum of all rotation angles θ, as this minimizes the total time for the experiment. Additional details can be found in refs. ^{28,29}.
The twoqubit CNOT and controlledZ gates are shown in Fig. 5b, c. They each require one XX gate and several rotations. The threequbit gates used here are the Toffoli3 and controlledcontrolledZ (CCZ) gates, shown in Fig. 6a, b. The Toffoli3 gate requires two control qubits (q _{1} and q _{2}) and one target qubit (q _{t}). Finally, the fourqubit Toffoli4 gate is shown in Fig. 7. It governs a fourqubit interaction between three control qubits (q _{1}, q _{2}, and q _{3}) and one target qubit (q _{t}), and it additionally requires an ancilla qubit (q _{a}).
The Grover search algorithm is implemented using circuits that are equivalent to those shown in Fig. 1b, d, but with the initialization and amplification stages optimized to minimize gate times, as shown in Fig. 8a, b. The circuits shown are for use with Boolean oracles; in the phase oracle case, the ancilla qubit q _{a} is simply omitted. To preserve the modularity of the algorithm, the initialization stage and amplification stage were each optimized without regard to the contents of the oracle, so each possible oracle can simply be inserted into the algorithm without making any changes to the other stages.
Oracles for the Grover search algorithm were constructed using a combination of reversible and classical logic synthesis techniques. For Boolean oracles, reversible logic synthesis was employed to find a set of X, C ^{N}(NOT) gates that marked the desired state(s) for each oracle. For phase oracles, EXOR polynomial synthesis was used to find a set of Z, C ^{N}(Z) gates that marked the desired state(s) for each oracle. For example, for Boolean oracles, the selection was limited to the classically available X (or NOT) and C ^{N}(NOT) gates, and a reversible circuit was constructed such that the output bit (corresponding to the ancilla qubit in the quantum oracle) would be flipped if and only if a marked state was used as the input to the circuit. While there are many possible circuit constructions for each oracle, the oracle chosen for implementation was one that first minimized the number of twoqubit interactions required, and then minimized the number of singlequbit interactions needed. The synthesis techniques used are scalable and can be applied to oracles of any size. The oracles used here were implemented as per the circuit diagrams shown in Table 1 for singlesolution oracles and Table 2 for twosolution oracles.
Other quantum algorithms may be implemented on this system in a similar fashion. First, decompose the algorithm’s subroutines into highlevel circuits. Second, optimize those circuits to minimize the number of twoqubit interactions required. Third, decompose the highlevel circuits into physicallevel R and XX gates. Finally, perform further optimizations to first minimize the number of twoqubit XX gates required, and then to minimize the total rotation time (the sum of all rotation angles θ) across all R gates. However, since the optimization of quantum circuits is QMAHard, we anticipate that future improvements in algorithm design, circuit synthesis, and circuit optimization techniques may result in more efficient circuit implementations, facilitating increased experimental performance.
Data availability
All relevant data are available from the corresponding author upon request.
References
Grover, L. K. Quantum Mechanics helps in searching for a needle in a haystack. Phys. Rev. Lett. 79, 325–328 (1997).
Boyer, M., Brassard, G., Høyer, P. & Tapp, A. Tight bounds on quantum searching. Fortschr. Phys. 46, 493–505 (1998).
Bennett, C., Bernstein, E., Brassard, G. & Vazirani, U. Strengths and weaknesses of quantum computing. SIAM J. Comput. 26, 1510–1523 (1997).
Magniez, F., Santha, M. & Szegedy, M. Quantum algorithms for the triangle problem. SIAM J. Comput. 37, 413–424 (2007).
Dürr, C., Heiligman, M., Høyer, P. & Mhalla, M. Quantum query complexity of some graph problems. SIAM J. Comput. 35, 1310–1328 (2006).
Chuang, I. L., Gershenfeld, N. & Kubinec, M. Experimental implementation of fast quantum searching. Phys. Rev. Lett. 80, 3408–3411 (1998).
Bhattacharya, N., van Linden van den Heuvell, H. B. & Spreeuw, R. J. C. Implementation of quantum search algorithm using classical fourier optics. Phys. Rev. Lett. 88, 137901 (2002).
Brickman, K.A. et al. Implementation of Grover’s quantum search algorithm in a scalable system. Phys. Rev. A 72, 050306(R) (2005).
Walther, P. et al. Experimental oneway quantum computing. Nature 434, 169–176 (2005).
DiCarlo, L. et al. Demonstration of twoqubit algorithms with a superconducting quantum processor. Nature 460, 240–244 (2009).
Barz, S. et al. Demonstration of blind quantum computing. Science 335, 303–308 (2012).
Manning, T. Quantum Information Processing with Trapped Ion Chains (PhD thesis, University of Maryland, 2014).
Mølmer, K., Isenhower, L. & Saffman, M. Efficient Grover search with Rydberg blockade. J. Phys. B At. Mol. Opt. Phys. 44, 184016 (2011).
Vandersypen, L. M. K. et al. Implementation of a threequantumbit search algorithm. Appl. Phys. Lett. 76, 646–648 (2000).
Debnath, S. et al. Demonstration of a small programmable quantum computer module using atomic qubits. Nature 536, 63–66 (2016).
Nielsen, M. A. & Chuang, I. L. Quantum Computation and Quantum Information: 10th Anniversary Edition. 10th edn, (Cambridge University Press, New York, 2011).
Milburn, G., Schneider, S. & James, D. Ion trap quantum computing with warm ions. Fortschr. Phys. 48, 801–810 (2000).
Olmschenk, S. et al. Manipulation and detection of a trapped Yb^{+} hyperfine qubit. Phys. Rev. A 76, 052314 (2007).
Hayes, D. et al. Entanglement of atomic qubits using an optical frequency comb. Phys. Rev. Lett. 104, 140501 (2010).
Solano, E., de Matos Filho, R. L. & Zagury, N. Deterministic bell states and measurement of the motional state of two trapped ions. Phys. Rev. A 59, R2539–R2543 (1999).
Mølmer, K. & Sørensen, A. Multiparticle entanglement of hot trapped ions. Phys. Rev. Lett. 82, 1835–1838 (1999).
Zhu, S.L., Monroe, C. & Duan, L.M. Arbitraryspeed quantum gates within large ion crystals through minimum control of laser beams. Europhys. Lett. 73, 485 (2006).
Choi, T. et al. Optimal quantum control of multimode couplings between trapped ion qubits for scalable entanglement. Phys. Rev. Lett. 112, 190502 (2014).
Cory, D. G., Price, M. D. & Havel, T. F. Nuclear magnetic resonance spectroscopy: an experimentally accessible paradigm for quantum computing. Physica D 120, 82–101 (1998).
Monz, T. et al. Realization of the quantum toffoli gate with trapped ions. Phys. Rev. Lett. 102, 040501 (2009).
Linke, N. M. et al. Experimental comparison of two quantum computing architectures. Proc. Natl Acad. Sci. USA 114, 3305–3310 (2017).
Barenco, A. et al. Elementary gates for quantum computation. Phys. Rev. A 52, 3457–3467 (1995).
Maslov, D. Basic circuit compilation techniques for an iontrap quantum machine. New J. Phys. 19, 023035 (2017).
Maslov, D. Advantages of using relativephase Toffoli gates with an application to multiple control Toffoli optimization. Phys. Rev. A 93, 022311 (2016).
Chiaverini, J. et al. Implementation of the semiclassical quantum fourier transform in a scalable system. Science 308, 997–1000 (2005).
Shen, C. & Duan, L.M. Correcting detection errors in quantum state engineering through data processing. New J. Phys. 14, 053053 (2012).
Acknowledgements
We thank S. Kimmel for helpful discussions. Circuits were drawn using the qcircuit.tex package. This work was supported by the ARO with funds from the IARPA LogiQ program, the AFOSR MURI program, and the NSF Physics Frontier Center at JQI. This material was partially based on work supported by the National Science Foundation during D.M.’s assignment at the Foundation. Any opinion, finding, and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the National Science Foundation.
Author information
Authors and Affiliations
Contributions
C.F., D.M., N.M.L., S.D. and C.M. designed the research; C.F., K.A.L., N.M.L., S.D. and C.M. collected and analyzed data; D.M. contributed to the theory; and C.F., D.M., K.A.L., N.M.L., S.D. and C.M. contributed to the manuscript.
Corresponding author
Ethics declarations
Competing interests
C.M. is the cofounder and chief scientist at IonQ, Inc. The remaining authors declare no competing financial interests.
Additional information
Publisher's note: Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Electronic supplementary material
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Figgatt, C., Maslov, D., Landsman, K.A. et al. Complete 3Qubit Grover search on a programmable quantum computer. Nat Commun 8, 1918 (2017). https://doi.org/10.1038/s41467017019047
Received:
Accepted:
Published:
DOI: https://doi.org/10.1038/s41467017019047
This article is cited by

A quantuminspired probabilistic prime factorization based on virtually connected Boltzmann machine and probabilistic annealing
Scientific Reports (2023)

Demonstration of three and fourbody interactions between trappedion spins
Nature Physics (2023)

Implementations of heralded quantum Toffoli and Fredkin gates assisted by waveguidemediated photon scattering
Quantum Information Processing (2023)

Noisy intermediatescale quantum computers
Frontiers of Physics (2023)

Quantum density peak clustering
Quantum Machine Intelligence (2023)
Comments
By submitting a comment you agree to abide by our Terms and Community Guidelines. If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate.