Implementing phase estimation using Silq
In this section, you are going to learn how to implement the phase estimation algorithm from scratch using the algorithmic steps we have gone through in the Getting started with the phase estimation algorithm section. Since the steps of the phase estimation algorithm are defined in the previous section, you will now be able to understand the coding of the algorithm in Silq in a very easy manner.
Take a look at Figure 10.3. It is always better to visualize the circuit because it helps in understanding the internal workings of the algorithm. The following diagram shows the phase estimation circuit:
From Figure 10.3, it becomes clear that the controlled-U operations are applied as we have implemented in the code and the inverse QFT is being performed at the very end of the circuit. Finally, measurement is taken for the first-register qubits, which provide an estimated value...