2
$\begingroup$

I have experimented a bit with Grover's Algorithm, and I wanted to search for the states $|00\rangle$ and $|10\rangle$. I tried making a Quantum Circuit, which looks like the one below, but measuring the superposition 1 024 times only gives me all states with equal probability. Any way I could alter the approach?

enter image description here

$\endgroup$
2
$\begingroup$

It seems that there is a missing $\mathrm{X}$ and $\mathrm{H}$ gates on qubit $q_2$. I used this Grover algoritm shape:

Grover operator

Note 1: controlled $\mathrm{Z}$ is replaced by $\mathrm{CNOT}$ and Hadamards on both sides.

Note 2: put your Oracle instead of dashed line.

Note 3: you do not have to measure $q_2$.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks! I just wanted to ask, is there any particular reason as to why you would replace CZ with H-CX-H? $\endgroup$ – At2005 Jan 12 at 18:49
  • $\begingroup$ @At2005: You are welcome. To be honest, I had the circuit in my archive and I was lazy to replace the gates $\mathrm{H-CNOT-H}$ with $\mathrm{CZ}$. The function of both solution is the same. Moreover, when the circuit is transpiled for deployment on real qunatum hardware, the more complex gates are replaced with simpler gates, e.g. on IBM Q $\mathrm{CZ}$ is replaced with $\mathrm{CNOT}$ and Hadamards then Hadamards are replaced with $\mathrm{U2}$ gate having these parameters: $\phi = 0$ and $\lambda= \pi$. $\endgroup$ – Martin Vesely Jan 12 at 19:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.