Shor’s Algorithm
Shor’s Algorithm#
We are now going to work up to implementing Shor’s algorithm to factor numbers.
These three points will correspond to the next three pages you work on. This summarizes what you will be doing and will be useful reference later but the details won’t make sense yet.
Classical Scaffolding: First, we are going to implement the classical scaffolding for Shor’s algorithm.
There will be a slow step in this process. In particular, you are going to need to find a number
In the classical scaffolding you will implement this slow part slowly. In particular you will write a python function that just check each
Quantum Matrix: Second, you are going to replace the slow python function for finding np.linalg.eig
) of this matrix, determine their phase (np.angle(e)/(2*np.pi)
) and use a continuing fraction algorithm (Fraction
) to extract the
Quantum Circuit: Finally, you are going to replace the function which computes