Background
I have been doing research on quantum computing on my own for over a year now and I feel like I may have missed a fundamental step. I have no idea how to take a mathematical algorithm and create an equivalent gate sequence for an actual Quantum Computer to follow. I would like to be able to read articles on quantum algorithms and be able to create circuits from them, but unless I can find an example of how the gates are set up I am stuck. Even more frustrating is when gates are shown but are just representations of subroutines instead of the basic gates (example on page 5).
Grover's Algorithm Example
For example, I am pretty familiar with Grovers algorithm. For Grover's algorithm you perform the following steps (I'm borrowing from Wikipedia a bit):
Initialize all qubits to a $\left| 0 \right>$ except for a specified qubit (the oracle qubit according to Wikipedia) you initialize to $\left| 1 \right>$; this will be the target of the Orcale.
Put all qubits, except for ancilla bits, into a superposition using Hadamard gates. The mathematical algorithm says that this is equivalent to the following:
${\displaystyle |s\rangle ={\frac {1}{\sqrt {N}}}\sum _{x=0}^{N-1}|x\rangle .}$
I can kind of see how this would translate to Hadamard gates because we have the $\sqrt{N}$ on the denomonator.
- Next comes the trickiest part in my opinion, the Orcale. The oracle, a black box function (in my experience) can be created by formulating the problem as a SAT problem and then creating an equivalent quantum circuit that ultimately flips the "target bit." The mathemitacal algorithm says this is equivelent to ${\displaystyle |x\rangle |q\rangle \,{\overset {U_{\omega }}{\longrightarrow }}\,|x\rangle |q\oplus f(x)\rangle ,}$ where $U_w$ is the oracle and $|q\rangle$ is that subroutine as an operatior.
Again, this seems a little intuitive to me because I know the $|q\rangle$ should XOR the oracle qubit.
- Grover's diffusion operator is pretty darn confusing. Wikipedia defines this operator to be ${\displaystyle 2|s\rangle \langle s|-I}$.
From experience I know this can be achieved by sandwiching a large controlled Z, with target on last logical qubit that isn't the oracle qubit, by H and X gates like so:
I have no earthly idea how I would have figured that out from the instructions "${\displaystyle 2|s\rangle \langle s|-I}$"
- Repeat steps 3 and 4 $O \sqrt{N}$ times and then measure.
Question
What are some general methods or practices for creating gate sequences from mathematical algorithms? Seeing as there are many ways to create equivalent gate sequences, I am assuming that performing this process is an art that takes practice and experience. That being said, where should I start? What advice can you give me?