Project Locksport II
Phase-estimation and factoring, Shor's algorithm
![]() |
ImageFX |
test/study AI on Quantum Simulator https://blogbarley.blogspot.com/2024/08/ai-on-quantum-simulator-project.html
The phase estimation problem This section explains the phase estimation problem. We'll begin with a short discussion of the spectral theorem from linear algebra, and then move on to a statement of the phase estimation problem itself.
Spectral theorem The spectral theorem is an important fact from linear algebra that states that matrices of a certain type, called normal matrices, can be expressed in a simple and useful way. We'll only need this theorem for unitary matrices in this lesson, but in later lessons we'll apply it to Hermitian matrices as well.
theta = 0.7 qc = QuantumCircuit(3, 2)
Prepare the eigenvector
qc.x(2) qc.barrier()
The initial Hadamard gates
qc.h(0) qc.h(1) qc.barrier()
The controlled unitary gates
qc.cp(2 * pi * theta, 0, 2) qc.cp(2 * pi * (2 * theta), 1, 2) qc.barrier()
An implementation of the inverse of the two-qubit QFT
qc.swap(0, 1) qc.h(0) qc.cp(-pi / 2, 0, 1) qc.h(1) qc.barrier()
And finally the measurements
qc.measure([0, 1], [0, 1]) display(qc.draw(output="mpl"))
Shor's algorithm Now we'll turn our attention to the integer factorization problem, and see how it can be solved efficiently on a quantum computer using phase estimation. The algorithm we'll obtain is Shor's algorithm for integer factorization. Shor didn't describe his algorithm specifically in terms of phase estimation, but it is a natural and intuitive way to explain how it works. In the two subsections that follow we'll describe the two main parts of Shor's algorithm.
In the first subsection we'll define an intermediate problem known as the order-finding problem and see how phase estimation provides a solution to this problem.
In the second subsection we'll explain how an efficient solution to the order-finding problem also gives us an efficient solution to the integer factorization problem. When a solution to one problem provides a solution to another problem like this, we say that the second problem reduces to the first — so in this case we're reducing integer factorization to order finding. This part of Shor's algorithm doesn't make use of quantum computing at all, it's completely classical.
![]() |
ImageFX |
No comments:
Post a Comment