Use this file to discover all available pages before exploring further.
View on GitHub
Open this notebook in GitHub to run it yourself
The quantum phase estimation (QPE) function estimates the phase of an eigenvector of a unitary function.More precisely, given a unitary function F and an input containing a quantum variable with a state ∣ψ⟩ such that F(∣ψ⟩)=e2πiν∣ψ⟩,
the phase estimation function outputs an estimation of ν as a fixed-point binary number.Phase estimation is frequently used as a subroutine in other quantum algorithms such as Shor’s algorithm and quantum algorithms for solving linear systems of equations (HHL algorithm).Theoretical details are in Ref. [1].Function: qpeArguments:
unitary: QCallable
The unitary operation for which the qpe estimation the eigenvalues
phase: QNum
The output of the qpe, holding the phase as a number in the range [0,1)
Function: qpe_flexibleThe function is suitable when one wants to specialize the way the power of a unitary is defined, other than using the naive power.For example it can be used to obtain the time evolution of hamiltonians or for Shor’s algorithm.Arguments:
unitary_with_power: QCallable[CInt]
Power of a unitary.
Accepts as argument the power of the unitary to apply.
This example shows how to perform a simple phase estimation:
Initialize the state ∣3⟩ over two qubits.
Apply a phase estimation on the the controlled-RZ gate, represeneted by the unitary matrix:
10000e−i2λ000010000ei2λThe expected phase variable should encode 4πλ, the phase of the eigenvalue of the ∣3⟩ state.Choosing λ=π, the expected result is 41, represented in binary by 01.
The following examples will specifiy directly how to take powers in the QPE.The unitary function is suzuki_trotter, where the number of repetitions will be
In the case of diagonal hamiltonian it be exact exponentiation of the hamiltoian.
Take the following matrix:0000041000021000043Represented by the hamiltonian:H=−81Z0I1−41I0Z1+83I0I1