This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

A Scalable 5,6-Qubit Grover’s Quantum Search Algorithm

Dinesh Reddy Vemula Department of Computer Science and Engineering, SRM University AP, Andhra Pradesh, India
Email: {[email protected]}
Debanjan Konar Center for Advanced Systems Understanding (CASUS) and Helmholtz-Zentrum Dresden-Rossendorf (HZDR), Germany
Email: {[email protected] and [email protected]}
Sudeep Satheesan Digital Lab & COE, Firstsource Solutions Ltd, India
Email: {[email protected]}
Sri Mounica Kalidasu Indian Institute of Technology Guwahati, India
Email: {[email protected]}
Attila Cangi Center for Advanced Systems Understanding (CASUS) and Helmholtz-Zentrum Dresden-Rossendorf (HZDR), Germany
Email: {[email protected] and [email protected]}
Abstract

Recent studies have been spurred on by the promise of advanced quantum computing technology, which has led to the development of quantum computer simulations on classical hardware. Grover’s quantum search algorithm is one of the well-known applications of quantum computing, enabling quantum computers to perform a database search (unsorted array) and quadratically outperform their classical counterparts in terms of time. Given the restricted access to database search for an oracle model (black-box), researchers have demonstrated various implementations of Grover’s circuit for two to four qubits on various platforms. However, larger search spaces have not yet been explored. In this paper, a scalable Quantum Grover Search algorithm is introduced and implemented using 5-qubit and 6-qubit quantum circuits, along with a design pattern for ease of building an Oracle for a higher order of qubits. For our implementation, the probability of finding the correct entity is in the high nineties. The accuracy of the proposed 5-qubit and 6-qubit circuits is benchmarked against the state-of-the-art implementations for 3-qubit and 4-qubit. Furthermore, the reusability of the proposed quantum circuits using subroutines is also illustrated by the opportunity for large-scale implementation of quantum algorithms in the future.

Index Terms:
Quantum Computing, Grover’s search algorithm, IBM quantum computer, qubit

I Introduction

Quantum computing is a novel paradigm in computational science that has the potential to revolutionise the field [1]. Recently, quantum computing offers promising quantum advantages in various applications over classical counterparts due to the development of quantum hardware and inherent quantum entanglement characteristics [2, 3]. On quantum computers, conventional NP-hard tasks [4, 5, 6] can be solved in polynomial time, demonstrating a significant speedup over classical computers. Using Shor’s method [4] for factoring offers a super-polynomial speedup, whereas Grover’s quantum search [5] yields a polynomial speedup. The real-world applications of quantum computing and the speedups given by quantum algorithms will rely heavily on noisy intermediate-scale quantum (NISQ) devices [7], which can handle hundreds of quantum bits. The behaviour and viability of quantum algorithms, as well as their future applications as quantum computing advances, have been studied in the last few decades [8, 9]. However, the entire scope of classical issues that quantum computers can effectively handle has not yet been recognized [9]. In addition to this, with the growing data size, the computational science community has a rising demand to successfully deploy quantum algorithms on large scale applications [10].
Grover’s search algorithm is one of the most popular quantum computing algorithms that can search for an entity with a high probability in an unstructured list using only O(N\sqrt{N}[11] evaluations. Grover’s algorithm finds an entity in an unstructured list in fewer steps than a classical system [12]. In quantum processing, the search entity is one of the states from among all possible superposition states. According to Grover’s quantum search algorithm [12], there are 2n{2^{n}} = NN states in an nn-qubit network, and the probability of finding every state is 1N\frac{1}{N}. Hence, the amplitude of each state is 1N\frac{1}{\sqrt{N}}. The same problem takes maximum O(NN[12] trials in the classical system. According to Bennett et al. [11], no quantum method can solve the database search problem in fewer than O(N\sqrt{N}) steps asymptotically. Later, Boyer et al. [13] have shown that there are no quantum algorithm can outperform Grover’s algorithm by more than a few percentage points with a 50%50\% probability of success. The applications of Grover’s search include solving collision problems, finding the mean and median [12] of a given dataset, and reverse-engineering cryptographic hash functions by allowing an attacker to find a victim’s password.
In the last few decades, a plethora of Grover’s quantum search algorithms have been explored, which includes theoretical proof of the efficiency of the algorithm [14] and its applications in various problem domains [15, 16, 17, 18, 19]. Of late, the experimental implementation of fast Grover’s quantum search algorithm has been extended to Nuclear Magnetic Resonance (NMR) [20] for a system of four states. Moreover, a generalized Grover’s search algorithm [13] is introduced to deal with more than one marked state and allow an arbitrary number of unitary transformations in the original quantum circuit [21]. It may be noted that the generalization of Grover’s quantum search algorithm leads to adiabatic quantum computing settings [22]. However, the NMR systems lack scalability and optimization during the presentation of their experimental results. Grover’s quantum search algorithm has been implemented for two to four qubits on IBM’s quantum computer, such as a 2-qubit implementation on the ibmqx2 architecture [23], a 3-qubit on a trapped-ion architecture [24], and a 4-qubit circuit on ibmqx5 architecture [25]. There is an implementation of Grover’s search on a 2-qubit, 4-state quantum computer by Brickman et al. [26], and their findings demonstrate an improvement over the corresponding classical search approach. Mandviwalla et al. [27] demonstrate the experiments of a single-pattern Grover’s search for up to four qubits on IBM’s quantum computer and present the accuracy and execution time results. Recently, a five-qubit Grover’s search is realised on the ibmqx4 quantum computer by Abhijith et al. [28], and their models suffer from a lower success rate. Moreover, FPGA-based emulation of Grover’s circuit was suggested by Lee et al. [29] and Mahmud et al. [19]; however, their hardware designs are also not scalable.
Recent years have witnessed the growing interest in hybrid quantum-classical variational algorithms to solve the scalability issues of Grover’s quantum search [30]. Using Grover’s quantum search algorithm as a test case for variational hybrid quantum-classical algorithms has been proven to be asymptotically optimal. However, the variational quantum algorithms are restricted to four qubits. It uses only one shared angle in the quantum settings, which is not applicable for five or more qubits. The Grover search circuit proposed in our study has been modified from the usual circuit and widened to allow dynamic single-pattern and multi-pattern searches. The number of entangled qubits simulated in our experiments is also larger than in earlier studies. The significant contribution of this article is as follows:

  1. 1.

    This paper introduces a C4ZC^{4}Z gate and a novel Oracle function for 5-qubit and 6-qubit circuits using the C4ZC^{4}Z gate. Hence, a scalable Quantum Grover Search algorithm is proposed.

  2. 2.

    Furthermore, we developed a V-shaped Oracle (V- Oracle) pattern, which uses fewer gates and would potentially lead to fewer gate errors. The V-Oracle architecture can be easily extended to a higher number of qubits. The diffusion function takes the form HX + Oracle + XH to increase the amplitude of the search state.

  3. 3.

    Finally, the experiments presented here are performed on the IBM Q experience, with each circuit being iterated 10241024 times. The accuracy of the proposed 5-qubit and 6-qubit circuits is benchmarked against the state-of-the art implementations for 3-qubit and 4-qubit.

The rest of this article’s sections are arranged in the following fashion. Section II explains the proposed novel scalable Grover’s quantum search algorithm based on 55 and 66 qubits circuits, including an introduction to the gate construction. Grover’s quantum search algorithms in 55 and 66 qubit space and experimental results are provided in Section III. Section IV sheds light on the scalability and reusability of the proposed Grover’s quantum search model. Finally, the concluding remarks and future research directions with the opportunity for large-scale implementation of Grover’s quantum search are confabulated in Section V. The complete circuit to implement 5 and 6 -qubit Grover quantum search is provided in Appendix.

II Gate Construction and Proposed Scalable Grover’s Quantum Search Algorithm

Searching an unstructured data array of NN items is the primary objective of Grover’s quantum search algorithm [5]. For Grover’s quantum search strategy to be successful, it must locate an element in the collection A=A1,A2,A3,SNA=A_{1},A_{2},A_{3},\ldots S_{N} where NN is the number of elements in the set AA. The Boolean function δ\delta must be able to find an element in the collection so that δ(x)[0,1]\delta(x)\rightarrow[0,1] [19]. When iterating over each element one at a time, a classical computer would need an average of N2\frac{N}{2} queries for an array of cardinality NN [31]. A quadratic speedup over conventional computers is achieved by utilising Grover’s technique on a quantum machine, which only requires N\sqrt{N} queries. Multiple entries in the same collection may be found using Grover’s quantum search technique [13]. Each of the target patterns is found with equal probability by the algorithm. An Hadamard gate is first applied to transform the input qubits into entanglement and superposition with equal coefficients. Phase inversion and inversion around the mean are performed on the initial quantum state [19]. The following gates are required for implementing Grover’s quantum search algorithm.

Controlled TT-gate (cTcT): A T gate is a phase shift gate that shifts the phase of a qubit by π4\frac{\pi}{4} around the Z-axis. The cTcT or controlled T gate, is a two-qubit gate created by adding a control qubit to a TT gate. For example, if the control qubit equals to |1|1\rangle, a TT gate will be applied to the target qubit; otherwise, it will stay unaltered. The generic ckTc^{k}T gate, where kk is the number of control qubits, may be created by adding more control qubits. A controlled TT-gate describes a rotation of π4\frac{\pi}{4} around the Z-axis on the target qubit when the control qubit is true. T{T^{\dagger}}, its conjugate transpose, describes a rotation of π4-\frac{\pi}{4} around the same axis. The matrix representations of controlled TT gates can be found in [24, 19], as shown below.

T=[100eiπ4],cT=[100001000010000eiπ4].T=\begin{bmatrix}1&0\\ 0&e^{i\frac{\pi}{4}}\end{bmatrix},\;\;cT=\begin{bmatrix}1&0&0&0\\ 0&1&0&0\\ 0&0&1&0\\ 0&0&0&e^{i\frac{\pi}{4}}\end{bmatrix}. (1)

Controlled ZZ-gate (cZcZ): If it needs to invert the phase of the input qubit (i.e., the |1|1\rangle basis state) while keeping the |0|0\rangle basis state unaltered, we use a ZZ gate (or Phase Inversion gate) [31]. A controlled ZZ-gate describes a rotation of π{\pi} around the Z-axis on the target qubit when the control qubit is true. It is possible to generate a ckZc^{k}Z gate by adding several control qubits that are all equal to |1|1\rangle. When this occurs, a ZZ gate is applied to the target qubit, which otherwise remains unaffected. We have used cZcZ gate in our proposed model available in IBM Q. A ZZ and cZcZ gate matrix representation is shown below [24, 19].

Z=[100-1],cZ=[100001000010000-1].Z=\begin{bmatrix}$1$&$0$\\ $0$&$-1$\end{bmatrix},\;\;\;cZ=\begin{bmatrix}$1$&$0$&$0$&$0$\\ $0$&$1$&$0$&$0$\\ $0$&$0$&$1$&$0$\\ $0$&$0$&$0$&$-1$\end{bmatrix}.

A quantum computer can solve a type of decision problem called the bounded-error quantum polynomial time (BQP) problem in polynomial time with an error probability of at most 13\frac{1}{3} in all cases [18]. The unstructured search problem in this instance becomes a BQP problem as Grover’s iteration, when applied O(N\sqrt{N}) times, finds the element with a probability greater than 23\frac{2}{3} [32, 33].
The Grover iteration, or Grover operator, is a quantum circuit that is employed in the quantum search process. There are two phases in the Grover iteration [5]. At the outset, the oracle function flips the phase of a single amplitude in a marked state. Once the indicated state amplitude has been flipped over, the diffusion layer has completed its task. While the other states retain their original amplitude, the target state is in an inverted condition, causing the amplitude of the target state to rise significantly and the amplitude of the other states to fall somewhat.

II-A Oracle

The oracle [31] is frequently portrayed as a black box that takes the input state, |x|x\rangle, and inverts the select coefficient of the target base state.
Initialization: The Hadamard gate (HH gate) is used in the first stage of the algorithm to place all of the qubits in superposition [31] due to its ability to produce an equal superposition of basic states. If an HH gate is applied to the |0|0\rangle state, the resultant state is an equal probability superposition of the |0|0\rangle and |1|1\rangle states, i.e.,12(|0+|1)\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle). The following matrix represents an HH gate:

H=12[1111].H=\frac{1}{\sqrt{2}}\begin{bmatrix}1&\phantom{-}1\\ 1&-1\end{bmatrix}. (2)

The oracle function performs a phase flip on the marked state. Initially, the amplitude of all states, including the marked one, are 1N\frac{1}{\sqrt{N}}. The mean amplitude of all states is also 1N\frac{1}{\sqrt{N}}. The phase flip transforms the amplitude of the marked state (α(0)\alpha^{(0)}) to 1N-\frac{1}{\sqrt{N}}. It changes the mean amplitude as follows.

μ(0)=((N1)a(0)+α(0))N\displaystyle\mu^{(0)}=\frac{((N-1)*a^{(0)}+\alpha^{(0)})}{N}\quad (3)
=(((N1)1N1N))N=(N2)(NN)\displaystyle=\frac{(((N-1)*\frac{1}{\sqrt{N}}-\frac{1}{\sqrt{N}}))}{N}=\frac{(N-2)}{(N\sqrt{N})} (4)

Where aa is the amplitude of the unmarked state and α\alpha is the amplitude of the marked state. The superscript 0 refers to time zero, or, when the first iteration of Oracle is applied. We present two models for Oracle function here: one is the C4Z{C^{4}}Z gate model and the other is the V-Oracle model.

II-A1 Quaternary controlled Pauli Z-gate (C4ZC^{4}Z) model

C2ZC^{2}Z and C3ZC^{3}Z gates are used for the implementation of 3-qubit and 4-qubit quantum circuits [25], respectively. These gates are constructed using CNOTs and TT-gates [34]. We have built a C4C^{4}Z composite gate to implement Oracle for a search space of five qubits, as shown in Figure 1. This Oracle is used for search state |11111\left|11111\right\rangle. There are 25=322^{5}=32 states for five qubits. For all states except |11111\left|11111\right\rangle, the output will be the same as the input without any phase change. When the state is |11111\left|11111\right\rangle, all five TT-gates are activated and the third T{T^{\dagger}} gate also gets activated, resulting in a phase shift of π\pi. The state of qubit-4 changes from |1\left|1\right\rangle to eiπe^{i\pi} |1\left|1\right\rangle, which is (cosπ+isinπ\cos\pi+i\sin\pi) |1\left|1\right\rangle = -|1\left|1\right\rangle. Therefore, |11111\left|11111\right\rangle becomes -|11111\left|11111\right\rangle. The cU1cU1s are used to replicate TT and T{T^{\dagger}} gates. If we apply the gate logic for all other states, it can be validated that TT and T{T^{\dagger}} gate(s) cancel out each other, and the output state will be same as the input state without any phase transformation.

Refer to caption
Figure 1: C4C^{4}Z Model: Quantum circuit for a 5-qubit search space using TT and T{T^{\dagger}} gates. The sequence of gates correspond to a phase shift of π\pi when the input is |11111|11111\rangle

II-A2 V-Oracle model

With an increase in the number of qubits, the implementation of the Cn1Z{C^{n-1}}Z gate becomes more complex. It requires more number of gates to implement this Cn1Z{C^{n-1}}Z gate, thus potentially increasing gate error. In addition, there is a lack of a standard pattern to build this Cn1Z{C^{n-1}}Z gate. V-Oracle has a symmetric structure designed using a combination of Toffoli, cZcZ gate and ancilla qubits, as shown in Figure 2. This pattern is extensible to a higher number of qubits, and hence this V-Oracle model offers the scalability of Grover’s quantum search space. It provides a standard way to design an oracle for a larger number of qubits. Furthermore, this implementation requires fewer gates. Figure 3 and Figure 4 show the generic V-Oracle model for an even and an odd number of qubits. The |0\left|0\right\rangle in the figure represents ancilla qubits. V-Oracle for n-qubit can be designed using 2(n2){2*(n-2)} Toffoli gates, one cZcZ gate and (n2)(n-2) ancilla qubits.

Refer to caption
Figure 2: V-Oracle - a symmetric structure with Toffoli, cZcZ-gate and ancilla qubits for 5-Qubits
Refer to caption
Figure 3: Scaling V-Oracle for an even number of qubits
Refer to caption
Figure 4: Scaling V-Oracle for an odd number of qubits

II-A3 Gate error

Each quantum state is affected by a small error introduced by quantum gates. Qubits are uniquely entangled with one another because of the hardware implementation and layout of the coupling map. Depending on the qubit, the error size may vary. The V-Oracle employs a fewer number of gates compared to the Cn1Z{C^{n-1}}Z-model, thus resulting in smaller gate error. We adopted this V-Oracle pattern in the rest of our experimentation as it generates a shallower overall circuit as compared to the Cn1Z{C^{n-1}}Z model.

II-B Diffusion

Diffusion can be implemented as HX + Oracle + XH as seen in Figure 5, where HH is the Hadamard transform and XX is the PauliXPauli-X gate. This combination inverts the amplitudes around their mean. Grover’s approach predicts an increase in the marked state’s amplitude of 1N\frac{1}{\sqrt{N}}. The formula for the new amplitude of the marked state α(1)\alpha^{(1)} is 2*μ(0)\mu^{(0)}- α(0)\alpha^{(0)}. With α(0)\alpha^{(0)}= -1N\frac{1}{\sqrt{N}} and μ(0)\mu^{(0)}= (N2)(NN)\frac{(N-2)}{(N\sqrt{N})} (from equation 3), we can derive α(1)\alpha^{(1)} as follows:

α(1)=2(N2)(NN)1N\displaystyle\alpha^{(1)}=2*\frac{(N-2)}{(N\sqrt{N})}-\frac{1}{\sqrt{N}} (5)
=1N(2(N2)(N)+1)=3N4NN\displaystyle=\frac{1}{\sqrt{N}}*(2*\frac{(N-2)}{(N)}+1)=\frac{3}{\sqrt{N}}-\frac{4}{N\sqrt{N}} (6)

For a 5-qubit search space, N=2n=32N={2^{n}}=32. Hence, one iteration of Oracle and Diffusion will yield amplitude = 0.530330.022090.53033-0.02209 or equals to 0.508240.50824 and a probability of the marked state is (0.50824)2{(0.50824)^{2}} or equals to 25.83%25.83\%. Similarly, for a 6-qubit space, one iteration would yield a probability of 13.48%13.48\%. Table I compares the derived probabilities with simulating probabilities using the V-Oracle design. The deviations are observed to be very less, except for the 6-qubit circuit.

TABLE I: Derived vs simulating probabilities after one iteration of Oracle and Diffusion
Search Space Derived probability using the Equation 6 simulating probability (V-Oracle)-1024 shots
3-qubit 78.12%78.12\% 78.125%78.125\%
4-qubit 47.26%47.26\% 47.07%47.07\%
5-qubit 25.83%25.83\% 25.195%25.195\%
6-qubit 13.48%13.48\% 14.94%14.94\%

Proceeding with the 5-qubit quantum circuit, after the second rotation, the amplitude of a marked state α(2)\alpha^{(2)} is 2μ(1)*\mu^{(1)}- α(1)\alpha^{(1)}, where α(1)\alpha^{(1)} is 0.508240.50824 (for 5-qubit). To find μ(1)\mu^{(1)}, we need the amplitudes of all states, excluding marked states. The sum of the probabilities for unmarked (3131) states = 11 - probability of marked state (square of the amplitude given in Equation 6).

Sum of probabilities for unmarked states (7)
=1(3N4NN)2\displaystyle=1-{(\frac{3}{\sqrt{N}}-\frac{4}{N\sqrt{N}})}^{2} (8)
Probability of each unmarked state (9)
=1(3N4NN)2N1\displaystyle=\frac{1-{(\frac{3}{\sqrt{N}}-\frac{4}{N\sqrt{N}})}^{2}}{N-1} (10)
Amplitude of each unmarked state (11)
=1(3N4NN)2N1\displaystyle=\sqrt{\frac{1-{(\frac{3}{\sqrt{N}}-\frac{4}{N\sqrt{N}})}^{2}}{N-1}} (12)
=1NN((N39N2+24N+16)(N1))\displaystyle=\frac{1}{N\sqrt{N}}*\sqrt{(\frac{({N}^{3}-9{N}^{2}+24N+16)}{(N-1)})} (13)
=1NN(N1)(N28N+16)(N1)\displaystyle=\frac{1}{N\sqrt{N}}*{\sqrt{\frac{(N-1)*({N}^{2}-8N+16)}{(N-1)}}} (14)
=1NN(N4)2=(N4)(NN)\displaystyle=\frac{1}{N\sqrt{N}}*{\sqrt{{(N-4)}^{2}}}=\frac{(N-4)}{(N\sqrt{N})} (15)

Hence, the amplitude of each unmarked state after the first rotation is (324)(3232)\frac{(32-4)}{(32\sqrt{32})} or equals to 0.154670.15467.
Mean, μ(1)\mu^{(1)} = (310.154670.50824)32=0.13395\frac{(31*0.15467-0.50824)}{32}=0.13395
So, α(1)=20.13395(0.50824)=0.77614\alpha^{(1)}=2*0.13395-(-0.50824)=0.77614
The probability of a marked state after the second iteration will be (0.77614)2{(0.77614)^{2}} or equals to 60.24%60.24\%.
We derived the amplitudes of marked states for up to four rotations. Table II provides corresponding probabilities along with simulating outputs. Table III presents similar results for the 6-qubit circuit for up to six rotations.

TABLE II: Derived vs simulating probabilities for 5-qubit search space
Search Space after Derived probability using the Equation 6 simulating probability (V-Oracle)-1024 shots
First rotation 25.83%25.83\% 25.195%25.195\%
Second rotation 60.24%60.24\% 61.13%61.13\%
Third rotation 89.69%89.69\% 89.94%89.94\%
Fourth rotation 99.92%99.92\% 99.9%99.9\%
TABLE III: Derived vs simulating probabilities for 6-qubit search space
Search Space after Derived probability using the Equation 6 simulating probability (V-Oracle)-1024 shots
First rotation 13.48%13.48\% 14.258%14.258\%
Second rotation 34.39%34.39\% 34.863%34.863\%
Third rotation 59.14%59.14\% 60.254%60.254\%
Fourth rotation 81.64%81.64\% 82.227%82.227\%
Fifth rotation 96.35%96.35\% 97.168%97.168\%
Sixth rotation 99.66%99.66\% 99.902%99.902\%
Refer to caption
Figure 5: Proposed implementation of quantum circuit for 5-qubit search space using the combination of Superposition followed two iterations of Oracle followed by Diffusion.

It has been observed from the experimental results that for 5 and 6 qubit implementations, the derived and simulating outputs are almost similar.

II-B1 Unstructured search as a BQP [32] problem

With N\sqrt{N} number of rotations, the probability of the marked state increases above 23\frac{2}{3}. To attain a probability of at least 230.6667\frac{2}{3}\sim 0.6667, the amplitude required for the marked state would be greater than or equal to 0.66670.8165\sqrt{0.6667}\geqslant 0.8165. Hence, the number of repetitions of the order is greater than or equal to 0.8165N0.8165\sqrt{N}. This is owing to the fact that with each rotation (Oracle and Diffusion), the amplitude increases by at least 1N\frac{1}{\sqrt{N}}, i.e., 1N\geqslant\frac{1}{\sqrt{N}}. Therefore, with 0.8165N0.8165\sqrt{N} rotations, amplitude will be greater than or equal to (0.8165N)1N0.8165(0.8165\sqrt{N})*\frac{1}{\sqrt{N}}\geqslant 0.8165. It translates to a probability greater than or equal to 0.816520.66670.8165^{2}\geqslant 0.6667, as desired. For a 5-qubit space, this would evaluate to 0.8165320.8165\sqrt{32} or equals to 4.6254.62\sim 5. While the probability with five qubits is 23\geqslant\frac{2}{3}, we observed that with four rotations the probability was maximum, in the high 9090s, as given in Figure 6.

Refer to caption
Figure 6: V-Oracle implementation for 5-qubit showing high probability of 1111111111 state.

III Results

This section presents the experimental results of Grover’s quantum search implementation in 5-qubit and 6- qubit space on the IBM Q simulator. By default, IBM Q had five qubits and we extended it by editing the code in the IBM Q composer to increase the number of qubits. E.g., increase the size of the variable qreg from “q[4]q[4]” to “q[8]q[8]” to add four more qubits in the circuit (the full circuit is presented in Appendix).

III-A Grover’s implementation in 5-qubit space

The core part of the Oracle remains the same for all the states. The idea is to invert the qubit(s) using the PauliXPauli-X gate to flip the amplitude of the desired state. E.g., to design an Oracle for state 0111001110, we apply the Oracle from the earlier section and flip the first and last qubits. It will convert from 11111-11111 to 01110-01110.

Refer to caption
Refer to caption
Figure 7: Grover’s algorithm implementation of 5-qubit search space for the input 0111001110 using the repeated combination of Oracle followed by Diffusion four times.
Refer to caption
Figure 8: Result for 5-qubit showing 100% probability for 0111001110 state

The circuit for Grover’s quantum search implementation of the 0111001110 states is shown in Figure 7, and the circuit has additional XX gates to invert the phase of the search state 0111001110. There are two layers of XX-gates, one for inversion immediately after the oracle, other at the end just before measurement. These layers are required to amplify the probability of the search state. These XX-gates are applied only to qubits in |0\left|0\right\rangle state, e.g., for the search state0111001110, inversion and undo-inversion are applied only to the first and last qubits at the two layers XX-gates, respectively. It may be noted that the combination of Oracle and Diffusion is repeated four times. The graph as shown in Figure 8 yields 100%100\% probability for the state of 0111001110 on the IBM Q simulator.

III-B Grover’s Implementation for 6-qubit space

The Oracle and diffusion for 6-qubit are shown in Figure 9 and Figure 10. The complete circuit is given in Appendix.

Refer to caption
Figure 9: This diagram represents the proposed architecture for a 6-qubit search space with the help of four ancilla qubits. It depicts superposition followed by two iterations of Oracle followed by Diffusion.
Refer to caption
Figure 10: Experimental result for 6-qubit showing a high probability of 111111111111 state.

Along similar lines, oracle and diffusion for higher qubits can be easily implemented using the V-Oracle model. Table IV reports the probability of finding a given state using the proposed C4ZC^{4}Z and V-Oracle model for the 22 to 33-qubit quantum circuit and the 44 to 66 qubit quantum circuit, respectively, with the state-of-the art techniques implemented on the IBM Q simulator with 22 to 44-qubit quantum circuits [23, 27, 25]. For the 4-qubit quantum circuit, the proposed approach offers a higher probability owing to the fact that the Oracle followed by Diffusion is repeated thrice. It may be noted that similar experimental results are reported for fewer qubits on the IBM Q platform.

TABLE IV: Comparative experimental results in terms of simulating probability
Number of Qubits Number of rotations (Oracle and Diffusion) Simulating probability using the proposed quantum circuit Simulating probability using the state-of-the art techniques
22 11 100%100\% 100%100\% [23]
33 22 95%95\% 95%95\% [27]
44 33 96.387%96.387\% 47%47\% [25]
55 44 100%\sim 100\%
66 55 99.805%99.805\%

IV Discussion

IV-A Reusability

The Grover’s rotation (Oracle and Diffusion) when repeated 0.8165N0.8165\sqrt{N} times, increases the probability of finding the marked state to greater than 23\frac{2}{3}. For a 5-qubit space, this would evaluate to 0.816532=4.6250.8165\sqrt{32}=4.62\sim 5. Since diffusion contains Oracle (HX + Oracle + XH), the Oracle circuit is repeated ten times and it makes the quantum circuit complex and inefficient.
However, if the Oracle is built as a subroutine, we gain all the advantages of reusability. This reduces manual errors and it is less tedious as it avoids repeating all the gates and IBM Q provides subroutines. Despite the fact that the feature is not yet functional, it allows us to design the circuit. Figure 11 illustrates the 3-qubit search circuit using subroutines with one rotation (Oracle and Diffusion).

Refer to caption
Figure 11: 3-qubit search circuit using subroutines

IV-B Observations

This subsection covers a few observations that can be handy while designing circuits on the IBM Q.

IV-B1 Phase detection

The IBM Q simulator yields probabilities as an outcome after simulating a quantum circuit. Hence, it is a daunting task to figure out the correctness of an Oracle circuit as the output probability will always be positive. In order to validate whether a search state has its phase reversed or not, a circuit, as shown in Figure 13, can be built by applying HH gates to all qubits between the first and second barriers. Between second and third barriers, XX gates are placed only for qubits that have |1\left|1\right\rangle in the search state. For example, if a search state is 010010, place XX gate between the second and third barriers only for the second qubit. If the search state is 000000, then do not place any XX gates; for 111111, keep XX for all three qubits. The output will show all the states; however, if the phase of the search state is negative, as is the case for a correct Oracle, there will be a distinct tower for that state, as shown in Figure 13. If the Oracle is incorrect, the search state will be lost among other states, i.e., it will be as tall as other states.
For controlled phase shift on the IBM Q simulator, cRzcRz does not yield accurate results, unlike cU1cU1. A 5-qubit Oracle and Diffusion with cRzcRz (π4-\frac{\pi}{4}) resulted in a probability of approximately 14%14\% after one cycle, whereas the same circuit with cU1cU1 gives approximately 25%25\% theoretically. The same result is observed with the existing 4-qubit quantum circuit as well. It is worth noting that the cAcA combination of HX + Oracle + XH usually works as a diffusion

Refer to caption
Figure 12: Circuit for 010 phase detection
Refer to caption
Figure 13: Result for 010 phase detection

V Conclusion

This paper presents a 5-qubit and 6-qubit implementations of Grover’s quantum search algorithm. It introduces a V-Oracle pattern that offers a standard and relatively feasible technique to implement an unstructured search for a higher number of qubits. When applied for fewer qubits (less than 55), the V-Oracle model gives equivalent or outperforms the state-of-the-art approaches. All the experiments have been performed on the IBM Q simulator. The experiments suggest that future quantum systems can use the proposed scalable Grover’s search technique and technology for various large-scale applications. However, the ibmq_16_melbourne backend results are not promising, which indicates that the actual qubits still suffer from a lack of coherence. The authors are currently working in this direction.

VI Acknowledgements

This work was partially supported by the Center for Advanced Systems Understanding (CASUS), financed by Germany’s Federal Ministry of Education and Research (BMBF) and by the Saxon state government out of the State budget approved by the Saxon State Parliament. We also appreciate the usage of IBM Q in this project. The views expressed here belong entirely to the authors and not the IBM Q experience team or any other entity.

Appendix

Refer to caption
Figure 14: V-Oracle for 3, 4 and 6 qubits search space.
Refer to caption
Figure 15: Complete circuit for 5-qubit Grover’s implementation with 44 rotations (Oracle followed by Diffusion) that yielded a probability of more than 99%99\%. The diffusion is of the form HX + Oracle + XH, hence we see the Oracle getting repeated 88 times.
Refer to caption
Figure 16: Complete circuit for 6-qubit Grover’s implementation with 66 rotations (Oracle followed by Diffusion) that yielded a probability of more than 99%99\%. The diffusion is of the form HX + Oracle + XH, hence we see the Oracle getting repeated 1212 times.

References

  • [1] T. D. Ladd, F. Jelezko, R. Laflamme, et al., “Quantum computers,” Nature, vol. 464, no. 7285, p. 45–53, 2010, doi: https://doi.org/10.1038/nature08812.
  • [2] F. Arute, K. Arya, and R. Babbush, et al., “Quantum supremacy using a programmable superconducting processor,” Nature, vol. 574, pp. 505-–510, 2019, doi: https://doi.org/10.1038/s41586-019-1666-5.
  • [3] M. Cerezo, A. Arrasmith, and R. Babbush, et al., “Variational quantum algorithms,” Nat. Rev. Phys., vol. 3, pp. 625-–644, 2021, doi: https://doi.org/10.1038/s42254-021-00348-9.
  • [4] P. W. Shor, “Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer,” SIAM J. Comput., vol. 26, no. 5, pp. 1484–1509, 1997, doi: https://doi.org/10.1137/S0097539795293172.
  • [5] L. K. Grover, “A fast quantum mechanical algorithm for database search,” In Proc. 28th Annu. ACM Symp. Theory Comput., pp. 212–219, 1996, doi: https://doi.org/10.1145/237814.237866.
  • [6] D. Deutsch and R. Jozsa, “Rapid solution of problems by quantum computation,” In Proc. Roy. Soc. London A, vol. 439, no. 1907, pp. 553–558, 1992, doi: https://doi.org/10.1098/rspa.1992.0167.
  • [7] J. Preskill, “Quantum computing in the NISQ era and beyond,” Quantum, vol. 2, pp. 79, 2018, doi: https://doi.org/10.22331/q-2018-08-06-79.
  • [8] A. Glos, A. Krawiec, and Z. Zimborás, “VariSpace-efficient binary optimization for variational quantum computing,” npj Quantum Inf., vol. 8, no. 39, 2022, doi: https://doi.org/10.1038/s41534-022-00546-y.
  • [9] A. Perdomo-Ortiz, M. Benedetti, J. Realpe-Gómez and R. Biswas, “Opportunities and challenges for quantum-assisted machine learning in near-term quantum computers”, Quantum Sci. Technol., vol. 3, no. 030502, 2018, https://doi.org/10.1088/2058-9565/aab859.
  • [10] R. de Wolf, “The potential impact of quantum computers on society,” Ethics Inf. Technol., vol. 19, pp. 271-–276, 2017, doi: https://doi.org/10.1007/s10676-017-9439-z.
  • [11] C. H. Bennett, E. Bernstein, G. Brassard, and U. Vazirani, “Strengths and Weaknesses of Quantum Computing,” SIAM Journal on Computing, vol. 26, no. 5, pp. 1510-1523, 1997, doi:10.1137/S0097539796300933.
  • [12] L K. Grover, “Quantum mechanics helps in searching for a needle in a haystack,” Physical review letters, vol. 79, no. 2, pp. 325, 1997, doi:https://doi.org/10.1103/PhysRevLett.79.325.
  • [13] M. Boyer, G. Brassard, P. Hoyer, and A. Tapp, “Tight Bounds on Quantum Searching,” Fortschr. Phys., vol. 46, no. 4/5, pp. 493–505, 1998, doi: https://onlinelibrary.wiley.com/doi/10.1002/(SICI)1521-3978(199806)46:4/5%3C493::AID-PROP493%3E3.0.CO;2-P.
  • [14] C. Zalka, “Grover’s quantum searching algorithm is optimal,” Phys. Rev. A, vol. 60, no. 4, pp. 2746–2751, 1999, doi: 10.1103/PhysRevA.60.2746.
  • [15] C. Durr, and P. Hoyer, “A Quantum Algorithm for Finding the Minimum,” doi: https://doi.org/10.48550/arXiv.quant-ph/9607014, 1998.
  • [16] G. Brassard, P. Hoyer, and A. Tapp, “Quantum cryptanalysis of hash and claw-free functions,” In proc. LATIN 1998: Theoretical Informatics, Springer, Berlin, Heidelberg, pp. 163–169, vol 1380, 1998, doi: https://doi.org/10.1007/BFb0054319.
  • [17] G. Brassard, P. Hoyer, and A. Tapp, “Quantum counting,” In proc. Automata, Languages and Programming: ICALP 1998, Springer, Berlin, Heidelberg, vol 1443, 1998, doi: https://doi.org/10.1007/BFb0055105.
  • [18] N. J. Cerf, L. K. Grover, and C. P. Williams, “Nested quantum search and structured problems,” Phys. Rev. A, vol. 61, pp. 032303, 2000, doi: https://doi.org/10.1103/PhysRevA.61.032303.
  • [19] N. Mahmud, B. Haase-Divine, A. MacGillivray and E. El-Araby, “Quantum Dimension Reduction for Pattern Recognition in High-Resolution Spatio-Spectral Data,” IEEE Transactions on Computers, vol. 71, no. 1, pp. 1–12, 2022, doi: 10.1109/TC.2020.3034883.
  • [20] I. L. Chuang, N. Gershenfeld, and M. Kubinec, “Experimental Implementation of Fast Quantum Searching,” Phys. Rev. Lett., vol. 80, pp. 3408, 1998, doi: https://doi.org/10.1103/PhysRevA.61.032303.
  • [21] L. K. Grover, “Quantum Computers Can Search Rapidly by Using Almost Any Transformation,” Phys. Rev. Lett., vol. 80, pp. 4329, 1998, doi: https://doi.org/10.1103/PhysRevLett.80.4329.
  • [22] J. Roland, and N. J.  Cerf, “Quantum search by local adiabatic evolution,” Phys. Rev. A, vol. 65, pp. 042308, 2002, doi: https://doi.org/10.1103/PhysRevA.65.042308.
  • [23] K. Gurnani, K. B. Behera, and P. K. Panigrahi, “Demonstration of optimal fixed-point quantum search algorithm in IBM quantum computer,” 2021, https://doi.org/10.48550/arXiv.1712.10231.
  • [24] C. Figgatt, D. Maslov, A. K. Landsman, N. M. Linke, S. Debnath, and C. Monroe, “Complete 3-Qubit Grover search on a programmable quantum computer,” Nat. Commun., vol. 8, no. 1918, 2017. doi: https://doi.org/10.1038/s41467-017-01904-7.
  • [25] P. Strömberg, and V. B. Karlsson, “4-qubit Grover’s algorithm implemented for the ibmqx5 architecture,” Dissertation-KTH Royal Institute, 2018, https://www.diva-portal.org/smash/get/diva2:1214481/FULLTEXT01.pdf.
  • [26] K. A. Brickman, P. C. Haljan, P. J. Lee, M. Acton, L. Deslauriers, and C. Monroe, “Implementation of Grover’s quantum search algorithm in a scalable system,” Phys. Rev. A, vol. 72, no. 5, Nov. 2005, doi: https://doi.org/10.1103/PhysRevA.72.050306.
  • [27] A. Mandviwalla, K. Ohshiro and B. Ji, “Implementing Grover’s algorithm on the IBM quantum computers,” In. Proc. IEEE Int. Conf. Big Data, pp. 2531–2537, 2018, doi: 10.1109/BigData.2018.8622457.
  • [28] J. Abhijith et al., “Quantum algorithm implementations for beginners,” ACM Transactions on Quantum Computing, 2022, doi: https://doi.org/10.1145/3517340.
  • [29] Y. H. Lee, M. Khalil-Hani, and M. N. Marson, “An FPGA-based quantum computing emulation framework based on serial-parallel architecture,” Int. J. Reconfigurable Comput., vol. 2016, 2016, doi: https://doi.org/10.1155/2016/5718124.
  • [30] M. E. S. Morales, T. Tlyachev, and J. Biamonte, “Variational learning of Grover’s quantum search algorithm,” Phys. Rev. A, vol.98, pp. 062333, 2018, doi: https://doi.org/10.1103/PhysRevA.98.062333.
  • [31] C. P. Williams, “Explorations in Quantum Computing,” Texts in Computer Science, Springer, 2011, doi: https://doi.org/10.1007/978-1-84628-887-6.
  • [32] A. M. Nielsen and L. I. Chuang, “Quantum computation and quantum information,” Phys. Today, vol. 54, pp. 60–72, 2001,
  • [33] E. Bernstein, and U. Vazirani, “Quantum complexity theory,” SIAM Journal on computing, vol. 26, no. 5, pp. 1411–1473, 1997, doi: https://doi.org/10.1137/S0097539796300921.
  • [34] K. Takahashi, M. Kurokawa, and M. Hashimoto, “Multi-layer quantum neural network controller trained by real-coded genetic algorithm,” Neurocomputing, vol. 134, pp. 159–-164, 2014, doi: https://doi.org/10.1016/j.neucom.2012.12.073