In this tutorial, some circuits are constructed with the controlled_on option. This is the
experimental multi-controlled circuit feature, which is not yet released in the latest version of QURI Parts.
Starting from this section, we demonstrate how to use QURI Parts to implement several algorithms containing quantum Fourier transform. We will cover:
Period finding
Phase estimation algorithm
The Shor's algorithm
So, in this section, we first illustrate how to use QURI Parts to build the circuit for performing quantum Fourier transform.
The purpose of this section is two fold:
Introduce how multi-controlled gate feature is used in practice.
where j=jn−1⋯j0=∑i=0n−1ji2i and 2na=0.an−1⋯a0=∑i=0n−1ai2i−n.
The last line of eq.(2) gives a convenient form where the circuit representation of the operation can be read out straightforwardly.
In our convention where the 0th qubit is positioned at the most right hand side, we need to first apply multiple SWAP gates to invert the order of the qubits:
∣jn−1jn−2⋯j1j0⟩SWAPs∣j0j1⋯jn−2jn−1⟩.
Then, we go through the standard textbook procedure of applying multiple controlled U1 gates to translate the above equation into the one in the second line of eq(2). For example, for the 0th qubit,