FIGURE 1. Quantum circuit for Shor's algorithm.

From the following article:

Experimental realization of Shor's quantum factoring algorithm using nuclear magnetic resonance

Lieven M. K. Vandersypen, Matthias Steffen, Gregory Breyta, Costantino S. Yannoni, Mark H. Sherwood and Isaac L. Chuang

Nature 414, 883-887(20 December 2001)

doi:10.1038/414883a

BACK TO ARTICLE

a, Outline of the quantum circuit. Wires represent qubits, and boxes represent operations. Time goes from left to right. (0) Initialize a first register of n = 2left ceilinglog2 Nright ceiling qubits to |0right fence circle times ... circle times |0right fence (for short |0right fence) and a second register of m = left ceilinglog2 Nright ceiling qubits to |0right fence circle times ... circle times |0right fencecircle times |1right fence). (1) Apply a Hadamard transform H to the first n qubits, so the first register reaches Sigma2n-1x = 0 |xright fence/radic(2n). (2) Multiply the second register by f(x) = ax mod N (for some random a < N which has no common factors with N), to get |psi2right fence = Sigma2n-1x = 0 |xright fence|1 times ax mod Nright fence/radic(2n). As the first register is in a superposition of 2n terms |xright fence, the modular exponentiation is computed for 2n values of x in parallel. (3) Perform the inverse QFT on the first register19, giving |psi3right fence = Sigma2n-1y = 0Sigma2n-1x = 0 e2piixy/2n|yright fence|ax mod Nright fence/2n, where interference causes only terms |yright fence with y = c2n/r (for integer c) to have a substantial amplitude, with r the period of f(x). (4) Measure the qubits in the first register. On an ideal single quantum computer, the measurement outcome is c2n/r for some c with high probability, and r can be quickly deduced from c2n/r on a classical computer via continued fractions2. b, Detailed quantum circuit for the case N = 15 and a = 7. Control qubits are marked by filled circles; circle plus represents a NOT operation and 90 and 45 represent ital zcirc rotations over these angles. The gates shown in dotted lines can be removed by optimization, and the gates shown in dashed lines can be replaced by simpler gates (see Methods).

Figures & Tables index
BACK TO ARTICLE